RS-232 Communcation

Hello,

I’m trying to communicate to an MKS Pressure Controller via the EPIC GRV-CSERI-4. I believe I have my communication handle setup correctly with my initial value of @MKS_946, baud=9600,parity=n,data=8,stop=1.

I’m trying to get back a pressure reading from the MKS Controller using their PN2 command but cannot figure out how to send that comment and receive back the pressure reading.

I’m trying to use a optiscript block with TransmitReceiveString(XMIT_MSG,PAC_5,RECV_MSG); as I found in the manual but I’m not sure if this is correct and if it is how do I send the PN2 command to the controller? Would I put the PN2 command after the above script? I think I’d have to change the Pac_5 to MKS correct?

Thanks
Shawn

Welcome to the forums Shawn.

Yes, you will need to swap out the example ‘PAC_5’ for your MKS comm handle.
Also you will need to put the PN2 command in the ‘XMIT_MSG’ string.

That should get you going.
If not, perhaps include a few screen shots and any errors you get to help us help you.

Sneaky edit… You will also need to check what the end of message delimiter is from the MKS pressure controller, its probably a line feed and or a carriage return, but check and set your end of message delimiter once you open your comm handle.

I tried to compile it and I get this error.

My optioscript is:
TransmitReceiveString(PN4,MKS). It doesn’t like the PN4 command. Am I doing something wrong?

PN4 needs to be a string, it is either missing or is not a string.

Also, that command needs three parameters, you only have two.

image

Anything you use in any OptoScript block needs to be in the strategy tree on the left.

So am I going down the right path? I’m just trying to send the command PN2 to the MKS Controller. I’ve never done RS232 before so this is all new to me. I’m not sure what you mean by PN4 needs to be a string. :frowning:

Yes, you are on the right path, you just need to get your 4 parameters correct and it will probably start working.

Your OptoScript command needs to look like this;
TR_Status = TransmitReceiveString(XMIT_MSG, MKS, RECV_MSG)

In your strategy tree on the left, make two strings, one XMIT_MSG and make its default value PN2.
Make another string RECV_MSG and leave its value blank.
Make an Int32 variable called TR_Status.

Now you should be able to download.

Once you get that working, lets know and we can help you with the end of message delimiter.

Cool, thanks! I’ll work on that first thing in the morning. Right now…its five o-clock somewhere! :slight_smile:

OK, we’ve created what you asked but we don’t seem to be communicating:

If I run this in the debug screen on TR_Status I get -52. More pics to follow.

I’m not sure if we created the “strings” correct as we created them in the string variable. Is that the correct place for the XMIT_MSG and RECV_MSG? We put our PN2 (or other commands) in the initial valve line as we don’t see the “default Value” that you mentioned.

Any help?

Error -52 is comm handle not open.
So you need to open communication before issuing the command.
Whats the status from the open command?

Ch_Status is 0 on our Ch_Status Variable

Actually, I had my optoscript block in front of my XMIT/RECV Block. Now my TR_Status is 0

Great, zero is good. So the comm handle is opening and we are sending/receiving data without error.
Is there anything in the RECV_MSG string?

Meaning I had my XMIT Optoscript Block in fromt of my open coms Block. Now that I have it correct I’m getting 0’s but I still do not see data.

No, nothing in the RECV_MSG Screen. Kist a dial showing its working.

sorry, Just a dial indicating it’s scanning.

So I think now whats happening is that the receive is waiting for the end of message delimiter.
We have not set that yet, so I think its still waiting.
I tried to Google ‘MKS Pressure Controller’ and did not get any solid hits.
Do you have a manual for it?
If so, look what the end of message delimiter for the communications is.

I do have the manual. Let me look at it and find that. Also, now in my XMIT screen I’m getting the Rn1 command in my value block when running the strategy.