From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fpga

I need help with a FPGA problem. I want to look at 48 DIO's and everytime there is a change I want to record the I/O state and time. This can happen over a period of 10 seconds or so. the duration between changes can be in milliseconds. I attached the code I am starting with. The plan was to form a single 64 bit word from the 48 DIO and everytime the word changed an entry is made to block memory. Unfortunately I don't fully understand the block memory process.

 

Can someone show me the proper way to write too, (and ultimately read from) the block memory? Is there a better way to do what I'm trying to do?

 

My hardware is an NI9082 and PC.

 

Thanks

 

John Mittleider

Boeing

Download All
0 Kudos
Message 1 of 10
(2,664 Views)

I assume you have a while loop that is not showing up in your screenshot.

 

Put the numeric value into a shift register.  Compare the current value with the one coming from the shift register with an XOR.  Any bits that had changed since the last iteration will be a 1, any that remained the same will be a 0.

0 Kudos
Message 2 of 10
(2,639 Views)

RavensFan,

Thanks for the quick response. Yes, the picture didn't turn out as expected. I stripped out the loop in question from the FPGA code and posted it here. I am able to get as far as your suggestion but can't get further. I want to know if the the DIO are fired in a consistant manner or if there are delays. I had thought I could read the 64 bit word and if there is a change record it and the counter in memory. After I shut off the loop I want to read the memory and store it for later analysis by hand. This is a temporary piece and will be removed after the timing is established.

 

Thanks again.

0 Kudos
Message 3 of 10
(2,633 Views)

Let's try again. I thought I could attach the vi but can't seem to figure that out either. So here is the picture again with the resto the loop shown. Maybe now the discussion can continue.

0 Kudos
Message 4 of 10
(2,628 Views)

HereFPGASaveBitStates.png

0 Kudos
Message 5 of 10
(2,619 Views)

I can't actually run your code because I don't have the hardware.  I have never used block memory before, so I can't comment on that.

 

Otherwise, it seems like your code should work.  My only comments are that it seems like you are essentially working 1 iteration behind on everything.  It might work just fine.  But you are putting everything into a shift register and not working with that data until the next iteration, and thus looking at the data from 1 iteration ago compared to 2 iterations ago.

 

The two address shift registers seem like they would always contain the same value (unless your VI happens to start with different values in those controls.  Otherwise, I think you could eliminate one of the shift registers and split the wire between the two Write Memory Blocks.

 

I'm not sure you even need controls for Numeric, Address 1, and Address 2.  They seem to be more to just initialized the shift registers than for any user interaction.  I would just turn them into controls unless there is some reason you need a user to interact with them before your FPGA starts.

0 Kudos
Message 6 of 10
(2,613 Views)

RavensFan,

 

For some reason I am really struggling with this snippet feature. The controls you mentioned started life as simply constants used to initialize the shift registers. There is no need for input from the operator prior to launching this routine. The first memory block is for 64-bit words for the data. This should be synced to the second piece of data (within one cycle of the loop) which is a 32-bit usec timer. The data is collected in a short burst of 3-4 seconds (may go as long as 10 seconds) by pressing the DataCollector button and then releasing the button when done. The data is (hopefully) in memory on the FPGA.

 

My problem is I want to retreive these data points and analyize them at my leasure. I can't seem to figure that part out. Any additional help would be appreciated.

0 Kudos
Message 7 of 10
(2,606 Views)

There must be some sort of Block Memory Read function.  You could run that in a separate loop that will iterate through the addresses and pull the data out.

 

What other code do you have running?  Do you have a VI on a host PC for collecting the data and displaying or analyzing it?

 

I've never seen the snippet feature convert constants to controls before.  You can certainly change them back to constants using the right click menu.

0 Kudos
Message 8 of 10
(2,598 Views)

The application consists of FPGA code, Real Time code and Host code on a PC for the HMI. I do not have any code at this time to collect or display this data. For some reason I'm not able to fugure out the retreival process.

0 Kudos
Message 9 of 10
(2,592 Views)

There is an example called Memory.lvproj in LabVIEW.  It's a pretty simple example, but it shows the read and write in a VI for the FPGA.

0 Kudos
Message 10 of 10
(2,586 Views)