cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

LabVIEW FPGA I/O Configuration

Solved!
Go to solution

LabVIEW FPGA I/O Configuration

Hello all!

 

I only recently began using LabVIEW and the FPGA module is confusing me a lot. I am trying to accomplish something as simple as turning an LED on and off at a controlled time. I have the while loop delayed with a count, but the board I am using, the USB-7845R connected to a board of inputs, uses I/O pins rather than DI or DO pins like in the tutorials. 

 

I really would appreciate if someone could point me in the direction of how to configure my DIO23 pin. I want to be able to read and write values to the pin, which is controlled an LED (1 = On, 0 = Off).

 

I have attached what little I have as a screenshot - I apologize that it is not much, but I am really struggling on it. Thank you in advance for the help.

 

The Arduino code would look something like this -

 

pinMode(DIO23, OUTPUT);

 

void loop () {

digitalWrite(DIO23, LOW);

while(1){

if(digitalRead(DIO23) == LOW){

digitalWrite(DIO23, HIGH);}

else{

digitalWrite(DIO23,LOW);}

delay(1000)

}}

 

0 Kudos
Message 1 of 6
(244 Views)
Highlighted
Solution
Accepted by topic author Cameron9438
06-12-2018 08:43 PM

Re: LabVIEW FPGA I/O Configuration

You need to negate the state of your output every iteration - so ideally you would store the state at the end of each iteration in order to retrieve it the next (ie shift register). You also need the state to change every 1000ms (example) so you would need to prevent the loop from performing the next iteration until that time has expired (Wait ms)

 

That, keeping your output node (but as Write) and removing the rest of the I/O nodes will get you what you need. As a quick example:

 

2018-06-13 13_33_00-Clipboard.png

 

It can take some time to acclimatize to looking at code graphically rather than text (sequentially). 

Message 2 of 6
(219 Views)

Re: LabVIEW FPGA I/O Configuration

Thank you so much for your help - when I upload it tomorrow to the board, I will reply if I have any questions.

 

Cheers!

0 Kudos
Message 3 of 6
(200 Views)

Re: LabVIEW FPGA I/O Configuration

It worked perfectly - I also implemented a counter to see how many times it has flashed.

 

I think my main question for I/O ports is why is there a read / write function if you simply use a block that has an output facing right for inputs and a block that has an input facing left for the outputs?

0 Kudos
Message 4 of 6
(170 Views)

Re: LabVIEW FPGA I/O Configuration

 

Are you referring to the "Read I/O" and "Write I/O" nodes under the User-Controlled I/O sampling palette? That name of the palette is your first clue (as is the help file). This allows you to create higher-speed I/O generation/acquisition as compared to the standard I/O nodes by creating your own sampling clock. You can read a good description on this feature here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Km2SAE. I've never actually used this feature but there are probably others here who have.

 

Typically the majority of projects work just fine within the performance boundaries of the standard I/O nodes and they are certainly easier to use, as you stated. However there are certainly some projects where a higher sampling interval can be useful.

 

If you are planning on doing a lot of FPGA work then I can also recommend the FPGA Developers Guide here: http://www.ni.com/tutorial/14600/en/. It doesn't describe some of the newer FPGA features but its certainly a good read to really come to grips with some of the intricacies beyond the hand-holding tutorial content NI has online (which I assume you have looked at eg. http://www.ni.com/tutorial/14532/en/)

0 Kudos
Message 5 of 6
(161 Views)

Re: LabVIEW FPGA I/O Configuration

Yes - I found the videos extremely helpful in getting a generally idea of how to work through problems with LabVIEW. In terms of the User-Manual it goes extremely in depth on areas that are not always relevant to what my problems are; that is why I find the forum works great.

 

I unfortunately have another question, but since it is not related I will make a new thread about it - Thanks a ton for the help! It's nice to have someone answer very simple questions that I would usually ask a professor if I was in lab.

0 Kudos
Message 6 of 6
(155 Views)