mdamor01
Newbie level 6
- Joined
- Sep 5, 2018
- Messages
- 11
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- Bangladesh
- Activity points
- 95
Hi everyone,
Using MikroC Pro for pic16f73, I can multiplex numbers [0-9] on 3 digit 7 segments, but can't multiplex any alphabet or any custom segments. I want to multiplex "H" and "L" in port B.
My program is:
Regard.
Omar.
Using MikroC Pro for pic16f73, I can multiplex numbers [0-9] on 3 digit 7 segments, but can't multiplex any alphabet or any custom segments. I want to multiplex "H" and "L" in port B.
My program is:
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 int X; // for Analog value unsigned short hex(unsigned short a){ switch(a){ case 0 : return 0x3F; //For 0 case 1 : return 0x06; case 2 : return 0x5B; case 3 : return 0x4F; case 4 : return 0x66; case 5 : return 0x6D; case 6 : return 0x7D; case 7 : return 0x07; case 8 : return 0x7F; case 9 : return 0x6F; For 9 }} void main() { TRISB = 0x00; //Port B as O/P, use for 7 segments A to G PORTB = 0x00; TRISA = 0xFF; //Port A as I/P, use for read Analog signal PORTA = 0x00; TRISC = 0x00; // Port C as O/P, use for 3 digit 7 segments common pin PORTC = 0xFF; while(1) { x=ADC_read(0); x= ((x*500)/255); PORTB = Hex(x%10); RC0_bit = 0; //1st digit Delay_ms(2); RC0_bit = 1; PORTB = Hex((x/10)%10); RC1_bit = 0; //2nd digit Delay_ms(2); RC1_bit = 1; PORTB = Hex((x/100)%10); RC2_bit = 0; //3rd digit Delay_ms(2); RC2_bit = 1; if (x<=250) {PORTB = ?????; //Want to show "L" RC2_bit = 0; Delay_ms(2); RC2_bit = 1;} else { PORTB = ????? ; //want to show "H" RC2_bit = 0; Delay_ms(2); RC2_bit = 1; } } } // End Program
Regard.
Omar.
Last edited by a moderator: