View previous topic :: View next topic |
Author |
Message |
Jimmie
Joined: 03 May 2010 Posts: 3 Location: Charlotte, NC
|
16F886 uart ... eusart |
Posted: Mon May 03, 2010 9:20 pm |
|
|
Hello,
I am migrating to the 16F886 in a product and I thought the chip had a uart. But the PCM compiler complains about my setup_uart(1200);
I looked for a command for the eusart ... didn't see it.
The data sheet shows a eusart connecting to pins TX and RX .
Am I supposed to use the #USE RS232 directive?
Thanks Kindly,
Jimmie _________________ Jimmie Does |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 03, 2010 10:24 pm |
|
|
Yes, you have to invoke the library code with a #use statement before
the compiler will accept the setup_uart() function. Example:
Code: | #include <16F886.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//============================
void main()
{
setup_uart(1200);
while(1);
} |
|
|
|
Jimmie
Joined: 03 May 2010 Posts: 3 Location: Charlotte, NC
|
16F886 uart ... eusart |
Posted: Tue May 04, 2010 5:09 am |
|
|
PCM Programmer,
Thanks for confirming the #use rs232.
I see you used in your response:
#fuses INTRC_IO, ....
That, I think, is the same as the fuse listed in the data sheet as INTOSCIO which makes RA6 and RA7 run as IO pins ?
Jimmie _________________ Jimmie Does |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 04, 2010 11:46 am |
|
|
Yes, that's right. |
|
|
|