Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

RS232 Control VB Script?

Status
Not open for further replies.

RTN

Civil/Environmental
Joined
Dec 3, 2002
Messages
1
Location
HK
Dear Experts:

I'm tring to control a Sound Level Meter (B&K 2238) by sending command signals from a PC (MSWindows98/2000) to the meter through a RS232 port using a 9-pin cable.

Would any of you please offer me some sample Visual Basic scripts for sending control signals to device connecting to RS232 port.

Thanks a lot!
 
The best way to do it is to use the MSComm control that comes with Visual Basic. If you want to see how this works, load and single step through the VBTerm sample that comes with it (should be in the \samples subdirectory; if not, I think you can download it from Microsoft's Visual Basic site).

One important note, though, is that you must know the syntax of the commands to your meter (or other device), as sent via RS-232. Once you know those you can simply modify the VBTerm code to suit your own purposes. It's complex at first, but stick with it!

[pc3]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top