Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Pelco-D or P commands via RS232 to RS485 converter

Solved!
Go to solution

Hi, 

 I am trying to send series of commands in decimal format using a RS232 to RS485 converter to a camera that has a zoom control. I have a program that will let me test the commands to the camera to make sure everythings is working proper.  I also try sending the comands using the program realterm in decimal format and it also works. But when I try to send the data using Labview I get no results. Here is the code to make the camera zoom in. 
255,001,000,032,000,000,033 ( to Zoom in)

255,001,000,000,000,000,001 ( to Stop zoom)

 The commands has to be sent in decimal format to the camera. And the photo don't show it but there is a 500ms delay between the Zoom in and stop commands I also try a longer delay.

I attached a photo on how I am sending the comands to the camera.  Can anybody tell me what I am missing?

 Thanks

JJM

 

0 Kudos
Message 1 of 9
(8,450 Views)

Hi

I don't know exactly whta you are missing but anyway some LabVIEW experience in communicating with instruments.

The first thing I would like to see is the string you are writing to the machine and a part of the machines command language.

I expect that between two commands the machine expects a newline (chr(10)) or carriage return (chr(13))

But i'm a bit uncertain about the exact layout.

Can you show a log of what you was sending in realterm?

 

greetings from the Netherlands
Message 2 of 9
(8,441 Views)

Thanks for your response

I did a screen capture on the setup I use to send the commands to the camera using Realterm. The top command tells it to zoom in and the second line tells the camera to stop. You have to use commas inbetween the data you send. When I send the commands I have to click on the button that says Sends Numbers.

0 Kudos
Message 3 of 9
(8,434 Views)

Thanks 

One possibility is, LabVIEW (or better VISA) is too fast.

I would replace the write VISA with a for loop that writes each character of your string.

Also add your vi instead of a jpg, then I can check better what is going on.

Now I only see part of the code.

Anyway, my first guess is probably false. ( I read what happens in reqalterm)

 

greetings from the Netherlands
Message 4 of 9
(8,426 Views)

Thanks again for your reply

I write a test VI before I add it into my main program. So this Vi is not fancy it's plan and simple. I try the while loop and it still did not worked then I added a delay which still did not work. The Version of Labview I am using is 8.6.1 full development system. My company won't upgrade 😞 . If you look at stack 1 I try the while loop for the zoom in. I put a delay inbetween the Zoom in and stop command. At stack 3 this is the orginal way I had the zoom in  stack. 

0 Kudos
Message 5 of 9
(8,410 Views)

 Thanks for your help. I figured the problem out it was sample was I realize what the problem was. I had to remove commas. Once I did this I had the control. I include a snap shot of what I did.

 Thanks again

JJM

0 Kudos
Message 6 of 9
(8,395 Views)

Hi

Thanks for the vi.

I have a question, how did you construct the array of bytes that you send?

I took the strings from your first post and they show something else.

Attached 2 vi's one that could work even with 0 ms wait and maybe even without for loop.

the other vi shows the differenc in numbers from translating by LabVIEW and by hand.

greetings from the Netherlands
Download All
Message 7 of 9
(8,393 Views)

good that you found it.

AHA just the numbers translated from ascii into a byte.
look at my previous implementation, a bit more readable, and I have added a snippet that is all standard LabVIEW to translate the realterm string in a usable array.
greetings from the Netherlands
Message 8 of 9
(8,386 Views)
Solution
Accepted by JJM57

What had me confused was that the protocol for the PELCO-D recommends using commas after each unsigned decimal number.  Apparently REALTERM removed them when you hit the send number button.

0 Kudos
Message 9 of 9
(8,376 Views)