I am using a Mod5234 , Uart 1 and using it for a Modbus RS485 ( Half Duplex ) communications.
The Uart_RX , Uart_Tx and Uart_RTS are controlling a SN65HVD1780 chip. I can see the data is been TX but the RX data is low. This is because the RTS Line just remains high.
How do I control the RTS line. The command SerialEnableHwTxFlow(MB_MASTER_PORT,1); just seem to disable the coms
I am using interrupt based comms ...
ComsStatus = WAITING; // Clear the coms state
MessageCounter = 0 ; // Initialize the message counter
pReceiveTimer = &pCounters->MB_ReceiveTimer; // Get the reference to the receive timer
pMBService= new Modbus(); // Create the Modbus Service class
pRxBuffer = (BYTE *) malloc(MB_BUF_SIZE); // Allocate the RX buffer
pTxBuffer = (BYTE *) malloc(MB_BUF_SIZE); // Allocate the TX buffer
// Open the port
SerialClose(MB_MASTER_PORT);
SerialEnableHwTxFlow(MB_MASTER_PORT,1);
OpenSerial(MB_MASTER_PORT, MB_BAUD,1,8,eParityNone);
UartData[MB_MASTER_PORT].m_pPutCharFunc = MasterReceiveCallback; // Set the receiver callback
UartData[MB_MASTER_PORT].m_pGetCharFunc = MasterTransmitCallback; // Set the transmiter callback
iBytesReceived = 0 ;
RS485 Half Duplex
Re: RS485 Half Duplex
For 485 you want the function:
void Serial485HalfDupMode( int port, int enab );
If your using SN65HVD1780
The Driver input is active high the RTS line on the 5234 is active low.
You need an inverter...
Also
Why are you using your own buffers rather than the standard serial interface?
void Serial485HalfDupMode( int port, int enab );
If your using SN65HVD1780
The Driver input is active high the RTS line on the 5234 is active low.
You need an inverter...
Also
Why are you using your own buffers rather than the standard serial interface?