|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Programing VL6180 I2c Sensor I2c
So...
It seems that some of the registers have 16bit addresses and the I2c VI only supports 8 bits (right?). To get around this I changed the initialization VI slightly so that the U-16 bit register addresses are split into two U-8 bytes with the lower 8 bits wired in to element zero of the data array and the upper 8 wired to the address input. |
|
#2
|
|||
|
|||
|
Re: Programing VL6180 I2c Sensor I2c
Quote:
I am using LabVIEW 2013 so I cannot open your 2014 snippets to look at the subVIs. You are using a different set of I2C subVIs than me. I also have a different breakout board: https://www.tindie.com/products/oneh...range-finding/ Putting a scope on my SDA and SCL lines I have not gotten an acknowledge from the VL6180X yet. Currently I think I might have fried the regulator on my board. Concerning your issues: the split number takes the high 8 bits and separates it from the low 8 bits but both are in the original format of U16. After the split number subVI you need to convert them to U8 also. Without downloading the I2C VIs I cannot be certain but it should be set up so that the Slave Address that you are putting in as 0x29 needs to be shifted 1 bit to 0x52. |
|
#3
|
|||
|
|||
|
Re: Programing VL6180 I2c Sensor I2c
With the advent of the new WPI I2C vi's for LabVIEW 2014, you no longer need to left-shift the slave (device) address by one bit. Simply use the sensor spec sheet I2C address within Labview.
|
|
#4
|
||||
|
||||
|
Re: Programing VL6180 I2c Sensor I2c
Quote:
The solution I was working on started with setting up an arduino with the working library and checking function of the sensor, then If it worked figure out what that code was doing and mimic it. By that point I had gotten the RIO to write addresses and data in the correct order. Hint: Have an arduino hooked up to the RIO and have it print what it receives to the serial monitor, I can't imagine trying to debug I2C with a scope. I think for this you will need a bi-directional I2C safe level converter: https://www.sparkfun.com/products/12009 In the end I couldn't figure out exactly all the steps and the order of which the arduino handles the amazing amount of initialization steps by reading the example and source files. The other problem was filtering out steps that set up ALS measurement because I don't need that feature. If I had the time and a bit more C++ experience I could do it. So after a day of fiddling with it I gave up and focused on using a one of the analog SHARP IR proximity sensors for now. I will go back once I have some time later, this thing is a little tough for someone who hasn't used I2C before. Post your 2013 code and I can look at it. I can write a 2013 example as well. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|