Reference Voltage on H48C, BS v. SX28
This problem has me, I'm afraid.
I'm using the professional development board with a BS2px24 and SX28AC/DP.
When I run the demo program for the H48C using the basic stamp, the reference voltage is pretty at 2046.
I wrote the following program to allow me to step through things as completely as possible.
Two things:
1) The reference voltage is fairly steady at 3127. The X, Y and Z voltages are nearly steady at (though X will fluctuate slightly):
X = 3120
Y = 3131
Z = 3580
Why would the reference voltage be so much different on the SX28 compared to the BS? Shouldn't it be the same?
2) When I single step through the code, I get readings that come out like (hex) 7FF, 85F, 87F, 9FF. The last digit is always an F. If I run it at speed and break on the last line, I get the above numbers. What am I missing?
I'm an old man newbie and am not seeing what I am missing. Any help would be greatly appreciated.
Best,
Joss
LIST Q = 37
DEVICE SX28L, TURBO, STACKX, OSCHS2
IRC_CAL IRC_FAST
FREQ 50_000_000
RESET 0
Loop
setb rc.5 ;Preset CS High
mov !rc, #%00000110 ;Set rc.5 to output
clrb rc.5 ;Set CS Low
clrb rc.2 ;Set Data Pin low
mov !rc, #%00000010 ;Set Data Pin to output
clrb rc.1 ;Set Clock pin low
mov !rc, #%00000000 ;Set Clock pin to output
setb rc.2 ;Send %11
setb rc.1
clrb rc.1
setb rc.1
clrb rc.1
clrb rc.2 ;Send %011
setb rc.1
clrb rc.1
clrb rc.2
setb rc.1
clrb rc.1
clrb rc.2
setb rc.1
clrb rc.1
clrb rc.2 ;Set data bit low
;Shift in
mov !rc, #%00000100 ;Set data pin as input
clrb rc.1 ;Set clock low
mov !rc, #%00000100 ;Set clock pin as output
;Read thirteen bits back in
clr $0f
setb rc.1
clrb rc.1
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
clr $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.5 ;Set CS high to terminate the conversation
jmp Loop
I'm using the professional development board with a BS2px24 and SX28AC/DP.
When I run the demo program for the H48C using the basic stamp, the reference voltage is pretty at 2046.
I wrote the following program to allow me to step through things as completely as possible.
Two things:
1) The reference voltage is fairly steady at 3127. The X, Y and Z voltages are nearly steady at (though X will fluctuate slightly):
X = 3120
Y = 3131
Z = 3580
Why would the reference voltage be so much different on the SX28 compared to the BS? Shouldn't it be the same?
2) When I single step through the code, I get readings that come out like (hex) 7FF, 85F, 87F, 9FF. The last digit is always an F. If I run it at speed and break on the last line, I get the above numbers. What am I missing?
I'm an old man newbie and am not seeing what I am missing. Any help would be greatly appreciated.
Best,
Joss
LIST Q = 37
DEVICE SX28L, TURBO, STACKX, OSCHS2
IRC_CAL IRC_FAST
FREQ 50_000_000
RESET 0
Loop
setb rc.5 ;Preset CS High
mov !rc, #%00000110 ;Set rc.5 to output
clrb rc.5 ;Set CS Low
clrb rc.2 ;Set Data Pin low
mov !rc, #%00000010 ;Set Data Pin to output
clrb rc.1 ;Set Clock pin low
mov !rc, #%00000000 ;Set Clock pin to output
setb rc.2 ;Send %11
setb rc.1
clrb rc.1
setb rc.1
clrb rc.1
clrb rc.2 ;Send %011
setb rc.1
clrb rc.1
clrb rc.2
setb rc.1
clrb rc.1
clrb rc.2
setb rc.1
clrb rc.1
clrb rc.2 ;Set data bit low
;Shift in
mov !rc, #%00000100 ;Set data pin as input
clrb rc.1 ;Set clock low
mov !rc, #%00000100 ;Set clock pin as output
;Read thirteen bits back in
clr $0f
setb rc.1
clrb rc.1
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
clr $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0f
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.1
clrb rc.1
movb C, rc.2
rl $0e
setb rc.5 ;Set CS high to terminate the conversation
jmp Loop