An RS-485 NetworkAfter the prepare_to_respond routine executes and any required delay elapses,
the network is in the “t” state. The task loop calls the transmit_serial_data rou-
tine to send the characters in the command_response array to the primary
node.transmit_serial_data:
' If a byte is waiting to transmit, send it.if firmware_driver_enable then
driver_enable = 1
endif' Wait for the transmit shift register to empty.while (TXSTA.1 = 0)
wendhserout[command_response[response_index]]if (command_response[response_index] = $0a) then' The entire response has been sent.if firmware_driver_enable then
while (TXSTA.1 = 0)
wend
driver_enable = 0
endif' Prepare to receive another command.gosub initialize_serial_buffers
network_state + "r"else
' Prepare to send the next byte.response_index = response_index + 1
endif
return