Saving the ACK/completion from COMport (serial port)...

Moderator: Moderator Group

Saving the ACK/completion from COMport (serial port)...

Postby dr@pms-rental.de » Fri Oct 23, 2015 5:40 pm

Hey Guys,
I have been looking for a solution the whole day, couldn't find a way to work it out.

Well, I just describe my problem from the beginning. I am controlling a Sony BRC-Z330 via RS232. The commands (i.e. COMSendHex,1,81 01 06 01 18 12 02 03 FF) work perfectly. And in a regular terminal-application like hterm I see all the answers the machine is giving (i.e. 90 41 FF). Well, in this case it's not really important to see the answer, but still sometimes nice.

In case of sending inquiries it's absolutely necessary to see the answer, because getting an answer is the only reason for sending an inquiry (i.e. 81 09 06 12 FF) and the answer should be the exact position of the camera (i.e. 90 50 0F 0F 0E 01 07 00 00 09 06 FF). And my problem is, that I really don't know how to get this answer visible in Widget Designer. I know that there's a node called COMinput and this should get the answer (from the chosen COMport ID) I guess, but is there a way to display what the node is receiving?
In the output field on the bottom of the node properties is a '0' displayed which is flickering like it receives something and updates often. Maybe the problem is, that the camera is only giving back a packet once and maybe I can't see it in the output, because it's updating to fast!?

Anyway, the position should be written into an xls table and be available for the Widget Designer at any time with an easy way for backup the xls.

I hope someone can help me. Greets David.
dr@pms-rental.de
 
Posts: 2
Joined: Wed Mar 19, 2014 9:24 am
Location: Gießen, Germany

Re: Saving the ACK/completion from COMport (serial port)...

Postby Benni_M » Sat Oct 24, 2015 4:10 pm

Hi,

maybe a IF node.
If the input = 0 nothing happens. If not write the input into a variable.

Cheers,
Benni
Benni_M
 
Posts: 148
Joined: Thu Apr 12, 2012 3:45 pm

Re: Saving the ACK/completion from COMport (serial port)...

Postby florian » Sat Oct 24, 2015 5:42 pm

(i.e. 90 50 0F 0F 0E 01 07 00 00 09 06 FF)


are these 3 4-byte integers? ie: Pan/Tilt/Zoom ?

if so, my weapon of choice for solving this would be the UDP data parser node. It has the ability to start reading integers at a given location in the datagram. Unfortunately, there doesn't appear to be one that works the same way with COM ports.

COM Input, could technically read your data in bytes for you, but you'd need the camera to generate the necessary header for your data (ie: [randomheader] [4byte count, probably 00 00 00 03] [1byte type, probably 01 for Int] [data] [data] [data])
-flo

"Wise men learn more from fools than fools from the wise."

Cato the Elder, Plutarch's Life of Cato
User avatar
florian
 
Posts: 162
Joined: Fri Jul 25, 2008 3:49 pm
Location: Los Angeles, CA

Re: Saving the ACK/completion from COMport (serial port)...

Postby dr@pms-rental.de » Mon Oct 26, 2015 12:41 pm

Hey flo and benni,

first, thank you benni for you suggestion, but I think the issue is something else...

flo, the structure of the answer is the following

X0 4Y FF for ACK
X0 5Y FF for completion of commands
X0 5Y ... FF for completion of inquiries

with
X = camera address+8 (ie cam-address=1 ... 1+8 = 9) (in bin it's easier to understand... the header is 1 byte 1sss0rrr - s for sender - r for receiver. (cameras can have the address 1 to 7 and the controller is 0, the commands header is 10010000 in bin, 81 in hex (for camera 1) and the answers header is 10000001 in hex, 90 in bin (for camera 1))
Y = socket number (socket can be 0, 1 or 2... the camera has a buffer for 2 commands, and the socket number tells you which command buffer was used)

Well and the answer for the cam-position tells you only pan (pqrst) and tilt (uvwx) position, the zoom and focus positions are two other inquiries.
X0 5Y 0p 0q 0r 0s 0t 0u 0v 0w 0x FF (1 byte header, 1 byte socket number, 9 byte position and 1 byte terminator)

Maybe I'm making something wrong with the setup of the node? I'll just comment every option and you tell me if I'm wrong.

COM Connection ID = 1 (well, that's right...^^)
Output Channels = 1 (do I need more then 1 to get the command correctly?)
Bytes (I guess that's right, cause I'm getting bytes in return? or am I thinking wrong?)
Multi-Packets (what's that, does it matter for me?)
Byte Header (I don't know what to write there? "90 in hex" or "10010000 in bin" is the header... but typing it in, doesn't change anything.

If I set it to byte I get "0" as output and nothing else, but if I set it to ASCII I get " P " or " ÿ ". Well P is 50 in hex and ÿ is FF in hex... that's part of the answer that I would expect, but why don't get the whole message and not always the same part? And why don't I get anything when I set it to bytes?

Maybe the issue is about having different types of numbers like hex and bin?

okay and one last thing that I tried: of course I get all answers of the camera written in to the variable. Now I set the COM input node to ASCII and get the following results.
For simple commands like "turn left" I normally should get the ACK (90 40 FF) and the completion (90 50 FF). Sometimes the variable is "AÿQÿ" (41 FF 51 FF in hex) and sometimes only "ÿ" (FF in hex) or "Qÿ" (51 FF in hex). It seems to filter out the header and still not giving me the same answer every time, sometimes only the last byte...

I really hope that some understands what I wanna describe^^ if you have some questions to my explanations, just ask ;) greet David.
dr@pms-rental.de
 
Posts: 2
Joined: Wed Mar 19, 2014 9:24 am
Location: Gießen, Germany

Re: Saving the ACK/completion from COMport (serial port)...

Postby Martina Protze » Fri Nov 27, 2015 11:57 am

Hi David,
to start with the fundamental questions:
1) in the Connection Manager, when right-clicking on your COM connection, do you see there the answer from your camera? does it look like what you expect?
2) in the COM node, are you entering the header in the format [h90] as described in the quick help that appears when hovering with the mouse on the field? or here
http://www.coolux.de/root/downloads/support/Documentation/Helpfile/index.html#syntax_tcp-__udp-__serial_messages.htm
It's been a long time that I played with ASCII and byte, but I remember that it helps to read the quick help that appears when hovering with the mouse on the "Bytes" radio button. Have you done this?

Regarding your questions, "channels" refers to using ASCII and entering a Split (=separator that separates the "channels" from each other)

another idea, what happens when entering
X0 4Y FF for ACK
X0 5Y FF for completion of commands
as an ASCII Start and Stop? This tells WD when "connected information" starts and stops

Best regards
Martina Protze
Technical Support, Pandoras Box and Widget Designer
Martina Protze
 
Posts: 199
Joined: Tue Feb 23, 2010 2:47 pm


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 25 guests

cron