|
|
View previous topic :: View next topic |
Author |
Message |
derricko
Joined: 03 Sep 2010 Posts: 8
|
AUART |
Posted: Wed Oct 27, 2010 9:21 pm |
|
|
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 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19500
|
|
Posted: Thu Oct 28, 2010 3:50 am |
|
|
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
|
|
Posted: Thu Oct 28, 2010 4:07 am |
|
|
Thank you Ttelmah,
you have solved my doubts. |
|
|
|
|
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
|