LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA and joystick control

I have sbRIO and want to change duty cycle of PWM through input coming from joystick connected to my PC. 
The fpga target won't support device input control. Any other way how to do it?

Help needed. 


0 Kudos
Message 1 of 8
(3,784 Views)

You need to do the joystick input on the RT side and send those values down to the FPGA.

 

Depending on your joystick, the implementation on RT will vary considerably.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 8
(3,774 Views)

I have a USB joystick connected to PC. How am I supposed to read values and send them to FPGA? Gives me an error of VI not supported in current target. 

If someone could send me a VI please 


0 Kudos
Message 3 of 8
(3,755 Views)

Hello

 

You could use this USB Instrument Driver Control White paper to add the joystick as a USB VISA resource. After that, it’s just VISA calls to read the data from the joystick and send then, like Chris said, send the values from the RT side to the FPGA target side.

 

Remember your Real-Time Target has a Real-Time side (RT) and an FPGA side. Since the FPGA side doesn’t support that resource, you need to use the RT side.

 

 crio parts.png

 

Once you have your VISA resource added in MAX, you can use a shipping example like “Basic Serial Write and Read.vi” (Help » Find Examples » Search » “visa”) and put the VISA Read in a loop to continuously acquire the data from the USB. You can then send it to the FPGA. You can learn more about Transferring Data between the FPGA and the Host (FPGA Module) in this link.

 

Hope this helps.

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 4 of 8
(3,732 Views)

I don't think that White Paper is going to do you much good on your sbRIO - I believe it is for Windows only.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 5 of 8
(3,725 Views)

Hello Chris,

 

He actually needs to have Windows since that is where he is connecting his joystick to. He can pass along the information from the PC over to his sbRIO and then have the sbRIO transfer it to the FPGA using any of the Real-Time VI to Host VI Communication Methods.

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 6 of 8
(3,709 Views)

I don't get the fascination with NI always recomending that stupid white paper. A joystick is a USB HID device and the VISA Wizard will not work and even if you managed to create it, it is not an RS232 serial connection and the Basic Serial Write and Read will not work.

 

If the op is using windows and that is where the joystick is connected, then the correct functions are the ones on the Connectivity>Input Device palette (i.e. Initialize Joystick).

0 Kudos
Message 7 of 8
(3,702 Views)

Hello,

 

I have used basic input device blocks (initialize joystic and acquire input) to read joysticks directions on RT side. I am then converting these values to required pulse duration of my servo and then sending them to FPGA block where I have a servo program made that controls pulse width. 

Uptil now the program is working but I need to connect servo motors to check whether they are running properly. 


0 Kudos
Message 8 of 8
(3,677 Views)