LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting c code to labview

Solved!
Go to solution

I am not familiar with c codes. I just found out that a c-example means a c code example.

Can somebody help me with converting the C code to labview code?

lrc vi.PNG

 

Download All
0 Kudos
Message 1 of 4
(3,732 Views)

@RvG wrote:

I am not familiar with c codes. I just found out that a c-example means a c code example.

Can somebody help me with converting the C code to labview code?

 

 


It looks quite straightforward, you have to use a few bitwise VIs - for example the header LRC is the sum of the two bytes (for the sent message 0x18 + 0x00) , bitwise inverted and increased by 1.

The data LRC is similar, but there you have to sum all of your data bytes, invert it bitwise and  increase it by 1.  

You can even calculate it with the built in calculator in Windows, if you switch it to programmer mode (Alt+3). Try to calculate the examples in your document or if you have the actual device just send a few commands, and try to calculate those. After this it should be quite easy to get this work in LabVIEW. Just remember the proper byte order when creating a message.

Best regards,

CsabaF
Message 2 of 4
(3,700 Views)
Solution
Accepted by topic author RvG

This should work for you.   The only real tricky parts were the byte swapping and noticing that the first two bytes are not used in the header LRC.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 4
(3,682 Views)

Hi! Would you mind sharing with me your communication .vi for controlling MagPuls devices? I am going crazy with the damned hexes... I must start my pulsed DC source ASAP. Thank you very much!

0 Kudos
Message 4 of 4
(2,993 Views)