hi everyone... what i want to do is that whenever i press a number from my computer, it will be displayed from the 7 segment display.. i have my own customized development board. Can anybody tell me what is wrong with my code?
something seems to be wrong with this code since the upper right part of the seven segment will not light.. so like when i press the number 1, only the lower half is shown.. i am using PIC MCU C compiler and a 16f877 microprocessor.. please help..
Code:
#if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#byte port_b=6
BYTE CONST LED_MAP[10] = {0x9,0xED,0x98,0xA8,0x6C,0x2A,0xA,0xAD,0x8,0x28};
void main() {
char pos1;
set_tris_b(0);
port_b=0;
pos1='0';
while(TRUE) {
port_b=LED_MAP[pos1-'0'];
if(kbhit()) {
delay_us(100);
pos1 = getch();
}
}
}
something seems to be wrong with this code since the upper right part of the seven segment will not light.. so like when i press the number 1, only the lower half is shown.. i am using PIC MCU C compiler and a 16f877 microprocessor.. please help..