From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using memcpy in formula nodes

Solved!
Go to solution

Hi,

 

I want to use memcpy in formula nodes.

 

But there is error in my program.

 

Labview is not support memcpy?

 

or I mistake somethings?

 

 

캡처.PNG

0 Kudos
Message 1 of 5
(2,676 Views)

Why do you want to use memcpy?

 

No, it is not a valid command for a formula node.

 

What are you really trying to do?

0 Kudos
Message 2 of 5
(2,672 Views)

I want to send float data to PC using UART.

 

My MCU(STM32) source is below.

 

uint32_t ftoc_buffer2=0;

float32_t IIR_HPF_output_display;

uint8_t tx_buff[6];

 

memcpy(&ftoc_buffer2,&IIR_HPF_output_display,4); // for uart send

tx_buff[2]=ftoc_buffer2>>24;
tx_buff[3]=ftoc_buffer2>>16;
tx_buff[4]=ftoc_buffer2>>8;
tx_buff[5]=0xFF&ftoc_buffer2;

 

[send txbuff[] by uart]

 

 

I convert float data to 8bit hex data. And send to PC by UART.

And, Labview program receive 4*8bit hex data

캡처1.PNG

And convert to 32bit hex data

 

캡처2.PNG

After that, I stuck how convert to float value.

 

In C language, I use memcpy.

 

How can i convert in labview?

0 Kudos
Message 3 of 5
(2,667 Views)
Solution
Accepted by topic author Sangkyu

Typecast the 4 byte string to a SGL. (virtually no code needed. Reverse the string if you need little endian byte order or use unflatten from string instead)

 

CastToSGL.png

 

 

See attached.

 

(In your original code, make sure the outputs are SGL, not DBL)

Message 4 of 5
(2,647 Views)

Thank you for your help.

 

Work very well my program캡처.PNG.

0 Kudos
Message 5 of 5
(2,596 Views)