I am trying to work out RS232 using a PIC, so I created a simple program to send a string message which would appear in the TeraTerm window. Here is the code snippet:
#if defined(__PCM__) #include #fuses HS,NOWDT,NOPROTECT,NOLVP #use delay(clock=20000000) #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) #endif
void main() {
output_high(PIN_A0); delay_ms(1000); output_low(PIN_A0); delay_ms(1000);
while(TRUE){ output_high(PIN_B4); delay_ms(500); output_low(PIN_B4); printf("Please work\\n"); delay_ms(1000); } }
====================
I have a Max232 converter in configuration according to the diagram on page 7 of this datasheet: http://www.ortodoxism.ro/datasheets/texasinstruments/max232.pdf
I am also using a device which transforms RS232 to USB and then has drivers to emulate a COM port on the PC, since my computer has no serial port. It is this piece:
My settings in both my device manager for COM1 (the emulated com port) and in Tera Term are
9600 baud 8 data bits no parity 1 stop no flow controlWhen I run this program, I get the following in Tera Term:
I'm lost at any other settings that might need to be changed to make the data appear correctly; any thoughts would be greatly appreciated.
Oddly, it worked correctly one time only, and it was not on the first try; but previous and subsequent attempts have repeatedly displayed this gibberish sequence.