Using BANK 0 on the SX48
rcarmel
Posts: 13
I'm trying to understand and access BANK 0 on the SX48.· This is how I understand it to work, please correct me if I'm wrong.
The top 4 bits of FSR are used to select a bank and the bottom 4 bits of FR with the 5 bit being set will give access to BANK 0 (if the top 4 bits of FSR are cleared).
According to the documentation, I should no longer·have access the global registers.· This seems to be accurate in terms of registers 0A - 0F, however, I'm still able to access the ports·RA - RE.·· Is this correct?· Or have I done something wrong?·
This is the code I'm using.
; Setup bank 0
clr fsr
; mov a value into the first file register
mov $10, #$ff
; Move a value in to port E
mov RE, #$FF
In the debugger I can see the value being moved into port E.· The debugger however·does not show·BANK 0;· Is this by design?· Difficult to tell if I'm accessing it, however when I read the values back, I can see them pass through W.
Thanks for any help
Richard Carmel
The top 4 bits of FSR are used to select a bank and the bottom 4 bits of FR with the 5 bit being set will give access to BANK 0 (if the top 4 bits of FSR are cleared).
According to the documentation, I should no longer·have access the global registers.· This seems to be accurate in terms of registers 0A - 0F, however, I'm still able to access the ports·RA - RE.·· Is this correct?· Or have I done something wrong?·
This is the code I'm using.
; Setup bank 0
clr fsr
; mov a value into the first file register
mov $10, #$ff
; Move a value in to port E
mov RE, #$FF
In the debugger I can see the value being moved into port E.· The debugger however·does not show·BANK 0;· Is this by design?· Difficult to tell if I'm accessing it, however when I read the values back, I can see them pass through W.
Thanks for any help
Richard Carmel
Comments
When FSR is zero and you use direct addressing (as you have in "MOV $10,#$FF") then you are accessing bank 0.
The global registers ($00 to $0F) are ALWAYS available no matter what FSR is set to.
The debugger doesn't show bank zero because it cannot be accessed using indirect addressing (FSR & IND).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
·
Thanks for your prompt reply.
Why is it I have 2 sources of documentation that clearly indicate that the global registers cannot be accessed while addressing bank 0?
Here is one source: http://forums.parallax.com/forums/default.aspx?f=7
Also page 206 of Programming the SX Microcontroller by Gunther Daubach clearly indicates that during semi-direct addressing banks 0 - F are addressable, but there is NO access to the global registers.
Richard
I was under the impression that once I had modified FSR, to 0, I could no longer use direct addressing...
Richard