09-27-2012 08:45 AM
Ok, quick question. First, thanks for the PNG.
How did you change the data type in the type case function? I thought it was a string, but yours is not.
I tried see how to change it, and it's probably a simple change, but can't.
Thanks!
TheLT
09-28-2012 05:19 PM
Type Cast defaults to a string, but you can wire other data types. In this case you just place a numeric constant on the block diagram, set its data type (in this case U16), and connect it to the Type Cast function. This tell it to interpret the data coming in (an array of two U8 values) as a U16. It does exactly the same thing as the Join Numbers function.
09-28-2012 05:50 PM
smecurio,
Ok, now I see what you're saying. Fixed.
Now, it does spit out some values that still don't make sense even when I looked at the data sheet.
Do you mind if I upload a screenshot of what I am getting?
Thanks!
TheLT
09-29-2012 08:41 AM
As long as you don't upload bitmaps you can upload whatever you want. And don't do the "I'll just change the extension from .bmp to .png to get around the ban on importing bitmaps" thing.
09-30-2012 08:30 PM
Smecurio,
Ok, please see attached configuration per my front panel. I think we are communicating, but I don't know how to decipher what's being said, and I have read the data sheets.
Thanks!
TheLT
10-12-2012 07:50 PM
Ok, so if anyone is still interested in helping out, I updated my code (attached). I also attached the data sheet to this device (MAG3110).
Here's the problem I am facing right now. I am reading from the device (I got rid of Read/Write from I2C, just straight read), but it seems to cycle the readings from the device in some type of waveform (image/png of front panel attached). I know the front panel has all zeros in the read data array, but rest assured when it runs I see the data cycle. I do see numbers I swear!
So the good news I am reading from it, but how to "calm it down" and make it useful I am stumped.
Can someone out there give me any ideas?
Thanks!
TheLT
10-13-2012 05:49 AM
@TheLT wrote:
Ok, so if anyone is still interested in helping out, I updated my code (attached). I also attached the data sheet to this device (MAG3110).
Here's the problem I am facing right now. I am reading from the device (I got rid of Read/Write from I2C, just straight read), but it seems to cycle the readings from the device in some type of waveform (image/png of front panel attached). I know the front panel has all zeros in the read data array, but rest assured when it runs I see the data cycle. I do see numbers I swear!
So the good news I am reading from it, but how to "calm it down" and make it useful I am stumped.
Can someone out there give me any ideas?
Thanks!
TheLT
Hi,
A quick thing you can test (not sure it fixes the issues you have):
It could be the byte ordering that causes problems, [hi byte lo byte] alternatively [lo byte hi byte].
Br,
/Roger
10-13-2012 06:25 AM
@User002 wrote:
@TheLT wrote:
Ok, so if anyone is still interested in helping out, I updated my code (attached). I also attached the data sheet to this device (MAG3110).
Here's the problem I am facing right now. I am reading from the device (I got rid of Read/Write from I2C, just straight read), but it seems to cycle the readings from the device in some type of waveform (image/png of front panel attached). I know the front panel has all zeros in the read data array, but rest assured when it runs I see the data cycle. I do see numbers I swear!
So the good news I am reading from it, but how to "calm it down" and make it useful I am stumped.
Can someone out there give me any ideas?
Thanks!
TheLT
Hi,
A quick thing you can test (not sure it fixes the issues you have):
It could be the byte ordering that causes problems, [hi byte lo byte] alternatively [lo byte hi byte].
Br,
/Roger
Or perhaps like this.
Probably a Rube implementation, could most likely be a simpler way of swapping the bytes in an U8 byte array.
Br,
/Roger
10-13-2012 10:15 AM - edited 10-13-2012 10:15 AM
You need to pay more attention to the data sheet. The memory map for the device is 12 bytes. At startup the address counter is set to zero. If you perform a burst read, where you try to read more than one byte, the address counter gets incremented after each byte. What do you think will happen after you read the 12th byte? Why do you need to read the other bytes anyway? Aren't you just interested in the X, Y, and Z values? These are in bytes 1 through 7. Thus, what is so difficult about using the Read/Write VI with the startng address set to 1 and the number of bytes to read set to 6 and having that in a loop? If you want to you can Type Cast the array of read bytes (6 of them) into a cluster which consists of 3 U16 values:
Note: If you want to see the data while the loop is running, then the chart/graph needs to be inside the loop. It's easier to use a chart since that has built-in memory.
10-14-2012 09:39 PM
All,
Thanks for you responses and I will try them when I am in the lab tomorrow. I just wanted to leave a brief note as a courtesy that I didn't forget this post!
Thanks!
TheLT