LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial modem communication

Solved!
Go to solution

Jerry,

 

I'm working on the same problem too.  You think you can post your codes as v8.x instead?  We're cheapskates over here Smiley Very Happy

 

A quick tip from me, when working with these devices.  Sometimes if you are getting no signal, make sure you attach a null modem connector.

 

http://www.zytrax.com/tech/layer_1/cables/tech_rs232.htm

 

Are you using DB9 or DB25?

 

Do you know the format of data output the modem is sending?  Some modems will send a non-ASCII byte (mono or bi-sync) for synchronization + normal data bytes stream + some trailing bytes.  The trailing bytes can be a simple set of all high, i.e. 0xFFFFFFFFFFFFFFFFF.  Knowing these will help you synch up.

Message Edited by lavalava on 09-10-2009 12:19 PM
0 Kudos
Message 11 of 29
(1,629 Views)

Is ver 9 code not compatible with previous versions? I got this late copy ONLY because it was bought as part of a "green" Government project. I'm active duty Coast Guard and the local Command wants his military housing units to consume at least some solar and wind energy. I got "elected" to do come up with a monitoring program because I made the mistake of admitting that I had some prior experience with programming.

 

 

At the moment I've just trying to get the verbose responses to the basic AT modem commands.  As mentioned I can take the modem on/off hook, dial, reset, etc so I figure my cabling is OK - and it all works fine when communicating with M/S Hyperterminal.

 

Sending for example a ath1\r\n will take the modem off hook and return just "ATH1". I get no response to commands that return text - like AT&VI. Sometimes I do get framing errors though - so at least that's something 🙂

(Soon to retire) US Coast Guard CPO
0 Kudos
Message 12 of 29
(1,615 Views)
Solution
Accepted by topic author Jerry In Maine

I think I know what is wrong and why you are not seeing the 'OK'. The response from the modem is multiple lines. You have wired a true to the Enable Termination Character input of the VISA Configure Serial Port. By doing this, you are telling VISA to terminate a read as soon as the termination character is detected. The default termination character is a LF. When the modem sends out the response, I believe there is a blank line before the OK. Assuming that this is correct, your read stops before you see the OK.

 

It's been so long since I've connected to a modem that I don't remember if there is another termination character that you can use (i.e. '>') but since you won't be using a modem in your actual application, you might not want to worry about that. Most instruments will not respond like a modem. In the meantime, disable ther termination character and do a VISA Bytes at Serial Port and keep reading until the available bytes are 0.

Message 13 of 29
(1,611 Views)

I agree with Dennis.  You proved you can read to and write from a serial port using LabVIEW with VISA reads and writes.  This will be the basis of everything you will do with your application.  Of course the serial commands won't be the same - you'll have to consult the equipment manuals - but the way you read and write them will be.  Good luck!  If you have any questions, ask away.  If you don't, it would be cool if you could update us on your progress!  🙂

 

Bill

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 14 of 29
(1,603 Views)
Thanks - I'll give that a shot and let you know. I did check the "Bytes  At Port" property earlier and saw something like 864 coming back from a AT&VI inquiry. That sounds about right since it's a dump of the modems register contents -  so it appears that the data is indeed there.
(Soon to retire) US Coast Guard CPO
0 Kudos
Message 15 of 29
(1,597 Views)

Multiple lines was the trouble. Data was there all along...see the pic.

 

(Soon to retire) US Coast Guard CPO
Message 16 of 29
(1,593 Views)

Ya-hooey!  🙂

 

YOU deserve kudos for your persistence.

 

Bill

Message Edited by billko on 09-10-2009 04:14 PM
Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 17 of 29
(1,587 Views)

I'd like to follow up with this a bit if I could....

 

I'm trying to mod what I have so that an as .exe it'll configure the port on startup - then continuously watch for data that might be available. If I want to input something as a command or query I'd like it to stop - handle that - then once it gets it's response continue   watching the port for data.

 

Curious if someone had time to take a look at the attached .vi. It's admittedly rough at this point - but maybe I can stop and correct my path before I wade too deep in the stupid pool.

 

As I see it the loop not do a VISA read unless the switch is on. When it's off it'll just do VISA reads. 

 

I'm used to a more event driven enviroment and I think that gets in my way of understanding LV program flow - sometimes.

 

Thanks -

 

Jerry

 

(in Miane where soon it'll be too chilly in the AM to ride the Harley to work)

 

(Soon to retire) US Coast Guard CPO
0 Kudos
Message 18 of 29
(1,538 Views)

Jerry,

 

If by "As I see it the loop not do a VISA read unless the switch is on. When it's off it'll just do VISA reads." you meant:

"As I see it the loop will not do a VISA write unless the switch is on. Whatever its state it will do VISA reads." the yes.

 

You can always try using an event structure if you are more comfortable with event based type programming, although this may just make things more complicated for you.

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 19 of 29
(1,508 Views)

Yep - I screwed up the phrasing.

 

Note to self: Take meds BEFORE posting from now on.

What I'm trying to do is to only write then the user enters a command and hits Return.  The reads will then stop, the write will be performed and after a delay to allow time to respond a read will take place. Once this is done the app will then do constant reads in case the device has something to say that needs to be caught.

 

I'll get it - just a matter of time. Good thing about staying at it is I pick up a little more LabVIEW familiarization each attempt.

 

Thanks -

(Soon to retire) US Coast Guard CPO
0 Kudos
Message 20 of 29
(1,491 Views)