Slight Problem
Armored Cars
Posts: 172
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.
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.
Comments
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.
·
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
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.· ·····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.
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.
·
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.
·
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.
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
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.
·
mode52 macro 1
expand
mov w, #\1
mov m, w
noexpand
endm
David