Can I use a modem to send data?
<Mark Boettcher markbATminimitter.com, Dan White dwhite.cybermetrixATflexcell.com, Alex Le Dain alexATicon-tech.com.au>
(Timeless)
A modem can easily be accessed from LabVIEW using the standard serial port VI's. This is a fairly simple task using the Serial Driver Init VI directed to the port the modem's hooked to and send out the modem command strings like:
"ATZ" - reset the modem
"ATFOO" where FOO is whatever special modem commands you want to send
"ATDT19005551111" to dial 1-900-555-1111
After this just clear a string and sit in a loop building a string with whatever comes in the serial port until you get a CR character. Then search the string for the substring, "CONNECT" (if attempting to access another modem). If that's not in there, then repeat the process until either that happens or you get a timeout.
Once the modems are synced, the data can be sent after flattening it to string type. Make sure that packets of data are sent and if there are integrity issues then perhaps a CRC checksum should be included in each packet. If you want to disconnect then send out an "ATH1" to command to hang the modem up and finally close the serial port.
One fequently asked question is whether a WAV file can be played after initiating a dial out with a modem. No definitive answer has been posted, but it appears you would dial out as above. Instead of a CONNECT string response from the other modem, you could look at the return string which should contain the "RING" string when the modem is in verbose mode and dialing out. Once the RING string is not detected (or there are no other error messages) then it may be reasonable to suggest that someone/something has answered. How to play the WAV file is still an unanswered question apart from the inelegant method of then initiating playing the file out the soundcard lineout into the MIC of the modem.
Don't forget to send out a CRLF combination after every string you send out. In other words strings would look something like: ATZ/r/n. Furthermore, there needs to be a wait of at least 400mS for the "OK" return string after initializing the modem with "ATZ" before attempting to dial with the "ATDT" string.
There are also commercial toolkits available from Microsys Technologies (see Other Links and Resources) and there is an article in the LabVIEW Technical Resource (LTR, Vol 5(1)) that deals with sending messages to a pager, but involves modem initialization and control aspects that would be useful in setting up modem communications.
posted on 2005-06-24 01:32 LabVIEW开发者 阅读(395) 评论(0) 编辑 收藏 举报