|
|
View previous topic :: View next topic |
Author |
Message |
root Guest
|
Disable uart TX pin, setup_uart(0) |
Posted: Thu Feb 14, 2008 2:13 am |
|
|
I need some help.
DeviceA rx <-{ttl rs232 5V} Pic 16F688 <-> {ttl rs232 3.3V} Device GPS
I get serial data from GPS. The data gets passed on to A. After x amount of time, I need to stop sending data to A and bring the tx pin to float/low/high ?, to allow device A to go into a sleep mode. A will go to sleep as it sees no serial device connected.
setup_uart(0) works, but also disables the RX pin. I need to continue to receive data from GPS, even if A is in sleep mode.
If I use rs232 without the xmit pin specified, it leaves the xmit pin in a high state. It needs to be in a state as setup_uart(0) would have left it in. Don’t know if it is low or floating. The issue here is Device A still sees a rs232 connected and refuse to go into sleep mode.
---
//setup_uart(0); // Disables RX also, no good
#use rs232(baud=4800, rcv=pin_C5, PARITY=N, BITS=8, ERRORS); // Leaves pin_C4/xmit in high, no good
Wait for external interrupt while get data from RX;
//setup_uart(1);
#use rs232(baud=4800, xmit=pin_C4, rcv=pin_C5, PARITY=N, BITS=8, ERRORS);
Pic 16F688
CCSC compiler 4.059
Thanks
root |
|
|
Ttelmah Guest
|
|
Posted: Thu Feb 14, 2008 3:07 am |
|
|
Code: |
#byte TXSTA=0x16
#bit TXEN=TXSTA.5
#bit TXTRIS=0x87.4
#define transmit_on() TXTRIS=1;TXEN=1
#define transmit_off() TXEN=0
|
Use 'transmit_off' to turn off the UART TX pin, and 'transmit_on' to enable it.
If you want to pull the pin high/low, then update the TRIS bit, or perform a output on the bit after disabling the transmit. The default will be for the pin to behave as an input, once the transmit is disabled. The 'on' function, automatically sets the tris bit 'back' to input mode as required for the UART to work.
Best Wishes |
|
|
Guest
|
|
Posted: Thu Feb 14, 2008 4:01 am |
|
|
Thanks for the quick reply. I will try the suggested tonight and give feedback later. So simple if one knows how 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
|