New Micros, Inc  

Go Back   New Micros, Inc > Software Technical Support > FORTH ONLY
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 09-08-09, 10:27 AM
Mark Bresler Mark Bresler is offline
Registered User
 
Posts: 58
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
Reply With Quote
  #2  
Old 09-08-09, 10:01 PM
RMDumse RMDumse is offline
Moderator
 
Posts: 1,359
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.
Reply With Quote
  #3  
Old 09-10-09, 02:53 PM
Mark Bresler Mark Bresler is offline
Registered User
 
Posts: 58
Yes indeed that is what I did, Thanks, Mark
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is On
Forum Jump



All times are GMT -5. The time now is 01:33 AM.


Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.