CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

RS-232

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
steppermotor



Joined: 24 Oct 2010
Posts: 10

View user's profile Send private message

RS-232
PostPosted: Sat Nov 27, 2010 10:13 pm     Reply with quote

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

View user's profile Send private message Send e-mail

RE:
PostPosted: Sun Nov 28, 2010 5:11 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 11:55 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 12:16 pm     Reply with quote

Quote:
I'm a bit desperate right now,

Read the forum everyday. You'll learn a lot.
http://www.ccsinfo.com/forum/viewtopic.php?t=40001

Here is a post that describes how to setup Hyperterminal:
http://www.ccsinfo.com/forum/viewtopic.php?t=9253&start=1

Teraterm is a better terminal program than HyperTerminal.
Here are instructions for downloading and installing TeraTerm:
http://www.ccsinfo.com/forum/viewtopic.php?t=39388&start=18

Here is the CCS FAQ article on RS-232 problems:
http://www.ccsinfo.com/faq.php?4

Here is a schematic of a MAX232 circuit:
http://web.ukonline.co.uk/j.winpenny/pic/rs232x.gif
Note that if you're using a MAX232A, then you should use 0.1 uF
capacitors, instead of the 1 uF caps.
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 1:02 pm     Reply with quote

PCM programmer wrote:

Teraterm is a better terminal program than HyperTerminal.
Here are instructions for downloading and installing TeraTerm:
http://www.ccsinfo.com/forum/viewtopic.php?t=39388&start=18


ANYTHING is better than Hyperterminal. ;)

I use PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/)and RealTerm (http://realterm.sourceforge.net/)

Both have their handy features.

Cheers,

Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 2:20 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 2:33 pm     Reply with quote

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: 9247
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 2:41 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 2:48 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group