Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

RS-232-C port using with Visual Basic

Status
Not open for further replies.

Draekdude

Chemical
Mar 3, 2005
4
0
0
US
Hi,
I'm new to creating programs that capture data. I'm used to creating programs that will analyze and manipulate it instead. Anywho, my problem is trying to hook up two 3395 HP integrators to a PC. I have a cable that plugs into the RS-232-C port on the back of the integrator and then outputs to the parallel port. Then I plug an adapter that converts the parallel to a serial, but I'm not sure if that will work.
Right now I'm trying to use the MSCOMM object in VB without any luck. The integrator transmits in ASCII, but I don't know if the connection will work, let alone the code. Has anyone done anything like this? Any help would be much appreciative! Thanks much!

Julian Boardman
 
Replies continue below

Recommended for you

It would probably be best to verify communications with the hardware in Hyterterminal prior to coding.

But if the integrator has a serial port (RS-232), then why not plug it directly ito the PC's serial port?

Wheels within wheels / In a spiral array
A pattern so grand / And complex
Time after time / We lose sight of the way
Our causes can't see / Their effects.

 
Are sure that the cable connects to RS232 seral port at one end, and to parallel port at another? Could it be a modem cable with DB25 male for the modem end and DB9 female for the PC? Get a straight DB9 to DB9 cable and try with it.

Regarding software, it is very easy to write code based on MSComm control. Check the communication settings prescribed by the manufacturer. As suggested by another poster, do test the communication using hyperterminal before proceeding to code.

Good luck

Yeasir Rahul

Principal, VoltSmith Technologies
 
Check the communication protocol on HP integrator side: does it use a zero modem or some hand shaking? In that case you should correctly connect RTS,DTR,DSR and other lines even though you disable your PC for hadshaking within your code.It is maybe the HP integrator that is expecting a feedback signal from your PC and it wont send/receive data unless handshake signal.
m777182
 
Thanks for your replies. Here is some more information: The RS-232-C port on this integrator is a 15 pin port. The only cables in the HP manual for the RS-232-C port are a 15 pin to 25 pin adapter, either female or male.

Yeasir I think you're right, the 25pin cable is for a modem, I had thought it was for the parallel port. If I had a cable that went from the RS-232-C to the serial port in the PC I would use it. m777182 the integrator can use handshaking. It was not on, but I opened it up and flipped the dip switch to allow it.

Basically all I have tried it to do is extract some data from the integrator. I don't need the PC to tell the integrator to do anything, I just need the data that is printed out to be outputted to the PC as well. I've never use Hyperterminal, so I contacted the rest of our IS about it and hopefully they know something.

Thanks again for all of your help!

Julian Boardman
 
OK. I've made some progress with this. I have hooked up the integrator to the comm port of a PC as advised above. I also have used Hyperterminal and found that the connection in fact does work. I have two different problems now.
The smaller of the two problems is that I can't seem to get the PC to successfully communicate commands to the integrator. My guess is because the integrator needs to be in Remote mode for this to happen, but I can't seem to get it in that mode.
The larger problem is that I figured out how to capture the data that is being transmitted to the PC, but I can't make any sense of it. Here is a sample of some of the output from the integrator:

04AD041B046A0482048304E4047005B7041005100583057C04E304630C7D06F305F5056814C80D62
24C81ED21C0017DD25C1252A255406981C092455256720EE1A49137E1AD51B9A2002219910131817
15C10E8B065E02B824471E161C4434422F3B2D13276537F836FF35D324D52FF4351B37D930ED23B2
331E380D38F6322D2BF0305D328F183A1B2222D528DD01D9035C101F044000100051015300120438
0000141204390400040000000000FFFF00000400002F00EA00B2B2FF2020203C15FBFE2020202020
3A333520202020202032313A3233312C203139303109004A414E20202F003C15FBFE01
Q1EB9AD9.BNC


The only thing that I can understand is that the "Q1EB9AD9.BNC" is the name of the file saved on the integrator. Any ideas what any of the rest is?!?! Thanks!

Julian Boardman



 
I have consulted all five of the manuals, but they only cover setting up the integrator to run samples. There is almost no information on using the integrator in Remote mode. None of the manuals mention anything about what the integrator uploads other than it communicates in Hexidecimal-ASCII. There is also no information listed that would convert this data into something usefull.

Thanks.

Julian Boardman
 
It seems that your VB code cannot catch the code chr$(13)=Carriage return and and Chr$(10)=Line feed although it occured many times within your data stream so your transmission was defined for binary data transfer where both characters were not recognised as separators that should break the enire data stream into lines.
In your manual you should find the format of your data field that your integrator is using; presumably it consists of a few fields or blocks with text, numbers and maybe text again.The format is probably of fixed lenght.You should split the transmited record into individual parts.
The entire lenght of your data stream seems to be 470 bytes long and the additional 12 bytes were added by operating system or by your integrator at saving process and they are written in dec not in hex starting with char "Q". Try to develop a code to catch the 013 and 010 and adjust your input buffer lenght to the maximum lenght of your single data block. Try to avoid handshaking between your PC and the integrator because it makes it more difficult to communicate.
Ask again.
M777182
 
Status
Not open for further replies.
Back
Top