09-21-2009 07:30 AM
I've been working on trying to fix a little detail in a communication routine I'm writing for talking to a Hitachi L300P motor controller. My problem is that the commands are sent as blocks with a STX command to indicate the beginning, a node to indicate which of the RS485 devices is being called, the command, data, a Block Check Sum (BCC) and a carriage return. My problem is that the BCC generator that I wrote, which turned out to be very similar to this example, returns the BCC# as a single hex digit, but the instrument apparently wants the number broken down into the ASCII characters that would represent it, i.e. BCC of 05, the protocol apparently wants "30 35", ASCII "0""5".
My fatigue befuddled brain thinks that I had a simple way of doing this, but doesn't remember it (I was working on this until about 0230 this morning).
The example from the controller's manual is :
to ASCII
(STX) 01 00 1 (BCC) [CR] -------------->02 30 31 30 30 31 33 30 0D where the BCC would have returned "30" and their protocol sends 33 30, which are ASCII "3"and "0"
As always, thanks in advance
Solved! Go to Solution.
09-21-2009 07:46 AM
Something like this 🙂
09-21-2009 07:48 AM
If you go to the string palet on the functions palet you will see string/number conversions inside of there you will see hex string to number.
09-21-2009 07:54 AM
Assuming that the checksum is in an integer at some point, are you meaning format into string with a format string of %02x, or is that just toooo simple?
09-21-2009 08:04 AM
In the words of Homer (Simpson) "Doh!" Don't know what I did last night, it was a last detail that was nagging me, and I guess I kept looking at it slightly askew. The answer, easy as I knew it would be, was the formatting "%02x"
Thanks for the QUICK replies! I tell my customers that are just starting out in our community of LabVIEW wirers, to always go here when they run into a wall, that usually they will get an answer almost instantly.
09-21-2009 10:00 AM
Hi Putnam,
Be careful with that late night coding. It will affect your dreams (Have YOU ever been chased by an Add node?).
BTW: Is your name spelled correctly?
Ben
09-21-2009 10:31 AM
I don't notice my signature, rarely reading my post after I send it, which is when the signature is added. Thanks Ben for the catch! I haven't been chased by any LabVIEW functions, have dreamed "in LabVIEW" more than once.