LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

having trouble with entering text into a "table" using shift register

Hey NewMachine,

I believe that you are encountering the difference between hex code display and normal display modes.  The table doesn't allow you to change the display mode to hex, so we need to do a little translating.  Here's a small example that basically makes the normal display mode display what you see when you select the hex display.  Follow me?  It basically takes your string (hex display), translates it into a byte array, then converts the hexidecimal number into a string.  The string output is in normal display and matches the input string.  The select statement at the bottom is just for formatting purposes. 



Hope this helps!
Andy F.

Message Edited by Andy F. on 02-23-2006 07:15 PM

Message Edited by Andy F. on 02-23-2006 07:16 PM

-----------------------------------------------------------------
National Instruments
Message 11 of 15
(938 Views)
i don't really understand.......the hex that i just sent the hex display that is going directly into my little command log (which is displaying normal text) is where i add this for loop? what if the hex is more than 2 in length? like what if i am sending four bytes and two later. then that length isn't fixed....also...do i create the byte array using shift registers on my main while loop or create a new for loop like you have here? thanks!

@Andy F. wrote:
Hey NewMachine,

I believe that you are encountering the difference between hex code display and normal display modes.  The table doesn't allow you to change the display mode to hex, so we need to do a little translating.  Here's a small example that basically makes the normal display mode display what you see when you select the hex display.  Follow me?  It basically takes your string (hex display), translates it into a byte array, then converts the hexidecimal number into a string.  The string output is in normal display and matches the input string.  The select statement at the bottom is just for formatting purposes. 



Hope this helps!
Andy F.

Message Edited by Andy F. on 02-23-2006 07:15 PM

Message Edited by Andy F. on 02-23-2006 07:16 PM



0 Kudos
Message 12 of 15
(917 Views)
NewMachine,

That bit of code that I posted fits well either right before your table, or even better right after the Command Line Input string control (to prevent having to index through the array and convert each element).  The two constant that is wired there is just to specificy the width of the string that is being converted.  You shouldn't have any problems using this with any length of hex.  I envisioned this to be used as its own little module or subVI, so I think creating a new loop would be the way to go.  I would recommend implementing this bit of code in a new VI and testing it out, and maybe creating a subVI for use in your program.  Let me know if you have any other questions!

Thanks,
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 13 of 15
(905 Views)
Hi Andy - I was put together a small vi to test this and make into a subvi. It seems to work except that it logs one command at each loop iteration, when I only want it to display in the table once per command. Can you see what Im doing wrong? thanks!

@Andy F. wrote:
NewMachine,

That bit of code that I posted fits well either right before your table, or even better right after the Command Line Input string control (to prevent having to index through the array and convert each element).  The two constant that is wired there is just to specificy the width of the string that is being converted.  You shouldn't have any problems using this with any length of hex.  I envisioned this to be used as its own little module or subVI, so I think creating a new loop would be the way to go.  I would recommend implementing this bit of code in a new VI and testing it out, and maybe creating a subVI for use in your program.  Let me know if you have any other questions!

Thanks,
Andy F.



0 Kudos
Message 14 of 15
(897 Views)
NewMachine,

You might consider using a case structure and a boolean to control when the commands are sent and updated on the table.  If you place a boolean control on the Front Panel, then place a case structure around your table, you can wire the boolean (make sure its inside the loop) to the selector terminal.  You would want the command to be written only when you click the button, so make sure that the table is in the case structure.  You also might consider placing the build array in the case structure as well to prevent you from adding every iteration to the shift register and just add it when you would like.  Let me know if you have any problems implementing this.

Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 15 of 15
(883 Views)