View previous topic :: View next topic |
Author |
Message |
MJ Guest
|
#use rs232 --> Is it using built-in (hardware) USART? |
Posted: Sun Sep 18, 2005 12:48 pm |
|
|
I'm setting up a simple application on an 18F and am confused how in the project wizard, one can define which pins the RS232 routine is using. The built-in hardware UART is defined for pins 17 and 18 (Tx and Rx, respectively) on the 18F2550.
Does that mean the #use rs232 is using a software-based bit-banging UART, and not the built-in hardware-based one?
I suppose as long as I'm getting my data, I'm happy; but I'm curious about the details. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Sep 18, 2005 1:00 pm |
|
|
If you put Tx on pin C6, and Rx on C7, then you'll get the hardware
UART with that PIC. Anything else will give you a software UART.
Example for hardware UART:
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS) |
|
|
Guest
|
|
Posted: Sat Sep 24, 2005 1:09 am |
|
|
Is it true also for i2c routines? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Sep 24, 2005 12:16 pm |
|
|
In the CCS manual, in the section on #use i2c, it says:
Quote: | Software functions are generated unless the FORCE_HW is specified. |
So to get hardware i2c, you must use the hardware pins,
and use the FORCE_HW parameter. Example:
#use i2c(Master, sda=PIN_C4, SCL=PIN_C3, FORCE_HW) |
|
|
|