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

Slight Problem

Armored CarsArmored Cars Posts: 172
edited 2005-12-08 16:12 in General Discussion
Can't seem to mov w to rd.
Heres a pic of the problem:

First shot shows the retw command that loads w.

Second shows after the return command; w has the correct number.

Go one more step and rd is still 0, and rb and rc change for some strange reason.

Now, after making the pic I decided to look more into the rb/rc problem.· I didn't really need them but decided to check it out because it may be a clue to one of the other 100 holes in my program.· I looked back and found that I hadn't set rb or rc as an input or output.· I set them both as outputs and they stopped changing at the specific point in my code, but they still change all over the rest of the code.· They will go to some random number (usually around a mov command) and then switch back to zero.



The plot thickens....
I was writing this post and·friend comes in, I decided to show him the problem and...· it doesn't work.··rb/rc only change a coupe times on down the code.·

I decided to clear the memory with this code


device sx52,·OSC4MHZ
IRC_CAL·IRC_SLOW
reset·RSPO
freq 4_000_000

org $0
RSPO
mov·FSR,#$0A
loop
clr IND
inc FSR
cse·FSR,#$FF
jmp·loop
mov·FSR,#$FF
clr·IND
sleep


I went into the debugger, hit run.· Hit stop, clicked reset to check that the memory was cleared... and rb contains 11101111!
Ran it again and rb was cleared.

Help.· I'm lost.
2208 x 713 - 388K

Comments

  • BeanBean Posts: 8,129
    edited 2005-12-05 15:23
    Try using OSCXT2 instead of OSC4MHZ while debugging.
    Debugging doesn't like other clock sources.
    Also make sure that the ports are not getting set to input inadvertantly somewhere in the code.
    Bean.

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

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
  • Armored CarsArmored Cars Posts: 172
    edited 2005-12-06 14:54
    I changed the OSC4MHZ to OSCXT2, ran the debugger and it took three times to clear rb, rc and rd.

    I'm working as I'm trying to get this post togeather...· above problem confirmed again.

    Okay, something is definately wrong with the debugger here.· Cleared all memory and opened my main.. wait, cleared my memory first before checking this again, worked the first time this time... Now, back to running my main program.··
    Here are the first lines of my code, right below the reset point (RSPO).· I added the comments here for clarity and the dashes represent the extra lines represent the second part of the mov instruction as shown in the debugger.
    I clicked debug and the debugger screen came up.· rb-rd were still cleared, but they were red, as if they had just been changed.· Pushed step, and rb-rd turn to $FF.· Next step they cleared, then chaned to some random numbers.· After a few more steps re started to be affected also.· I clicked reset and every thing was cleared.· I never put anything in my program to clear any registers on reset.· I hit step and everything stayed cleared.· Clicked again and then rb-rd went to $FF.· Clicked hit set more and got the same pattern, more random numbers and add re in.· Clicked reset and everything cleared again.· This time it took three clicks until rb-rd were turned to $FF and the pattern repeated.



    RSPO
    mode·#$0F
    mov·!rd,#0······
    -
    mov·!re,#0······

    -

    mov·!rc,#0

    -


    I see three possibilities:
    A) The debugger is flawed
    B) The SX is flawed
    C) Random changes when dealing with modes is normal (rb and rc, as they should be, aren't touched the rest of the program so I see this as a possibility)

    I decided to try and resinstall the assembler before I posted this (elimnate the obvious first) to make your guys job a little easier but for some reason I cant get it to install.· confused.gif·····It looks·like it might take·awhile to get it installed so I decided to post anyways so if you guys can recognize it as B or C right off the bat it would save me some extra trouble and, even if not, it may alert you of a possible bug in the assemler itself.

    Oh well.· I'll be back with news of the re-install later.
  • BeanBean Posts: 8,129
    edited 2005-12-06 15:01
    Can you post the whole program that is giving you trouble.
    Bean.

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

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
  • Armored CarsArmored Cars Posts: 172
    edited 2005-12-08 13:49
    Okay, I reinstalled the program.· Didn't get rid of the problem.· I attatched·a screenshot of what comes up when I open the SX Key editor and a copy of the program (just a warning; it's really dirty.· You should wash your hands after leaving the computer.)
    641 x 337 - 38K
  • BeanBean Posts: 8,129
    edited 2005-12-08 14:12
    Just a quick look, I think there is a problem here:
    inc transFSR     
    mov w,distance
    add w,transFSR   ; 
    mov FSR,transFSR ; should this be "mov FSR,w" ?
    mov IND,temp
    bank temp_0
    
    

    Bean.


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

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
  • Armored CarsArmored Cars Posts: 172
    edited 2005-12-08 14:37
    Thats is a problem... but I think we have something much worse than that. The clearing program (first post) doesn't work either.

    First run (clear program)
    rb=$FF
    rc=1

    Second run
    rb=$FF
    rc=$FF
    rd=$B0

    Third-Fouth
    All clear

    Fifth, ect...
    rb=$FF
    rc=$FF

    I can sit and click the Reset button continuosly and watch rb-rd flash red.
    Maybe I'm missing something, but it sure doesn't look good to me.
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-12-08 14:48
    Armored Cars,

    concerning the error about COMDLG32.OCX, please check the "sticky" post concerning SXSim. There is a new version available for download that no longer requires COMDLG32.OCX.

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

    G
  • BeanBean Posts: 8,129
    edited 2005-12-08 15:15
    The clearing program you posted does NOT affect any of the ports (it starts at $0A).
    And even if it did start at RA the port would have to set to all outputs first.
    So if the port are inputs they will change randomly (If not connected to anything).
    Bean.

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

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
  • David BDavid B Posts: 592
    edited 2005-12-08 16:12
    For SX52, don't you need to apply the mode value somethng like this?

    mode52 macro 1
    expand
    mov w, #\1
    mov m, w
    noexpand
    endm

    David
Sign In or Register to comment.