View previous topic :: View next topic |
Author |
Message |
steppermotor
Joined: 24 Oct 2010 Posts: 10
|
RS-232 |
Posted: Sat Nov 27, 2010 10:13 pm |
|
|
Hello All,
I'm a bit desperate right now, could anyone point me to simple C code for sending and receiving rs-232 on a PIC16f877a.
Thanks. |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Sun Nov 28, 2010 5:11 am |
|
|
Read the CCS example in help file, it receives a data, data is incremented and printed to PC.
putc(getc()+1);
its the simplest and the best for basic diagnostics...
Read also the hardware connection details using the MAX 232 IC.
thanks
a |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Nov 28, 2010 11:55 am |
|
|
also look in the CCS Help/Manual for the preprocessor command #USE RS232 .
there's a lot of links to functions and examples at the bottom of that page. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Sun Nov 28, 2010 2:20 pm |
|
|
RealTerm seems to be a cool app (just installed it). As observed, "ANYTHING is better than Hyperterm". Be sure and note their comment if you are using a USB to Serial adapter (since lots of newer motherboards no longer have serial ports on them)
"If you are using an FTDI usb adaptor you need to install the FTDI driver first"
Note also on the link to TeraTerm is close, but there is a newer version out from what PCMProgrammer provided (as of Aug 30, 2010).
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Nov 28, 2010 2:33 pm |
|
|
USB->Serial can be summed up in one thought:
"Always Suspect until proven to work on THIS (and only this) computer/project/thingie/whatever."
I have great luck (90%) of the time with Iomega USB-RS232 adapters.... but for some reason (and the reasons are probably many) -- a hard serial port is still king for all applications - Period.
Go figure. USB is how old now?
-Ben
p.s. USB/Bluetooth/etc are perfect examples of how layers of abstraction add complexity that eventually WILL bite one in the hind-quarters. KISS principle wins. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Sun Nov 28, 2010 2:41 pm |
|
|
I've got of those USB<-> RS232 adapters here.One works the other fails miserably,go figure.And this is with a simple llopback connector on it !!!
I hate USB( Useless Serial Bus), give me a REAL comport ! With REAL interrupts, real time control is possible!
I second Realterm...seems to be stable and reliable. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sun Nov 28, 2010 2:48 pm |
|
|
temtronic wrote: | I second Realterm...seems to be stable and reliable. |
I like RealTerm, but I've noticed if I leave it running for a long time (hours and hours) -- it slows down and becomes unresponsive. I have to kill it and restart it and then it's fine for hours again.
Go figure. (shrug)
Otherwise it's very handy.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|