View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
UART hardware or software. What...? |
Posted: Wed Feb 05, 2014 8:28 am |
|
|
What is the condition, configuring UART as hardware?
Let assume that both RX and TX pins are hardware UART transfer pins.
Code: | #use rs232(baud=whatever, xmit=TX_hardware_pin, rcv=RX_hardware_pin) |
Is the code^^ configured as hardware UART?
As I know the only thing that makes different between hardwae and software UART is wich pins we use for rcv/xmit. I examined the entire CCS User Manual and I didnt see explaination. _________________ A person who never made a mistake never tried anything new. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Wed Feb 05, 2014 8:33 am |
|
|
Providing both xmt and rcv pins are optioned AND are are hardware UART pins, then the hardware UART will be used.Any other 'configuration' will create a software UART,unless some 'tricks ' are used.
Just create a small program,compile, printout listing and see what registers the compiler uses for the serial I/O.
All this is based on the PIC having a UART !
hth
jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19544
|
|
Posted: Wed Feb 05, 2014 8:38 am |
|
|
Yes.
Though must easier and safer to use:
Code: |
#use rs232(baud=whatever, UART1, ERRORS)
|
In the manual:
"UART1
Sets the XMIT= and RCV= to the chips first hardware UART."
Same for UART2 etc..
It is in the manual, if you select the section 'RS232 I/O overview' at the bottom of the #use rs232 page.
You _must_ always have the ERRORS statement, when using the hardware UART, unless you add error handling code yourself, or the UART can become hung.
This is in the main manual page as a warning at the bottom of the page. |
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Wed Feb 05, 2014 11:10 am |
|
|
I see now. Dont get me wrong, I read about UART1/UART2 described in user manual, but I thought we use it/them in case we have two hardware UARTS. My device has one. Aniway I understood. Thank you guis! _________________ A person who never made a mistake never tried anything new. |
|
|
|