Guest Wuchi Posted October 19, 2005 Share Posted October 19, 2005 Hi! How is it possible to convert a data from PLC to convert it to Binary data. Best regards, Wuchi Link to comment Share on other sites More sharing options...
Guest Wuchi Posted October 19, 2005 Share Posted October 19, 2005 Hi!How is it possible to convert a data from PLC to convert it to Binary data. Best regards, Wuchi Maybe i haven't asked from the right angle I have for example integer of value 400, how can i convert it to binary data in DAQ? Wuchi Link to comment Share on other sites More sharing options...
LabJack Support Posted October 19, 2005 Share Posted October 19, 2005 I am not sure what you mean. Do you want to display the integer on the screen as a string of 1s and 0s? Link to comment Share on other sites More sharing options...
Guest Wuchi Posted October 20, 2005 Share Posted October 20, 2005 Yes i want to convert integer to binary data For example i get an integer of 2 and this represents 10 in binary. W. Link to comment Share on other sites More sharing options...
Guest Guest_AzeoTech Posted October 21, 2005 Share Posted October 21, 2005 There actually is no simple way to do this, even in Release 5.3 which allows easy conversion from dec to hex and dec to octal. That said, you can use the TestBit() function to examing each bit your number, which is usually what you want to do. For example, TestBit(503,2) returns 1. If you actually want to do a conversion, you could write a simple sequence function: Private.strOut = "" for (Private.x = 7, Private.x >= 0, Private.x--) Private.strOut += Format("%.0f",TestBit(Private.arg0,Private.x)) endfor return(Private.strOut) This will convert a decimal number into an 8 bit binary number. Change the 7 to 15 and you can do 16 bit binary. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.