Hobbyist Toolkit

Showing results for 
Search instead for 
Did you mean: 

How to control CS configuration with case structure? so that I can select specific chip in the front panel using a drop down manual.

How to control CS configuration with case structure? 


Hey guys,


Just have a tricky question here, I am using the Linx Arduino library to control my SPI device. I want to create a drop-down manual in the front panel (like chip 1, chip 2, chip3 …) so I can individually select and control the chip, but the CS configuration port of the SPI Write Read. vi is doesn't allow me to use case structure to do that.

1. using constant: this only allows me to change the constant CS number in the Block diagram, and I can't put case structure in the sub vi

2. using control: this will give me control in the front panel, but I want to have a drop-down button saying chip1, chip2, chip3... 


Any advice will help, thanks in the front. 






0 Kudos
Message 1 of 5

Can you provide images of your issues?  I don't quite understand what you are doing so it is hard to provide you advice.


You can definitely have a case structure which can be controlled from a drop down list.  There are multiple types of drop down type of controls.  It sounds like you want one that provides a string output and each of those strings will be a specific case.

David Wilt
The New Standard LLC
Message 2 of 5

Hi David Wilt,


Thanks for the reply.


I am working with 8 SPI chips and using Arduino mega 2560 to control them. And I am using LINX LabVIEW to control the Arduino. 


The SPI writes Read. vi has an input called CS configuration, I want to use the case structure exactly you said to control the CS Channel, but I don't know how to achieve that. I include some pictures in the attachment. Please take a look.

0 Kudos
Message 3 of 5

So here is what I think you are asking.  To programmatically change the CS Channel value, which is in a cluster, you need build the cluster.  Take the cluster constant which you created and pass it into the Bundle By Name function.  This then allows you to update the CS Channel value of the cluster and pass it into the SPI Write Read.vi.  Now you can either use the Ring control to control a Case Structure and define the CS Channel value in the cluster, as shown on the right below, or since the value you needs is numeric, you can configure the Ring control to directly contain this numeric information, as shown on the left below.  I see that Chip 1 is supposed to set a CS Channel value of 2.  This can be configured directly in the Ring control by unchecking the Sequential values box in the Ring Properties.  Both of these options will produce the same end result of setting the CS Channel to 2 when Chip 1 is selected.



David Wilt
The New Standard LLC
Message 4 of 5

You just save my life, thank you so much, man!

0 Kudos
Message 5 of 5