01-13-2016 12:25 AM - edited 01-13-2016 12:26 AM
Hello GerdW
I checked my string constants, but still it fails..
01-13-2016 01:37 AM
According to the manual you should include in the frame also the ckecksum. Are you including it? What is the command in the example you has shown?
Thanks,
Arev
CTO | RAFA Solutions
01-13-2016 02:19 AM
Hello,
If you see in the manual under 5.1, you have the command: 'd' 0x9C
I include the checksum which is 0X9C, so my command is 649C 0D, where 0D is \r. I managed to get out data now by disabling -> enabling the COM20 port.
My result string is: 64FF FFFF FFFF FFFF FFFF 4800 5D. The format looks correct compared to example in 5.1, but values are strange. Why FF FFFF FFFF FFFF FFFF? The device is connected and ON.
br,
paalbrok
01-13-2016 02:21 AM
Hello,
If you see in the manual under 5.1, you have the command: 'd' 0x9C
I include the checksum which is 0X9C, so my command is 649C 0D, where 0D is \r. I managed to get out data now by disabling -> enabling the COM20 port.
My result string is: 64FF FFFF FFFF FFFF FFFF 4800 5D. The format looks correct compared to example in 5.1, but values are strange. Why FF FFFF FFFF FFFF FFFF? The device is connected and ON.
br,
paalbrok
01-13-2016 02:28 AM
01-13-2016 02:47 AM
Hello GerdW,
I've got another problem. I actually read out the HEX string only when I run the code using highlight execution. If I run the code at full speed, it doesn't read out anything. I've tried to put code inside a loop and slow it down, but it doesn't work.
Do you have any ideas?
br,
paalbrok
01-13-2016 03:01 AM
Hi paalbrok,
when you run the code shown above (without any loop) it's no wonder it will not work.
You call BytesAtPort immediatly after writing the command to the serial write buffer. At this very moment your device didn't receive any command yet - and there surely is no answer in the serial receive buffer!
General answer: Using BytesAtPort most often is the wrong way to have a serial communication. You either use the TermChar or you read a certain number of bytes.
In your case you know from the manual how many bytes you expect as answer of the "d" command. Just read that number!
01-13-2016 03:19 AM
Hi GerdW,
Thank you for your answer.
Of course... Need to delay down before bytes at port to get response back to program. I use a while loop, but your tips seems to be a better way to do it. Do you have the possibility to modify my code and return it to me?
br,
paalbrok
01-13-2016 03:47 AM - edited 01-13-2016 04:02 AM
@paalbrok wrote:
Hi GerdW,
Thank you for your answer.
Of course... Need to delay down before bytes at port to get response back to program. I use a while loop, but your tips seems to be a better way to do it. Do you have the possibility to modify my code and return it to me?
No!!! Get rid of Bytes at Serial Port and read the right amount of characters! If you start to add delays in device communication software to make it work you can be almost 100% sure that you are doing something wrong! Your device protocol is a binary fixed size protocol. Every message has a specific size that is determined by the message type. For a simple driver you can simply read the number of bytes that a response has, since you know what command you send and what answer you expect.
For a more robust driver you would most likely read the first byte and from that determine the message type that is to follow and then read as many characters as that message type is supposed to contain. VISA Read has a timeout and will only return when:
- an error occures in an underlaying driver
- the timeout occures
- the number of requested bytes has been read
- the termination character is received (if enabled, which you don't need here since there is no specific termination character in the messages)
01-13-2016 04:19 AM
Hi,
I'm a newbie in labview
I want to import to labview 4 signals from equipment that have the following outputs:
- 4-20mA Pressure signal;
- 4-20mA Flowrate signal;
- 4-20mA rotation speed signal;
- 4-20mA Torque signal;
I have this 4 signals in RS232.
What's the better way to import this data to labview?
Thanks advance