![]() |
|
#1
|
|||
|
|||
|
DUP <> DUP
hi,
I have a very curious problem when I run the driver I am writing for the compass module. I have it DUP the data bytes as they come in the SPI port. I print one copy, and save the other to the stack, when I print out the stack, the numbers are not the same. What the heck is going on? Thanks, Mark : 2COMPASS-DATA ( 2,3,4,5 AJR, Puts Compass Module data on stack ) CR 5C B028 C! ( Set SPI for Compass ) DF B008 MAND ( Enable Compass ) 1 SENDSPI ( Start Measurement ) 20 B008 MOR ( Disable Compass ) 8 LONGDELAY C! ( Delay for measurement ) LONGDELAYTIME DF B008 MAND ( Enable Compass ) 3 SENDRECEIVESPI ( Read Compass Data) DUP C@ ." Compass Data is " . CR 1 SENDRECEIVESPI ( Read Compass Data) DUP C@ ." Compass Data is " . CR 1 SENDRECEIVESPI ( Read Compass Data) DUP C@ ." Compass Data is " . CR ( read 3 bytes of Compass data ( seperate into X and Y ) ( perform 2's complement, store ) 20 B008 MOR ( Disable Compass ) 50 B028 C! ( Set SPI for 5450 ) ; 2COMPASS-DATA Compass Data is F6 Compass Data is 1D Compass Data is D0 OK . BF OK . FA OK . F0 OK |
|
#2
|
|||
|
|||
|
Looks like at one place you DUP and C@, the other you just print.
In otherwords, I suspect: at address 00BF is a value of D0 at address 00FA is a value of 1D at address 00F0 is a value of F6 Try just printing the data and not C@'ing it and see if your results don't match. |
|
#3
|
|||
|
|||
|
Yes indeed that is what I did, Thanks, Mark
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|