RS485 using SN75176

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

Moderators: Benj, Mods

wayne millard
Posts: 204
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 6 times
Been thanked: 10 times
Contact:

RS485 using SN75176

Postby wayne millard » Fri Aug 29, 2008 11:28 pm

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
Has thanked: 6 times
Been thanked: 43 times
Contact:

Re: RS485 using SN75176

Postby Sean » Sat Aug 30, 2008 1:36 am

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: 204
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 6 times
Been thanked: 10 times
Contact:

Re: RS485 using SN75176

Postby wayne millard » Sat Aug 30, 2008 1:02 pm

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
Has thanked: 6 times
Been thanked: 43 times
Contact:

Re: RS485 using SN75176

Postby Sean » Mon Sep 01, 2008 10:44 am

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: 204
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 6 times
Been thanked: 10 times
Contact:

Re: RS485 using SN75176

Postby wayne millard » Mon Sep 01, 2008 5:06 pm

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
Has thanked: 6 times
Been thanked: 43 times
Contact:

Re: RS485 using SN75176

Postby Sean » Mon Sep 01, 2008 5:22 pm

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 703 times
These users thanked the author Sean for the post:
joe nova (Sun Oct 16, 2016 3:00 pm)
Rating: 5.88%
 

wayne millard
Posts: 204
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 6 times
Been thanked: 10 times
Contact:

Re: RS485 using SN75176

Postby wayne millard » Mon Sep 01, 2008 10:18 pm

Hi sean,

Thanks for all your help.

wayne

joe nova
Posts: 9
Joined: Sun Mar 01, 2015 10:55 pm
Has thanked: 14 times
Contact:

Re: RS485 using SN75176

Postby joe nova » Mon Oct 17, 2016 2:46 pm

[/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 4542 times
TX1.fcfx
target now locked AVR, ATmega328P
(5.56 KiB) Downloaded 210 times