Jump to content
  • 0

Creating A VI for Pmod Nav


ARD1996

Question

Hello,

I need help creating a VI on labview to read the gyroscope on the Pmod Nav. I have Linx and the Pmod example files but none are for my specific Pmod. I have the Pmod connected to a arduino uno and using Linx for the interface between the two. I can't find any examples on how to make one for this Pmod or make a custom VI for it. Help will be appreciated.

Kind Regards,

ARD1996

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Hello,

Thanks that tutorial you have linked would I be able to run the Gyroscope example in Labview but it would be reading my new device being the Pmod Nav? Could this be a SPI problem. The Pmod Nav is wired to the Ardunio Uno as in the link https://blog.digilentinc.com/a-beginners-guide-to-pmod-app-notes/. I have got the Arduino code working for it however translating this to Labview is the struggle.

Kind Regards,

ARD1996

Link to comment
Share on other sites

Hi @ARD1996,

I looked through my old material, and found in a folder called "Minor Tweaks or Review needed" a number of VI's that I designed for the Pmod NAV. They were all last modified in late 2016 and haven't been looked at since then, so I do not how well it will work, but at least at lot of the base line is there. The existing Pmods added to LINX will have their own examples that detail how each of them work in the block diagrams in text boxes. I believe the ones I have attached do the same explanation, though based on what I had typed, there is at least some funkiness with the 2's complement conversion that is used.

Thanks,
JColvin

PmodNAV_calibrate.vi PmodNAV_close.vi PmodNAV_loadCalibrationValues.vi PmodNAV_open.vi PmodNAV_openForLoop.vi PmodNAV_read.vi

Link to comment
Share on other sites

Thanks for the files I noticed in the PmodNAV_read.vi there are a few missing sub Vi's you wouldn't have those at all? The sub Vi's are Collect16BitXYZdata_helperVI.vi and Twos_complement_with_negativeOutput_helperVI.vi

The read file is what I mainly need as I am just trying to read values from the accelerometer and gyroscope of the Pmod Nav.

This is what is written about the two's complement function. I am very new to Linx and Pmods so what exactly is the MSB that is needed to be checked?
"apparently, the two's complement function I'm using in the helper functions doesn't actually produce negative numbers... not sure what's up with that. It just looks to see if it is negative, if so add MSB to it. I thought that the mpide library accounted for the negative portion of two's complement but it does not do so either... this doesn't explain why I'm getting all 0's though (or all 1's when I run LabVIEW) though. Plenty of warning is given in the datasheet about not writing to reserved registers, but I am avoiding all of those correctly insofar as I can see. Or at least I presume that writing 6 bytes to three 16bit registers is fine; it works on other IC registers. And shows it operating that way in the timing diagrams in the datasheet if I recall correctly. What should be done in LV for the 2's complement is check the MSB. If 0, read the data as normal. If a 1, separate the MSB, read remaining bits as normal, and then subtract whatever the MSB would normally represent from that value"

Link to comment
Share on other sites

Hi @ARD1996,

I found those two VI's that you referenced. As for the block of text that you quoted, that is was some of my findings and thoughts while working with the Pmod NAV VI. The issue at had is less with LINX, LabVIEW, and Pmods as much as it is with correctly interpreting the data from the on-board chip on the Pmod NAV that calculates the data.

The data is stored within the Pmod NAV in two's compliment format which means the most significant bit (the MSB) dictates whether or not the rest of the data should be interpreted as positive or negative data. I would recommend taking a look at the Wikipedia article on Two's complement for more details on how to interpret it. 

As a fair warning, as this material was created nearly 3 years ago, I do not recall if it works correctly or not.

Let me know if you have any questions about this.

Thanks,
JColvin

Collect16BitXYZdata_helperVI.vi Twos_complement_with_negativeOutput_helperVI.vi

Link to comment
Share on other sites

I have hooked up the arduino to the Pmod Nav via SPI following these two guides:

https://reference.digilentinc.com/_media/reference/pmod/pmod-interface-specification-1_1_0.pdf

https://circuitdigest.com/microcontroller-projects/arduino-spi-communication-tutorial

Based on the pre-made examples in labview I put together a VI with the VI's you gave me. I have run it and I am getting negative values for all 9 axis, however they do not change.

PmodNavRead.vi PmodClose.vi PmodNav.vi PmodNavOpen.vi

Link to comment
Share on other sites

Hi @ARD1996,

Yeah, that's about as far as I got as you noted earlier in the quote you found in the Read.VI, but my bosses haven't had me rededicate my time towards this again (and it would take a awhile for me to relearn the material) so I'm not sure if I'll be able to readily help debug/engineer this.

Thanks,
JColvin

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...