LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can anybody explain me what is the meaning of "O1$J%5.1f$X%8.3f$" this calculation in Labwindows cvi?

Below is the program. Exactly i wanted to know how the sprintf line execute and what is mean by "O1$J%5.1f$X%8.3f$" and what this will do while execution of the program?

 

fLastDisp = SP.fDisp;

GetCtrlVal(panel, PN_TEST_NU_RETURN_RATE, &fReturnRate);

GetCtrlVal(panel, PN_TEST_NU_INCR, &fIncr);   

sprintf(sText, "O1$J%5.1f$X%8.3f$", fReturnRate, fabs(fIncr));   

FlushInQ (CC.uComPort);  

ComWrt (CC.uComPort, sText, strlen(sText));   

TimeDelay(.5);  

SetCtrlVal(pnTest, PN_TEST_TX_STATUS, "jogged upwards..");    

 

 

Thanks in advance.

0 Kudos
Message 1 of 2
(2,515 Views)

This string appears as a setting command to an external device.

 

Supposing:

fReturnRate = 123.4

flncr = -98765.4

 

the resulting output string will be "O1$J123.4$X98765.400$"

 

Only "%5.1f" and "%8.3f" are evaluated in sprintf, the other characters are transferred to the output string unchanged.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 2
(2,509 Views)