LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift Register

I am working on extending an existing arduino projec to use a LabVIEW interface.

I have a laser gun zombie shooting range that is currently running off of an Arduino. I would like to extend it to use LabVIEW so that I can have simpler control over targets and timing as well as providing a better user score feed and timer feedback for the game.

Here's the catch:

I didn't have enough digital IO to read in all of my targets and to turn all of my targets on and off I had to extend them with shift registers. The approach worked great with just the arduino but I am afraid that if I try to do the same with LavVIEW, I will suffer speed issues on my polling and writing of the outputs.

I'm wondering if anybody has already modifed the firmware to set it up so that the Arduino still pulses the shift register and applies the data out from a buffer and reads the data in to a buffer and then just ship the buffer up to/from LabVIEW.

Hopefully this made sense!

If nobody has done it yet; I'm going to pioneer it. Any ideas or advice will be fielded!

Thanks!

- Mike

0 Kudos
Message 1 of 11
(10,919 Views)

Wow, that's confusing.  There is such a thing as a "shift register" in LabVIEW that has nothing to do with Arduino.  I was expecting the question to be about LabVIEW shift registers. lol.

On topic:

You can do just about anything with LIFA that Arduino can do by adding custom commands.  I can't count the number of things I've added to LIFA for my own purposes.  If you attach your Arduino code and a link to the shift register IC datasheet I can look at it.

If you would like to do it on your own (add a function to LIFA), you simple need to look at an existing command to see how it's done.  Once you learn how one of those works you can make your own.

Message 2 of 11
(4,431 Views)

Interesting problem. Got some questions for you.

What is the part number of the shift register IC chip are you already using with your Arduino?  How are you communicating between the Arduino and the shift register now?  Digital lines, I2C or SPI? How many channels (targets) are you trying to control in your arcade and how many switches do you need to read?  Finally, how fast do want to transition between reads/controls?  

If you send the code and data sheets  that NatanB mentioned, we can probably help you.

JohnCS.

0 Kudos
Message 3 of 11
(4,431 Views)

Haha you know it's funny... I work with LabVIEW every day and it didn't occur to my brain that I was using an overloaded word in this context. I guess my brain just flipped to hardware.

I don't know the shift register offhand but it's a pretty common one. I think that I originaly struggled getting it to work with SPI bus and so I decided to bit-bang it with the Arduino. It had something to do with the latching. I guess if I can get it to work with I2C or SPI, the LIFA will handle it natively.. I didn't think about that.

I'm pretty confident that if I can't get it to work natively that I could build a function on the Arduino that handles it and just; as I said store the data in a buffer and poll the buffer from LV with a custome function. That should work right?

I worked on it last Halloween and I'm ramping up for this Halloween so it's been a while since I looked at it. I came here to brainstorm and get some ideas. I guess I'll do some studying of the LIFA firmware and come back with better questions when I get stuck.

Thanks so much for the fast replies!

0 Kudos
Message 4 of 11
(4,431 Views)

MPCC wrote:

I'm pretty confident that if I can't get it to work natively that I could build a function on the Arduino that handles it and just; as I said store the data in a buffer and poll the buffer from LV with a custome function. That should work right?

Yep, that should work.  I make my own custom functions quite often it seems.

0 Kudos
Message 5 of 11
(4,431 Views)

Im trying to use the shift register 74HC595 with Lifa, but im not able to make it work

I just want to rebuild this example from http://arduino.cc/en/Tutorial/ShiftOut in Labview.

maybe u can help

thx

Sebastian

0 Kudos
Message 6 of 11
(4,431 Views)

Alright... I got it working. I'm simply sending the data out on SPI and Latching the data afterwards. No custom functions required...

0 Kudos
Message 7 of 11
(4,431 Views)

Replying to blobse.

I suggest you don't use LIFA for your application.  Instead use the Advanced Serial Write and Read.VI that comes with Labview to communicate with your Arduino board.   Then load you Arduino bord with one of the exanmple sketches listed in your link.  This looks like a likely one: <http://arduino.cc/en/Tutorial/ShftOut12>

hrh1818

0 Kudos
Message 8 of 11
(4,431 Views)

Can you explain how you "latched the data afterwards" sending data via SPI?  I'm trying to program the AD4108 chip and it sounds like what you did is exactly what I need to do.  As opposed to using the SPI chip select active low scheme, the AD4108 buffers the data, then shifts it in on the rising edge of a pulse on the LE pin. 

0 Kudos
Message 9 of 11
(4,431 Views)

Vinny,

Wire a digital output from the Arduino (one not used for SPI) to the latch bit of the chip.

Then, just pulse it up and down when it needs to be done.

I actually just added a bit of code that turned the digital on, waited a few mS, and then turned the digital off.

I took that code and resaved the SPI write function from the LIFA library as shift register write. I modified the init function to have an input for a latch bit.

It was all pretty crude and if you were to attempt to send data at a fast rate, you would see some lag build-up. However, it worked fine for my purposes.

0 Kudos
Message 10 of 11
(4,431 Views)