Shop OBEX P1 Docs P2 Docs Learn Events
Using BANK 0 on the SX48 — Parallax Forums

Using BANK 0 on the SX48

rcarmelrcarmel Posts: 13
edited 2006-12-09 18:06 in General Discussion
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

Comments

  • BeanBean Posts: 8,129
    edited 2006-12-09 17:38
    Richard,
    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
    ·
  • rcarmelrcarmel Posts: 13
    edited 2006-12-09 17:55
    Bean,

    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
  • rcarmelrcarmel Posts: 13
    edited 2006-12-09 18:06
    Oh I think I get it... its saying that you cannot use the top 4 bits of FSR, and the bottom 4 bits of FR to access the global registers, but if you simply use direct addressing it will work. Sorry for the confusion.
    I was under the impression that once I had modified FSR, to 0, I could no longer use direct addressing...

    Richard
Sign In or Register to comment.