First of all thanks to Ben for creating a HMC5883 component.
This magnetometer HMC5883 has a self-test function.
By trying to do that function I have some problems getting values out of array XYZ[6].
I can see Z values changing, but X and Y returns zero. I am not sure, maybe X and Y suppose to return zero.
Question
Is it a good idea to save the magnetometer readings in one go to an array or read one data register after another?
Is it possible to give an example of reading the magnetometer XYZ data?
Thank you.
HMC5883 Self-Test question (closed)
Moderator: Benj
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
HMC5883 Self-Test question (closed)
- Attachments
-
- array-1.jpg (36.02 KiB) Viewed 2721 times
Last edited by viktor_au on Thu Aug 08, 2019 12:09 am, edited 1 time in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: HMC5883 Self-Test question
Hello,
Can you post your program, I think I can see what you have done wrong but need to see the program to be sure.
The UpdateCompassData macro basically collects all 6 readings for you allowing you to then pull out the readings at your convenience.
Can you post your program, I think I can see what you have done wrong but need to see the program to be sure.
All at once is faster and therefore probably the recommended option.Is it a good idea to save the magnetometer readings in one go to an array or read one data register after another?
The UpdateCompassData macro basically collects all 6 readings for you allowing you to then pull out the readings at your convenience.
Here's a very brief example.Is it possible to give an example of reading the magnetometer XYZ data?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: HMC5883 Self-Test question
Thanks Ben
The program is attached.
The program is attached.
- Attachments
-
- HMC58883Test_2.fcfx
- (42.64 KiB) Downloaded 151 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: HMC5883 Self-Test question
Ok you were only reading a single register before and storing into XYZ[5].
I've changed this so now you read all 6 registers and store into XYZ[0]-[5].
I've changed this so now you read all 6 registers and store into XYZ[0]-[5].
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel