STX-DATA-CHECKSUM-ETX-count#1-count#2-count#n-status#1-status#2-etc.....
void UART_SendString(unsigned char UART_String[]);
void UART_SendString(unsigned char UART_String[]) {
unsigned int i,j;
j = strlen(UART_String);
for(i=0;i<j;i++) {
TXSTAbits.TXEN=0;// disable transmission
TXREG=UART_String[i]; // load txreg with data
TXSTAbits.TXEN=1; // enable transmission
while(TXSTAbits.TRMT==0) // wait here till transmit complete
{
Nop();
}
}
}
This is c code to send strings to UART. It assumes you have strlen() function in your compiler.
[/code]
what actually does your frame consist of. can you give an example of your frame?
Interrupts are not commented in RS232(good).txt
Which code are you using?
Did you try adding a small delay betwwen each character transfer to UART?
is the baud rate parity and other things set properly on your PC side?
Do you think the problem is in usrt_gets() function? Where is ReadUSART(); function in the code? There is no ReadUSART(); definition.
Sorry, I don't see the definition of ReadUSART(); function. Is it a library function?
OK. Your STX is 0x02 and ETX is 0x03, right? What is any other byte is 0x02 and 0x03 other than STX and ETX, what happens then?
have you read page 71 of http://ww1.microchip.com/downloads/en/devicedoc/mplab_c18_libraries_51297f.pdf
Have you tried with getcUART() function instead of ReadUSART()
Due you have a proteus simulation? If yes, zip and upload it.
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?