muttu.sarve
Junior Member level 2
hi every one..
i'm facing some problem in my projects. i worked it on proteus and i have attached some snaps shot of my project. i'm reading analog i/p from RA2 and display it on 4 7-segments devices. i used 74ls78 bcd to 7 segment decoder and 74ls138 decoder. i've copied my source code too with this. the fig1 shows the intial setup and fig2 shows the during execution of the project. i think the problem with the code it self.. when i simulate in proteus only one device is active and its always shows zero (0) irrespective of analog input. i want to display the result on 7 segment so please go through the code and let me know if is there any changes have to make in this.
code:
i'm facing some problem in my projects. i worked it on proteus and i have attached some snaps shot of my project. i'm reading analog i/p from RA2 and display it on 4 7-segments devices. i used 74ls78 bcd to 7 segment decoder and 74ls138 decoder. i've copied my source code too with this. the fig1 shows the intial setup and fig2 shows the during execution of the project. i think the problem with the code it self.. when i simulate in proteus only one device is active and its always shows zero (0) irrespective of analog input. i want to display the result on 7 segment so please go through the code and let me know if is there any changes have to make in this.
code:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 #include<16f877.h> unsigned int cnt, brk; char led [3]; unsigned int rem; void converter (unsigned int z); void scanled (void); void main() { OPTION_REG=0x80; PORTA=0; TRISA=255; PORTD=0; TRISD=0; while(1) { cnt=ADC_Read(2); cnt=cnt*5; converter (cnt); scanled (); } } void converter(unsigned int z) { led[0]=z/1000; rem=z%1000; led[1]=rem/100; rem=rem%100; led[2]=rem/10; led[3]=rem%10; } void scanled (void) { unsigned char i; for (i=0;i<4;i++) { portd=i;portd=led[i];delay_ms(10); } }
Attachments
Last edited by a moderator: