Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How 3x axis sine waves act on a Compass module Oshonsoft BASIC.

Status
Not open for further replies.
Hi j,
Here is the latest program, I've got to have a break.

Here are the results:

As you can see there's no improvement :mad:
Only check if you want to, I've got to re-check tomorrow.
C
_____________________________________________________________________
[00][00]Ready!
0.00, 0.00, 0.00
AT+C002
0.00,0.00,0.00
0.00,0.00,0.00
0.00,0.00,0.00
0.00,0.00,0.00
0.00,0.00,0.00
0.00,0.00,0.00
0.00,0.00,0.00
0.00,0.00,0.00
0.00,0.00,0.00
 

Attachments

  • 18F4520 INT8MHz HC_12, AK8963C PCB3 XYZ-SELF_TEST 170920.txt
    5 KB · Views: 249
But it should stay as 1 when you set the mode for self test.

SELF TEST'+++++++++++++++++++++++++++++++++++++++++++
SPICSOn
SPISend 0x0a 'CONFIG CNTL1
SPISend 0x00 'POWER DOWN

SPISend 0x0c 'ASTC
SPISend 0x40 'SELF BIT= 1

SPISend 0x0a 'CONFIG CNTL1
SPISend 0x08 'SELF TEST MODE <-------- this clears the 16 bit data mode. It should be 0x18 or %00011000
 
Last edited:
But it should stay as 1 when you set the mode for self test.

SELF TEST'+++++++++++++++++++++++++++++++++++++++++++
SPICSOn
SPISend 0x0a 'CONFIG CNTL1
SPISend 0x00 'POWER DOWN

SPISend 0x0c 'ASTC
SPISend 0x40 'SELF BIT= 1

SPISend 0x0a 'CONFIG CNTL1
SPISend 0x08 'SELF TEST MODE <-------- this clears the 16 bit data mode. It should be 0x18 or %00011000
Hi J,
I agree, so I've changed it, well done :) But the result was the same. All zeros:(

Then I replaced the new 'AK8963C COMPASS INITIALISATION' With the old version, and it now works:):), but I don't know why.
Here's the program, with NEW commented out.

EDIT: The result of the Self test doesn't seem different to the normal READings, I'll re-look tomorrow.
C.
 

Attachments

  • 18F4520 INT8MHz HC_12, AK8963C PCB3 XYZ-SELF_TEST 170920_1.txt
    5.9 KB · Views: 262
Last edited:
Hi J,
I realised that the second CNTL1 also needs the 16 BIT restoring, so perhaps the

I've reverted to the #31 program with the 2x16BIT '1' added.

It appears to be working now. If programmed it shows the 'Self test' then if switched OFF/ON, then no 'Self test' Any ideas?

EDIT: Can you think of a reason that when programmed it shows 255, 213, 175 and when it is switched OFF/ON it shows 255, 0, 0?
Could it be that once it has programmed the 'Self test' it resets the sensors?
C.
'_________________________________________________________________________________
[00][00]Ready! PROGRAM
255, 213, 175
AT+C002
-193.00,209.00,-331.00
-193.00,205.00,-337.00
-185.00,205.00,-337.00
-190.00,206.00,-332.00
-194.00,208.00,-332.00
-200.00,206.00,-336.00
-196.00,206.00,-342.00
-195.00,209.00,-335.00
-191.00,209.00,-337.00
-190.00,214.00,-334.00
-192.00,208.00,-334.00
-196.00,210.00,-336.00
[00][00]Ready! SWITCH OFF/ON
255, 0, 0
AT+C002
-201.00,203.00,-341.00
-188.00,210.00,-336.00
-193.00,213.00,-337.00
-191.00,215.00,-339.00
 
Last edited:
See the d/s about the values of X,Y,Z in the self test.
Hi J,
Negative at both ends, so I'm stuck.
Are there any ideas.
Should I ask the question on AAC?

EDIT: I don't think it's actually carrying out the 'Self test', as I commented it out and still got the same READings.
C
 
Last edited:
Hi,
I hust started a register check program, but I have to remember how the READ/WRITE BIT works. I thought a BYTE e,g, 0x0A should be 0x8A, but I I'm not so sure
C
 
Most significant bit ( bit7 ) is 1 for reading, 0 for writing.
For example read register at address 0xA
spisend 0x8A or spisend %10001010
spireceive data
 
Most significant bit ( bit7 ) is 1 for reading, 0 for writing.
For example read register at address 0xA
spisend 0x8A or spisend %10001010
spireceive data
Hi J,
I've just spotted 7.2.3 in the D/S. I'll read it.
Thanks.
(Away for a few days)
C
 
Hi,
I think I get it now!
I was getting mixed up between 8BIT and 16BIT READ.
I'll have a go at checking WRITE READ, so I can figure out why it's not correct.
C.
 
Something wrong in the first self test.
Z should be always negative.
Hi,
Just re-checking everything, and notice that if I output the 2x bytes that are making the postitive number it looks like this, which should result in a negative number? Which looks like the 2's compliment section isn't working correctly.
C
'__________________________________________________________________
Ready!
SELF TEST 72 155 3 57 255 213
72, 3, 255
AT+C002
-202.00,216.00,-328.00
-195.00,211.00,-317.00
-203.00,215.00,-321.00
-191.00,207.00,-327.00
-201.00,215.00,-325.00
 
The 2's complement calculation in the self test should be exactly the same as in the measured values.
Print low bytes, high bytes and the 2's complements from the self test.
 
The 2's complement calculation in the self test should be exactly the same as in the measured values.
Print low bytes, high bytes and the 2's complements from the self test.
Hi J,
True!
I've changed the program a bit, and found BYTEs where there should be SINGLES.
Here:
C
 

Attachments

  • 18F4520 INT8MHz HC12, AK8963C PCB3 XYZ-SELF_TEST 240920.txt
    6.6 KB · Views: 240
Hi,
I set-up READ the 'self test' registers, but the READings are incorrect. It looks like it's not WRITEing.
C
______________________________________________________________
[00]Ready!
WIA 72 ST2 16 CNTL1 22 CNTL2 0 ASTC 0 I2C 27 ASAX 169 ASAY 166 ASAZ 159
SELF TEST 44 255 208 0 188 254
-212.00, 208.00, -324.00
AT+C002
-214.00,198.00,-330.00
[00][00]Ready!
WIA 72 ST2 16 CNTL1 22 CNTL2 0 ASTC 0 I2C 27 ASAX 169 ASAY 166 ASAZ 159
SELF TEST 42 255 198 0 182 254
-214.00, 198.00, -330.00
AT+C002
-219.00,205.00,-317.00

EDIT: I've just read that ASAX-Y-Z DATA is not correct in this mode.
 
Last edited:
What do you mean it is not writing?
Hi J,
In the self test the program WRITEs the self test settings. If I READ them straight back they are as shown, not correct.
Just re-checking.
NOTE: Each test is a different program, here's the latest, with the gosub internal
C.
 

Attachments

  • 18F4520 INT8MHz HC12, AK8963C PCB3 XYZ-SELF_TEST 250920.txt
    7.4 KB · Views: 256
Where have you disabled I2C
Hi J,
I've just added it into the 'self test' routine at the beginning, and I think it changed things, but it didn't appear to set the ASTC SELF BIT.
Dull head today, I'll try tomorrow.
Thanks,
C.
 
Status
Not open for further replies.

Latest threads

Back
Top