Hi team,
on the properties of the RS232 port the is a hardware flow control can this be used to control the transmite and receiver of the 485 chip.
do i connect RTS & CTS to together.
Thanks
Wayne
RS485 using SN75176
-
- Posts: 234
- Joined: Thu May 31, 2007 2:18 pm
- Has thanked: 7 times
- Been thanked: 12 times
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: RS485 using SN75176
In most half-duplex RS485 applications the 75176 is held in receive mode unless the local device is transmitting. The normal RS232 hardware flow control signals are not suitable for this operation.
It should be possible to use Flowcode output commands to generate a signal to perform this function. Flowcode delay timers could be used to ensure that the 75176 remains in transmit mode for the duration of each transmission (worst case timings must be used). Control timing could be improved by using a small amount of C code to monitor the USART status flags and confirm completion of each transmission.
RS232 hardware flow control should be turned off.
Are the transmit and receive enable pins of the 75176 connected together to allow use of a single direction control signal?
It should be possible to use Flowcode output commands to generate a signal to perform this function. Flowcode delay timers could be used to ensure that the 75176 remains in transmit mode for the duration of each transmission (worst case timings must be used). Control timing could be improved by using a small amount of C code to monitor the USART status flags and confirm completion of each transmission.
RS232 hardware flow control should be turned off.
Are the transmit and receive enable pins of the 75176 connected together to allow use of a single direction control signal?
-
- Posts: 234
- Joined: Thu May 31, 2007 2:18 pm
- Has thanked: 7 times
- Been thanked: 12 times
Re: RS485 using SN75176
Thanks for the reply.
yes i need to reply to comands that are sent to a pic18F4520 so i need to control a 75176 transmite and receive.
Thanks
Wayne
yes i need to reply to comands that are sent to a pic18F4520 so i need to control a 75176 transmite and receive.
Thanks
Wayne
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: RS485 using SN75176
You can use the flowcode output command to allow any unused i/o line to be used to enable the SN75176 transmit mode. If the /RE and DE pins of the SN75176 are both connected to the selected PIC i/o pin, the output should be set high immediately prior to issuing the RS232 tramsmit command.
A single line of C code, in a Flowcode C code block, is then required to wait for completion of the transmit sequence by testing the TRMT bit of the TXSTA register (0 while transmitting, 1 when complete).
c code:
while (txsta.TRMT == 0);
After this condition has been met the direction control output can be cleared to put the 75176 in receive mode again.
A single line of C code, in a Flowcode C code block, is then required to wait for completion of the transmit sequence by testing the TRMT bit of the TXSTA register (0 while transmitting, 1 when complete).
c code:
while (txsta.TRMT == 0);
After this condition has been met the direction control output can be cleared to put the 75176 in receive mode again.
-
- Posts: 234
- Joined: Thu May 31, 2007 2:18 pm
- Has thanked: 7 times
- Been thanked: 12 times
Re: RS485 using SN75176
Hi sean,
How do i read the statas of txsta.TRMT == 0 to set port pin to 0v to get ready for receive data.
Thanks,
wayne
How do i read the statas of txsta.TRMT == 0 to set port pin to 0v to get ready for receive data.
Thanks,
wayne
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: RS485 using SN75176
I have attached a small code segment that illustrates the 75176 direction control. It assumes that RC5 is being used as the direction control pin, and that a single character 'X' is being sent.
-
- Posts: 234
- Joined: Thu May 31, 2007 2:18 pm
- Has thanked: 7 times
- Been thanked: 12 times
Re: RS485 using SN75176
[/img]
Dear
I'm trying to run the suggestion of Sean, 485tx1 in my version 6.1.3.2, and I'm not getting, someone help me? File and the error codes are in the Annex.
Sean wrote:I have attached a small code segment that illustrates the 75176 direction control. It assumes that RC5 is being used as the direction control pin, and that a single character 'X' is being sent.
Dear
I'm trying to run the suggestion of Sean, 485tx1 in my version 6.1.3.2, and I'm not getting, someone help me? File and the error codes are in the Annex.
- Attachments
-
- compiler_error.JPG (52.5 KiB) Viewed 17048 times
-
- TX1.fcfx
- target now locked AVR, ATmega328P
- (5.56 KiB) Downloaded 593 times