CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

setup_uart undefined error for 16F877A

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Riddick



Joined: 09 Oct 2007
Posts: 9

View user's profile Send private message

setup_uart undefined error for 16F877A
PostPosted: Sun Nov 11, 2007 7:13 pm     Reply with quote

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. Very Happy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 11, 2007 7:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 11, 2007 7:57 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 11, 2007 9:32 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 12, 2007 3:58 pm     Reply with quote

Ignoring a problem doesn't fix it.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 12, 2007 4:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 12, 2007 6:29 pm     Reply with quote

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. Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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