Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do request/response from the serial port communication

I have connected my laptop to the HW which is communicating through RS232 and i want to extract possible request/response from the port. For example:

 

If i send

Request: 3B 16 07 xx xx xx

 

i would expect the response which will read approx 50bytes of data in format

Response: 3B 16 01 02 03 04 05 .................................................... till 50 bytes

 

Any information on how to do this would de really helpful.

 

Thanks

0 Kudos
Message 1 of 10
(6,597 Views)

What language are you using?  LabVIEW?  C++?  Ruby?  Java? etc.

 

Assuming you are using LabVIEW, look at the examples (Help->Find Examples).  There is a Simple Serial Write & Read that you should look at.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(6,593 Views)

I am using Labview 2011. Ok Thanks, i will look into this.

 

I also needs to parse the response bytes, can you provide me any sample vi which does this so that i can get some info on how to do that?

 

Thanks

Aniket 

0 Kudos
Message 3 of 10
(6,567 Views)
You can use the String to Byte Array function. Then it's simply a matter of using the Index Array to get the bytes you want.

Can you provide the make and model of the instrument? Did you search for dBm existing driver?
0 Kudos
Message 4 of 10
(6,565 Views)

Hi Dennis,

 

Currently i don't have any model vi , but looking for 1 sample vi so that it's easy for me to proceed.

Can you explain me in a brief how to do this with some model vi.

 

And what do you mean by dbm existing driver?can you also share some info on this.

 

Thanks

Aniket

0 Kudos
Message 5 of 10
(6,558 Views)
Surely you know who makes the instrument and it's model number. You've already been given an example for generic serial communication.

Sorry, the dBm was an auto type correction mistake. You should use Help> Find Instrument Drivers to see if there is existing code for your specific instrument.
0 Kudos
Message 6 of 10
(6,555 Views)

Actually the HW it's internal to the company which is manufactured and  used by them only, so it's not the generic one which you are looking for.

the HW and my tool will communicate through RS232 only which is serial comm.

 

Do you have any sample vi which parse the data for the following bytes.

 

Thanks 

Aniket

 

 

 

0 Kudos
Message 7 of 10
(6,539 Views)

Please try the functions I mentioned

0 Kudos
Message 8 of 10
(6,529 Views)

Hi Dennis,

 

I checked with those functions but not helpful as couldn't able to get the required instrument driver.

 

I able to find out how to send request and response but stuck with the parsing one, can you help me with that as i have to parse 55 bytes of data one by one.

 

 

 

0 Kudos
Message 9 of 10
(6,514 Views)
You would have to create your own instrument driver.

Are you using the example mentioned to send data? Did you change the string control to hex display? Do you get anything with a read? If so, you need to show what you receive. If you in fact get hex data back, then the String to Byte Array will work.
0 Kudos
Message 10 of 10
(6,510 Views)