Trying to send RS232 with PIC sends incorrect data in TeraTerm
- From: jbitz34@xxxxxxxxx
- Date: 9 Apr 2007 16:46:25 -0700
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 <16F877.h>
#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 data***:
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:
http://www.sparkfun.com/commerce/product_info.php?products_id=198
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 control
When I run this program, I get the following in Tera Term:
http://bitzphoto.com/ECE445/teraterm.png
That is, a repeating sequence of incorrect characters.
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.
.
- Follow-Ups:
- Re: Trying to send RS232 with PIC sends incorrect data in TeraTerm
- From: cbarn24050
- Re: Trying to send RS232 with PIC sends incorrect data in TeraTerm
- From: Anthony Fremont
- Re: Trying to send RS232 with PIC sends incorrect data in TeraTerm
- Prev by Date: Re: ATTENTION: sci.electronics.design
- Next by Date: Re: ATTENTION: sci.electronics.design
- Previous by thread: Re: OT: Climate Change
- Next by thread: Re: Trying to send RS232 with PIC sends incorrect data in TeraTerm
- Index(es):