mikro c 6
ใบรายงานผลการปฏิบัติงาน Code PORTB = Hex(s%10); PORTD.F2 = 1; Delay_ms(10); PORTD.F2 = 0; PORTB = Hex((s/10)%10); PORTD.F1 = 1; Delay_ms(10); PORTD.F1 = 0; PORTB = Hex((s/100)%10); PORTD.F0 = 1; Delay_ms(10); PORTD.F0 = 0; unsigned int Hex(int a) { switch(a) { 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; case 0: return 0x3F; } } ภาพจำลองการทำงานด้วยโปรแกรม Proteus อ้างอิง https://electrosome.com/matrix-keypad-pic-microcontroller/