Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
22 ratings:
 4.54 out of 5   

Writing Bits to the Serial Port Instead of Writing ASCII Strings



Primary Software:
Primary Software Version: 7.1.1
Primary Software Fixed Version: N/A
Secondary Software: Driver Software>>NI-VISA

Problem:
I want to be able to directly specify the bits that are written to the serial port, but the serial write function only takes a string input. Simply converting a number to a string doesn't work (i.e. a decimal 0 converted to the ASCII string "0" will write "0011 0000" instead of "0000 0000").

Solution:
The example code attached shows how to convert an array of bits to a string in the proper way such that they can be written to the serial port. Basically, the bits must be converted to a decimal number, then that number must be converted to an array so that the "byte array to string" function can be used.

LabVIEW 2011 Implementation










Related Links:
KnowledgeBase 1B0AGRVJ: How Can I Convert ASCII Characters to ASCII Codes and Vice-Versa? (LabVIEW)

Attachments:


BitsToSerial.zipBitsToSerial.zip


Report Date: 08/19/2005
Last Updated: 08/13/2014
Document ID: 3OIFGTLA

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit