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

AUART

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



Joined: 03 Sep 2010
Posts: 8

View user's profile Send private message

AUART
PostPosted: Wed Oct 27, 2010 9:21 pm     Reply with quote

I see from the driver file RS485.c. there is a session coded:
Code:

   #if getenv("AUART")
      #define RCV_OFF() {setup_uart(FALSE);}
   #else
      #define RCV_OFF() {setup_uart(FALSE);}
   #endif

Like to check anybody can decode? what is the meaning of AUART advance UART? Why does it need to know what is AUART status since if and else repeat the same thing. I am presently using PIC16F886, 887. How would I know if I have advance uart? (as I can't find it in the documents).

Is RCV_OFF() self declared by user or a standard command by manufacturer?

setup_uart(FALSE) is to disable uart?

In general what is the purpose for this coding?

Any heros? Thanks Embarassed
Ttelmah



Joined: 11 Mar 2010
Posts: 19500

View user's profile Send private message

PostPosted: Thu Oct 28, 2010 3:50 am     Reply with quote

RCV_OFF, is being created _by_ these lines.

It looks like a 'residuum', where, when originally written, in some earlier version of the compiler, different operations were needed for different hardware, so these lines were generated, with one probably giving a different setup_uart command, then later, the different line was changed to use exactly the same command, and instead of just having:

#define RCV_OFF() (setup_uart(FALSE);)

The old test was left.

Does no 'harm', except in making the code less readable, and the source a couple of lines longer. The final result will be the same, since only one of the two duplicate lines will ever actually be used.....

This is a common type of fault to see, where code has been modified as functions change.

The test returns 1, if the chip has a EUSART, rather than a basic USART.

Best Wishes
derricko



Joined: 03 Sep 2010
Posts: 8

View user's profile Send private message

PostPosted: Thu Oct 28, 2010 4:07 am     Reply with quote

Thank you Ttelmah,

you have solved my doubts. Razz
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