LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating an ASCII string from BCC

Solved!
Go to solution

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

                                           

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 1 of 7
(5,624 Views)
Solution
Accepted by topic author LV_Pro

Something like this 🙂

sample.PNG



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 2 of 7
(5,609 Views)

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.

 

Hex to Number.png

Tim
GHSP
0 Kudos
Message 3 of 7
(5,606 Views)

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?

 

 

Message 4 of 7
(5,601 Views)

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.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 5 of 7
(5,592 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 7
(5,556 Views)

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.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 7
(5,545 Views)