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); } }
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 39 40 #include<16f877.h> unsigned int cnt, brk; char led [4]; 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 << 4) | led[i]; // corrected error delay_ms(150); } }
how it possible with only 4 pins. for 4x4 matrix keyboard it required 8 pins right??? if it possible then please let me know how can i program
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?