View previous topic :: View next topic |
Author |
Message |
Riddick
Joined: 09 Oct 2007 Posts: 9
|
setup_uart undefined error for 16F877A |
Posted: Sun Nov 11, 2007 7:13 pm |
|
|
Hi all,
I've run into a slight quirk that I expect is an oversight on my part.
I'm trying to set the UART to off using setup_uart(FALSE); but am getting an error when I compile.
*** Error 12 "D:\VHF Tx\_main.c" Line 247(1,11): Undefined identifier -- setup_uart
I'm using v3.230 of the compiler with MPLAB 7.40
As the title suggests, I'm using a 16F877A.
I've read in the CCS C Manual, that the function requires #use rs232, which I tried defining, still with no results.
The reason I wanted to try explicitly disabling the UART is that I have an RS485 connection using pins C5 and C6. The hardware and software setup is exactly the same as on a 16F628A design, aside from the pins used. However, with the design in question I can send a data packet via RS485 but not receive.
I tried tacking wires from C5 and C6 to D1 and D3 and I can transmit and receive data with no problem.
Lastly, this is only a prototype so I can change the pins for the final design but I am curious to know why I get the error with setup_uart
Thanks in advance for any advice. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 11, 2007 7:46 pm |
|
|
Quote: | I'm using a 16F877A.
I have an RS485 connection using pins C5 and C6.
I am curious to know why I get the error with setup_uart. |
setup_uart() only works with the hardware UART. You must use pins
C6 and C7 to enable the hardware UART. |
|
|
Riddick
Joined: 09 Oct 2007 Posts: 9
|
|
Posted: Sun Nov 11, 2007 7:57 pm |
|
|
PCM programmer wrote: | setup_uart() only works with the hardware UART. You must use pins
C6 and C7 to enable the hardware UART. | Thanks for the reply PCM_Programmer. I actually want to disable the hardware UART, not configure it.
The RS485 implementation is my own and works on pins D1 and D3.
My problem is the compile error. Any suggestions, mate? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 11, 2007 9:32 pm |
|
|
The hardware UART is disabled upon power-on reset. It's only enabled
if you specify the hardware UART pins with a #use rs232() statement.
You don't need that line. Delete it. |
|
|
Riddick
Joined: 09 Oct 2007 Posts: 9
|
|
Posted: Mon Nov 12, 2007 3:58 pm |
|
|
Ignoring a problem doesn't fix it. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 12, 2007 4:28 pm |
|
|
I think what you want is some way to shut off the hardware UART,
but without using the CCS setup_uart() function.
See this thread for the disable_hardware_usart() function:
http://www.ccsinfo.com/forum/viewtopic.php?t=19737 |
|
|
Riddick
Joined: 09 Oct 2007 Posts: 9
|
|
Posted: Mon Nov 12, 2007 6:29 pm |
|
|
That is sort of what I was after. (I was more questioning why setup_uart generates a compile error than anything.)
I actually just threw a
Code: | #asm
bcf 0x18, 7
#endasm |
in, after remembering that I didn't always have the luxury of a C compiler.
Thanks again for your help. |
|
|
|