Industrial Modem


Recommended Posts

This modem uses the Hayes AT command set. So, you can just use the Write and Read functions on the serial port to dial. You'd could probably get away with just creating a single serial device with the Modbus protocol selected. Lets say you called it "remote", it'd go something like this:

private string response
// dial:
device.remote.write("ATDT 555-1212")
// wait for connect:
response = device.remove.read(8)
if (response == "CONNECT")
   device.remote.write("ATO0") // go into data mode
   private datain
   // read single modbus value and stick it into a channel
   datain = device.remote.readholdingU16(1,0,1) 
   mychannel.addvalue(datain)
   device.remote.write("+++") // go to command mode
   delay(1) // required delay after +++
   device.remote.write("ATH") // hangup
endif

That's the general jist of it. You'll want some error handling. If the modem can't connect the read(8) will throw an error. You'll also need to increase your timeout so that it has time to connect, or repeat that read(8) a number of times. There are probably some other details that you'll have to figure out, mostly dealing with delays, and what the modem responds with. Although pretty much every modem I know of uses the Hayes AT command set, they all have slightly different personalities and getting the best response from them requires a little playing. Check out the examples at the end of the manual you sent on other commands you may want to send to setup the modem.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.