RS485 using SN75176

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
wayne millard
Posts: 230
Joined: Thu May 31, 2007 2:18 pm
Contact:

RS485 using SN75176

Post by wayne millard »

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

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Contact:

Re: RS485 using SN75176

Post by Sean »

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?

wayne millard
Posts: 230
Joined: Thu May 31, 2007 2:18 pm
Contact:

Re: RS485 using SN75176

Post by wayne millard »

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

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Contact:

Re: RS485 using SN75176

Post by Sean »

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.

wayne millard
Posts: 230
Joined: Thu May 31, 2007 2:18 pm
Contact:

Re: RS485 using SN75176

Post by wayne millard »

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

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Contact:

Re: RS485 using SN75176

Post by Sean »

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.
485tx1.fcf
(3.5 KiB) Downloaded 780 times

wayne millard
Posts: 230
Joined: Thu May 31, 2007 2:18 pm
Contact:

Re: RS485 using SN75176

Post by wayne millard »

Hi sean,

Thanks for all your help.

wayne

joe nova
Posts: 9
Joined: Sun Mar 01, 2015 10:55 pm
Contact:

Re: RS485 using SN75176

Post by joe nova »

[/img]
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.
The attachment 485tx1.fcf is no longer available


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
compiler_error.JPG (52.5 KiB) Viewed 7178 times
TX1.fcfx
target now locked AVR, ATmega328P
(5.56 KiB) Downloaded 266 times

Post Reply