|
|
View previous topic :: View next topic |
Author |
Message |
dewoul Guest
|
Pic16f688 |
Posted: Mon Jun 12, 2006 1:16 am |
|
|
Hi
i'm using the 16f688 and i ewant to use the uart like an rs232. Anyone know if there's a problem? And what is the code to write? Plesa help |
|
|
Ttelmah Guest
|
|
Posted: Mon Jun 12, 2006 2:46 am |
|
|
I don't think anyone will understand the question as posted, since it doesn't really tell us what you actually want to do. However, since this is a commonly 'misunderstood' part of the chip, I'll post an 'overview' of serial comms.
RS232, is a description of a voltage signalling standard, used to send asynchronous serial communications. As such, the PIC, _cannot_ generate this standard, without an external hardware transceiver (MAX232 etc.).
The UART, can generate 'TTL' level serial, that can drive such a transceiver to give the standard 'RS232' communications. The '#use RS232' command sets up the internal UART, to the correct values, ready to drive such a link (but can equally well drive an RS485 link, with a different transceiver, so the command itself is really a misnomerl)....
So, to generate 'RS232', you need:
#USE RS232, with the baud rate, word length, and parity settings for the link.
A suitable hardware transceiver to generate the signalling standard.
You can then send characters with 'putc' (for single characters), or 'printf' (for formatted strings of data), and retrieve characters with 'getc'.
In both directions, there is only a tiny amount of hardware buffering (basically two characters), so unless you can guarantee that your code can retrieve and interpret the incoming characters at the required rate, software buffering will need to be added. EX_SISR, is the example of how to handle a software buffered serial receive.
Best Wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 12, 2006 11:56 am |
|
|
Quote: |
I'm using the 16f688 and i want to use the uart. Anyone know if there's
a problem? |
If you have a compiler version of 3.200 or a few versions after that,
there will be a problem. If that is the case, then you need to upgrade
the compiler. |
|
|
|
|
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
|