From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-17-2016 12:10 AM
I am new to the world of instrument communication and would like to communicate and control a mass flow controller. I have been given the commands to send to the controller to query for an address. They are:
MAC ID (Targeted MFC controller address)
STX(0x02)
Command code()x80 for read)
Packet length(0x03)
Class ID(0x03)
Instance ID(0x01)
Attribute ID(0x)1)
Pad(0x00)
Checksum
I would like to use the Serial Write command to send these to the controller but I am unsure how to type the commands in, or what syntax to use. If anyone out there is able to help that would be great.
Many thanks.
08-17-2016 12:31 AM
If you are using the serial commands to communicate then its prettymuch easy.
You can refer to example shipped with the LabVIEW.
You can go to Menu>> Help >> Example finder and there is an example simple serial read write which you can save elsewhere and modify your code.
OR
08-17-2016 12:34 AM
Hi and thanks for that. I've had a look at the example and it doesn't really let me know how to write the commands to send given that they are in hexadecimal format and there are a number of them. If you've any ideas I'd love to hear them.
08-17-2016 12:37 AM
@doljam wrote:Hi and thanks for that. I've had a look at the example and it doesn't really let me know how to write the commands to send given that they are in hexadecimal format and there are a number of them. If you've any ideas I'd love to hear them.
You can change the string control in LabVIEW Front panel as HexaDecimal Display. Just right Click and select hexa decimal display
08-17-2016 12:40 AM - edited 08-17-2016 12:41 AM
Its not a problem that you are sending a HEX data or any other data as the data will be in string format so you will need to change the display format
You can go through this document and check how to send HEX data. You can also find the example attached to the document.
http://digital.ni.com/public.nsf/allkb/6C24F2F07BC23BB78625722800710865
08-17-2016 12:40 AM
Perfect thanks for that. One last question. How do I include the Checksum requirement in each command?
08-17-2016 12:59 AM
@doljam wrote:Perfect thanks for that. One last question. How do I include the Checksum requirement in each command?
Checksum/CRC calculation has different methods. Common CRC calculation is to add all the payload otherthan header and Send along with the data.
Header
DataPayload
CRC
Need to send in this way
08-17-2016 01:10 AM
Would you be able to tell me exactly what a CRC is and how it is coded. Sorry if I appear to be asking nonsensical questions but I am learning fast!
Regards,
08-17-2016 01:26 AM - edited 08-17-2016 01:27 AM
Basic CRC is just adding the data which you are going to send to a device and append along with data, In the receiving end same will be decoded to verify wether all data has been received wihout any Loss. if both CRC Matches it means that data received without any loss.
Check this link, may be useful for you to understand on CRC calculation.
http://forums.ni.com/t5/LabVIEW/CRC-CCITT-16bit-Initial-Value-of-0xFFFF-or-0x1D0F/td-p/896664
08-17-2016 05:27 AM
@doljam wrote:Would you be able to tell me exactly what a CRC is and how it is coded.
A CRC is a check to make sure the data was recieved properly. It can range from a simple adding of the bytes to some interesting shifting, masking, XOR, and inverting. Unfortunately, you need to know how the instrument is calculating the CRC before you can even start to code that part up.
As far as creating your message, create an array of bytes for your data and then use Byte Array To String which will give you the raw data string to send via the VISA Write. For the read, you can use the String To Byte Array and then Index Array and Array Subset to get the parts of the data you need.