LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Latching a button, and loop issues


@herrlin wrote:

It doesn’t appear as though you actually setup the receive to look for a EOM character, whats the deal? 


When I add a VISA configure serial port function, and try to add a constant for the termination character, all I can use are numbers. I double clicked it to open the VI and I can see I can  also cycle through hex. However, it says "0xA = \n = LF". I'm not really sure what this means as I cannot input 0xA either, unless that is just "A" which I dont think so.

 


@herrlin wrote:

 

Next for your case issues you most likely still have the EOM character in the string you just can’t see it.  Try using trim white space VI before case structure.




Thank you so much. The trim white space worked perfectly. How do you guys get so smart? 

 


@herrlin wrote:

Lastly have you set up you device to look for a EOM character when you write to it?  I am thinking this because of the “D\n” you have in your sting constant.  If so, I think what you want to do is to right click you string constant and select “’\’ Code Display” and not “Normal Display” then type “D\n”.  As of right now you are sending string D\n not D new line.


The device right now works, but there is something like a 10 second delay to send data to it. The code on the Arduino/Xbee testing device is

 

void loop()
{

      inByte = XBSerial.read();
        if (inByte == 'D') 
          {
            digitalWrite(9, HIGH);
          }
          else if (inByte == 'E') 
          {
            digitalWrite(9, LOW);
          }
          XBSerial.print("A \n");
          delay(200);
          XBSerial.print("B \n");
          delay(200);

  delay(10);
}

 

So it sends A and B rapidly, and basically looks for E or D to turn on/off the LED. I'm assuming this is just bad coding and that's okay for now.

 

I hope no one feels like they are doing this for me. This is 100% valuable learning information and I really appreciate it.

 

 

0 Kudos
Message 21 of 25
(1,049 Views)

@fernian wrote:

@herrlin wrote:

It doesn’t appear as though you actually setup the receive to look for a EOM character, whats the deal? 


When I add a VISA configure serial port function, and try to add a constant for the termination character, all I can use are numbers. I double clicked it to open the VI and I can see I can  also cycle through hex. However, it says "0xA = \n = LF". I'm not really sure what this means as I cannot input 0xA either, unless that is just "A" which I dont think so.

 

 

 

Herrlin, what does "EOM" mean?  Do you mean "EOL" which is End of Line.

 

0xA   0x is a common way of signifying a hex value (not exactly sure why 0x).  So it is hex value A which is decimal value 10 and that is the new line or line feed character.

 

Another common one would be "0xD"  which is hex value D and decimal value 13.  That is the carriage return character.

 

Either way, it will show up as just A or D in a numeric constant set to show hex values.  And if the radix is display, it will show an x there.

 

 

As for GPIB,USB.  I won't comment on USB because the USB protocol is very complicated.  But typically you don't have to worry about it because most USB devices have a driver that makes the item look like a regular serial com port to Windows.

 

Whether a "virtual" com port, real com port, or GPIB, having a wait statement in the loop that is doing the VISA write will establish the communication rate.  (Unless something else is happening in the loop that takes longer than that such as heavy data analysis or doing a VISA read after the write that takes too long for the data to come back.)

 

 

EDIT:

 

One more thing.  Your text codes shows you are sending "A \n"  That means you are literally sending a backslash and an n.  You aren't sending a new line character.  You need to send something like "A ";chr$(10) (Not sure if you actually need the space or not) to send the letter A and the line feed character.

 

0 Kudos
Message 22 of 25
(1,041 Views)


 

 

One more thing.  Your text codes shows you are sending "A \n"  That means you are literally sending a backslash and an n.  You aren't sending a new line character.  You need to send something like "A ";chr$(10) (Not sure if you actually need the space or not) to send the letter A and the line feed character.

 


Even with the string display changed to "\ Codes display" ?

0 Kudos
Message 23 of 25
(1,032 Views)

I'm talking about your text-based code in the Arduino, not the LabVIEW code.

0 Kudos
Message 24 of 25
(1,027 Views)

Ravens Fan wrote:

 

Herrlin, what does "EOM" mean?  Do you mean "EOL" which is End of Line.

 

 


I use EOM as "end of message" meaning end of message character.  I can see how this would be confusing, I should probably just say "message termination character".

Herrlin

Just trying to spread the LabVIEW love.
0 Kudos
Message 25 of 25
(1,019 Views)