doug_h
Joined: 26 Feb 2004 Posts: 11
|
PIC RS232 Port Locks Up |
Posted: Sat Jun 12, 2004 3:13 pm |
|
|
Hello all,
I have a problem sending data to the PIC rs232 port from an external application. If I try and send anything more than 3 or 4 bytes in a stream, the INT_RDA hangs up and the PIC won't accept any more data until it get's reset. Do I need to throttle the send rate? or choose another baud? It's already so slow (9600).
To see what I mean, here's a sample program for the PIC, I used the CCS SIOW macro utility to send multiple bytes over a 232 cable from my PC. (In SIOW choose the macro menu command and add a macro that sends multiple bytes) A 3 byte macro works fine, but a 10 byte macro hangs the PIC's serial port every time.
Any ideas?
Compiler version is 3.190
Here's the code:
Code: | #include <16F877A.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT,PUT
#use delay (clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#define STATUS_LED PIN_A5
int32 byteCount = 0;
#INT_RDA
void serial_isr()
{
byteCount++;
printf("%X ", getc());
printf("%lu, ", byteCount);
}
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
printf("\r\nRunning serial interrupt test\r\n");
while(TRUE)
{
output_low(STATUS_LED);
delay_ms(500);
output_high(STATUS_LED);
delay_ms(500);
}
}
|
|
|