Shop OBEX P1 Docs P2 Docs Learn Events
Problem — Parallax Forums

Problem

Armored CarsArmored Cars Posts: 172
edited 2005-09-23 15:13 in General Discussion
device sx52,oschs1
device turbo,stackx,optionx
IRC_CAL IRC_SLOW
reset RSPO
freq 50_000_000
org8
fsrcounter·ds·1
rcounter·ds·1
loop1var·ds·1
drag··ds·1
dloop1var·ds·1
dloop2var·ds·1
dloop3var·ds·1
dloop4var·ds·1
;
RESET POINT ONLY
RSPO
mov·!ra,#0
mov·!re,#0
;
IDLE
mov·$30,#%10000000
mov·$31,#%01000000
mov·$32,#%00100000
mov·$33,#%00010000
IdleLoop
mov·loop1var,#4········· ;right here the program goes back to RSPO and just loops
clr·rcounter
mov·FSR,#$2F
loop1
call·xaxis
inc·FSR
mov·re,IND
call·delay
clr·re
djnz·loop1var,loop1
jmp·IdleLoop
xaxis
call·xtable
mov·ra,w
ret
xtable
mov·w,rcounter
jmp·pc+w
retw·%01110111
retw·%10111011
retw·%11011101
retw·%11101110
retw·0
retw·0

delay
ret


Right at
mov·loop1var,#4
the program goes back to the reset point.· I can't figure it out.

Comments

  • nick bernardnick bernard Posts: 329
    edited 2005-09-22 14:46
    i had the very same problem a few minutes ago! i left out the org line in a snippet i was working with;however, you just made it a label.

    change
    org8

    into
    org 8

    rox on pal

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • BeanBean Posts: 8,129
    edited 2005-09-22 14:48
    this is the problem: "org8" You need a space between ORG and the value, I think you meant ORG 8, but that is incorrect for the SX52 it should be "ORG $0A"

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-09-22 15:22
    Wait a second,

    Bean is right, suggesting an ORG $0A instead of an ORG 8 because addresses 8 and 9 are reserved for the two addional I/O ports (RD, RE) on the SX52. But this also means that you only have 6 bytes of free memory in the global RAM space, instead of the 8 bytes, your program defines.

    If you don't need ports RD and RE, simply configure both ports with all bits set for output. You may then use locations 8 and 9 as "regular" registers. I did this recently for testing a program designed for an SX20 on an SX52 Proto Board, and it worked as expected.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Armored CarsArmored Cars Posts: 172
    edited 2005-09-22 15:51
    Looking at the register map that makes sense.· All the instructional stuff is made for the SX28 and often I forget that the 52 is a competely different chip.·

    I do have another question though.· The register map (page 152 of the SX-Key Development System Manual) looks as if $00-$0F is the global, $10-$1F is bank 1, $20-$2F is bank 2 and ect.· From $10 on is general purpose memory.· For some reason I am thinking this is wrong because of the Exploring the SX Microcontroller book (I don't have it right now so I can't quote it).· It is something with the global that makes Bank 0 made up of$00-$0F (global) and $10-$1F (general purpose).· Bank 1 is made up of $20-$2F (global) and $30-3F (general) and so on.· Its a bit confusing and I'm not quite sure what is right.
  • BeanBean Posts: 8,129
    edited 2005-09-22 16:50
    What you would normally think of as "BANK 0" cannot be accessed using indirect addressing (FSR).
    You can only access that memory by setting FSR to 0 and using $10 thru $1F like:

    CLR FSR
    MOV $10,#$FF

    this code...

    MOV FSR,#$10
    MOV IND,#$FF

    will move the value into BANK 1 location 0

    and this code

    MOV FSR,#$0F
    MOV IND,#$FF

    will move the value into GLOBAL memory address $0F

    If you notice in the debugger there is no BANK 0 either...

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • Armored CarsArmored Cars Posts: 172
    edited 2005-09-23 12:55
    Forget bank 0. What about the rest of the banks? As far as I can tell all the even chunks (? I don't know what to call it.. just a group of registers that have the same tens digit ex: $40-$4F) are the global and all the odd #s are general purpose.

    The SX can only access 32 registers at one time. If you set FSR to $20 registers $10-$1F are different than if FSR was set to $40. $00-$0F is the same no matter what. Any register can be accessed by loading the location into FSR (ex: $37 or $5A). Registers can also be accessed by using the bank command (bank loop1var, clr loop1var)

    Somebody please correct me if I'm wrong.

    This brings up another question... What defines a bank? What is their signifigance?
  • BeanBean Posts: 8,129
    edited 2005-09-23 13:50
    A bank is just a 16 byte section of ram that can be accessed without changing banks.
    It's like a 16 byte window, that is moved using FSR or BANK.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • Armored CarsArmored Cars Posts: 172
    edited 2005-09-23 14:06
    Can FSR access single registers and if it does will it change the current bank?
  • BeanBean Posts: 8,129
    edited 2005-09-23 14:32
    Yes and Yes.
    All the BANK command does is set FSR.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012
    Product web site: www.sxvm.com
    Available now... SX-Video OSD module $59.95 www.sxvm.com

    "I'm a man, but I can change, if I have to, I guess"
    Red Green
    ·
  • Armored CarsArmored Cars Posts: 172
    edited 2005-09-23 15:13
    I've been looking at my program some more.· Got another question.

    In this example

    org $0A
    loop1var ds 1
    org 0
    mov FSR,#$30
    mov loop1var,#$FF
    inc FSR

    Does FSR now contain $0C or $31?

    Also if a bank is a 16 byte window does that mean $20-$FF is general purpose?· By that I mean FSR can be set to any of those numbers and everything will be general purpose regeisters.· Or do the global registers carry over to some of those?

    Sorry if this is frustrating you.· I just got noone to help me here (only one teacher here knows of assembly, but she took it in college and knows nothing of microcontrollers).· I am getting confused by the memory maps.· I attatched a pic of the two maps I have.
    1058 x 672 - 134K
    maps.JPG 134.2K
Sign In or Register to comment.