Serial communication in VB 2005
Posted on 2006-06-03
Ok I'm stumped. I'm trying to communicate with a digital multimeter that has software originally designed to work in windows 3.1. The software works but its old and crappy and I want to make something a little more up to date and flashy but I cant get the communication to work. All I have to go off of is an the old manual that came with the meter. I've tried several different things but none of them work, obviously I'm missing something. This is what the manual says:
3.1 Communicate with the Multimeter
To request data from the multimeter, send a character to the DMM/Data Logger through the PC's RS-232 port. Any character can be sent except the reserved characters (9,4,2,1,EEE,G,N,R,W,U,S,T,X,EEE). It is recommended that user send a SPACE character to the multimeter (The ASCII code of SPACE key is 20 in hex). As having received a character (except the reserved characters) from PC, the meter will sent out 5 bytes to PC.
Also, later in the manual it says:
It is strongly recommended that when the user opens the COM port, it is opened by the following command:
OPEN "COM1;9600,N,8,1,CS,DS,CD,RS" AS #1
So what I need is some code that sends that magic byte to the meter and then recieves the magical 5 bytes back. If I can get that much I can handle the rest, I already have a decoder for the bytes written, (if I could only get the damned thing to send me the bytes now...) This has to be for VB 2005, VB6 code wont work for me. I'm looking to use the SerialPort class that is buitl into VB2005.
Thanks in advance,