djc
Advanced Member level 1
- Joined
- Jan 27, 2013
- Messages
- 402
- Helped
- 3
- Reputation
- 6
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- India
- Activity points
- 4,554
Hello,
Sometimes back i wrote a code for serial communication using PIC18F4520 and mikroc pro. I tested it using USART terminal provided with mikroc. It is working fine. means controller is able to accept and send the data. Then i tasted it on another laptop with same USART terminal. It worked fine. Both these laptop are having Windows 7 32 bit system. Then i tested it on windows 8 with same USART terminal software. Here it failed to work. Means no data is being accepted or sent by microcontroller. I then tested it with another hyperterminal software on same laptop. But it didn't work. I then tested on another laptop which has windows 7 64 bit system. But it didn't work. Here is the code for serial communication interrupt,
Can anybody please tell me that why it is working on one computer and why not on another one?
Sometimes back i wrote a code for serial communication using PIC18F4520 and mikroc pro. I tested it using USART terminal provided with mikroc. It is working fine. means controller is able to accept and send the data. Then i tasted it on another laptop with same USART terminal. It worked fine. Both these laptop are having Windows 7 32 bit system. Then i tested it on windows 8 with same USART terminal software. Here it failed to work. Means no data is being accepted or sent by microcontroller. I then tested it with another hyperterminal software on same laptop. But it didn't work. I then tested on another laptop which has windows 7 64 bit system. But it didn't work. Here is the code for serial communication interrupt,
Code:
void interrupt(){
if(PIR1.RCIF){
MAX_CONTROL=0;
if ((RCSTA.OERR )&& (RCIE_bit==1)){
RCSTA.CREN = 0;
Nop();
Nop();
RCSTA.CREN = 1;
garbage=RCREG;
garbage=RCREG;
}
else{
input_string[index]=RCREG;
if(input_string[index]==59){
flag=1;
}
index++;
if((index>12) && (input_string[12] != 59)) index=0;
}
PIR1.RCIF=0;
}
if(flag==1){
if((input_string[0]== 82) && (input_string[1]==59)){
MAX_CONTROL = 1;
Delay_ms(1);
UART1_Write(FND_0+65);
UART1_Write(FND_1+65);
UART1_Write(FND_2+48);
UART1_Write(FND_3+48);
UART1_Write(FND_4+65);
UART1_Write(FND_5+65);
UART1_Write(FND_6+48);
UART1_Write(FND_7+48);
UART1_Write(FND_8+48);
UART1_Write(FND_9+48);
UART1_Write_Text("\r\n");
Delay_ms(1);
MAX_CONTROL = 0;
}
if((input_string[0]== 87) && (input_string[11]==59)){
write=1;
}
index=0;
flag=0;
}
if(sent==1){
MAX_CONTROL = 1;
UART1_Write_Text("\r\nOK");
Delay_ms(1);
MAX_CONTROL = 0;
sent=0;
}
if(INTCON.TMR0IF){
TMR0L = TIMER_START_VALUE;
TMR0H = TIMER_START_VALUE_1;
TMR0IF_bit = 0;
}
if(prg_key==1){
blink++;
if(blink>500) blink=0;
last++;
}
}