LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display colour data on a rectangular column

Solved!
Go to solution

You are constantly initializing the shift register.

Move the outer shift register to the outer while loop and initialize it from the outside when the program starts. Remove the N=1 FOR loop. It serves no purpose.

 

Also, how many times do you think you need to take the same string subset? You can get the first character once and wire it to a case structure with as many cases as you have possible outcomes. Also create a default case that does nothing or generates an error. Your entire code would shrink to the size of a postcard. 😄

0 Kudos
Message 11 of 20
(1,577 Views)

Thanks. I will give that a go.

 

And haha didn't know that can be done with the case structure. Well I am a LabVIEW noob after all haha. Cheers for that lesson. Smiley Happy

0 Kudos
Message 12 of 20
(1,565 Views)

Here's a quick mockup on what I had in mind. Also note that you don't need a seperate indicator for charts. Simply right-click the chart and select "visible items...digital display". You should wire your property node error out to the outer while loop to make sure the loop does not start until all charts are reset.

Note that there is no more duplicate code. 😄 Modify as needed.

 

The use of "bytes at port" is typically not recommended. Doesn't the instrument send a termination character, for example?

0 Kudos
Message 13 of 20
(1,554 Views)

Just checked the modifications. Haha you weren't joking when you made the postcard reference. Thanks for sorting that out.

 

And yes, it used to carriage return ('13') as a termination character, but I took it off when I was doing this test. If I included the termination character, will it become easier for me to extract the data? Also does using bytes at port create any issue? 

 

Thanks for your help. 

0 Kudos
Message 14 of 20
(1,545 Views)

Yes, you should read the valid chunks terminated by the termination character. That ensures that you don't get framing errors. For example if you just check the "bytes at port" while it is in the middle of receiving, you might occasionally only get partial data and trying to parse it would give you garbage. I never do serial, so others with more experience should chime in.

 

Warning: my code above was just patched together very quickly, so there are probably bugs. For example I just noticed that you need to insert a "+1" after the iteration terminal in the very small FOR loop of the V case.

0 Kudos
Message 15 of 20
(1,535 Views)

Okay I understand that. 

 

And add one to the number of iterations then? I have attached the VI.

0 Kudos
Message 16 of 20
(1,523 Views)

No, the number of iterations is determined by the array with 3 elements and should remain at 3.
(Posting by phone, will look at the code later)

0 Kudos
Message 17 of 20
(1,515 Views)

Yes, that's almost what I meant. Of course simpler would be to use the increment function. Less clutter, 😄

0 Kudos
Message 18 of 20
(1,501 Views)

Haha I always tend to take the tedious way. 

 

Anyway, I have attached my final design. Looks a bit messy as I have added all the parts in. This also includes a simulation of my robotic arm on which the RGB sensor is mounted. Any suggestions on how I can modify this program and make it more efficient and less please? 

 

Any help will be greatly appreciated. Thanks.

0 Kudos
Message 19 of 20
(1,488 Views)

I have attached my latest labview VI. 

 

I have put a set of boolean switches inside a while loop. Each of them write different characters to the serial port. Preferably I want to do it once, even though it is in a while loop. Is latching after press the best way to set up the boolean switches for this purpose? 

 

Also, I have another while loop continuously running in search for any incoming data from the active serial ports and also have a 3D robotic arm simulation model running at the same thime which moves according to the joint position feedback from some smart servos that comes in through one of the serial ports.

 

Loads of things are going on in this VI. I was wondering is there a way of simplyfying it, so that it might be easier for me to debug it, if necessary.

 

Any help will be greatly appreciated. Thanks. 

0 Kudos
Message 20 of 20
(1,465 Views)