Labview Serial Communication

LabVIEW has serial VIs that communicate to the serial port on a PC. These serial VIs can be used to communicate with a 2-wire device using a DS3900 that accepts data and commands from the serial port and converts the information to 2-wire protocol. Serial Port Interfacing with LabVIEW. Details Cable Connectors Hardware Specification 1. Pin Identification 2. Communications Specifications LabVIEW Interfacing. Cable Connectors DB-9 Connector. Using a straight through serial cable. Typically, PC's are defined as a DTE and peripherals are defined as DCE.

Active2 years, 2 months ago

I have a problem of synchronization between data sent from LabView interface to Arduino.This is my code. I am using a SHT31 sensor to send temperature and humidity from Arduino to LabView after receiving a character specified. This part doesn't work correctly.I am using also a heating resistors activated by a random number in the LabView interface

Can anyone help me in putting interrupts in every event? Hadoop winutils.exe download.

Edgar Bonet
27.2k2 gold badges25 silver badges47 bronze badges
mariemLAOUEJmariemLAOUEJ

closed as unclear what you're asking by Code Gorilla, gre_gor, jfpoilpret, Greenonline, Enric BlancoJun 28 '17 at 10:23

Labview serial terminal vi

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

I tried to make sense of your code, but I didn't quite understandeverything, for two reasons:

  • your question is not very clear, as you don't completely specify whatyou want your program to do

  • the code itself is not always clear about what it's doing: somevariable should have better names and some more comments are needed tomake things clear.

These are also the most likely reasons you got a closing vote.

Despite this limited understanding, I tried to clean up the program.Here are the improvements I suggest:

  1. The first thing to do is get rid of the timer. You are trying to readthe serial port both from a timer event and from serialEvent(),which makes little sense. You should also remove all unusedfunctions, variables and #includes, they only make your programharder to read.

  2. Your getDecimal() function is a very misguided attempt to format anumber. If you call getDecimal(23.008) you get 8 (or maybe 7,depending on rounding), and you print it as 23.8. The simplest wayto get what you want is to let Serial.println() do the formatting.You can pass a second argument to specify how many decimal places youwant.

  3. Guitar search by serial number. There is a bug in your usage of stringVal1 and stringVal2: youare always adding data to them, which will inevitably exhaust youravailable memory.

  4. You always store a single character in your caract string,therefore this string can never be 'HU'. The easiest fix is to usesingle-character commands (e.g. “H” for humidity), then you don'tneed a String and you remove the risk of running into memory issues.

  5. You should process input characters only as you read them. Readingthem in serialEvent() and processing them in loop() will get youout of sync, so do both in the same function.

  6. Note that Serial.read() returns an int, which is -1 if there isno data available. Thus, if you are going to compare to specificvalues, you don't need to test for Serial.available().

  7. If you set your heater index to a random number between 0 and 2, thenyou can use it as an index into an array of pins.

    Apr 11, 2004  Heckler Koch Date of Manufacturer Date Codes. If you own a Heckler Koch product, you may be wondering what those numbers and letters stamped on the receiver mean. Well, the two letter code refers to the year the weapon was made. HK CODE LEGEND. Heckler & koch pistols.

And here is a version of your program implementing all of the above:

Note that EXTRA_PINS is a very poorly named constant. You should findbetter constant names, but I couldn't figure out what you wanted to dowith those pins.

Edgar BonetEdgar Bonet

Labview Serial Communication Example

Communication

Serial Communication With Labview

27.2k2 gold badges25 silver badges47 bronze badges

Labview Serial Communication With Arduino

Not the answer you're looking for? Browse other questions tagged arduino-unoserialarduino-megaprogrammingarduino-ide or ask your own question.