I think there is something wrong with my SX
Armored Cars
Posts: 172
When I run this program
··device··sx18,OSCRC
··device··turbo,stackx,optionx
··IRC_CAL··IRC_SLOW
··reset··start_point
··freq ··50_000_000
··org 0
start_point··· mov·!rb,#0
· ··············· mov·!rc,#0
················· clr·rb
················· clr·rc
··················sleep
only leds on rc.2 through rb.7 and rb.3 to rb.1 turn on.
I know that all of rb and rc should be 0 and should light a led when connected to VDD (they are all in the right way) but I can't get them to do anything.
··device··sx18,OSCRC
··device··turbo,stackx,optionx
··IRC_CAL··IRC_SLOW
··reset··start_point
··freq ··50_000_000
··org 0
start_point··· mov·!rb,#0
· ··············· mov·!rc,#0
················· clr·rb
················· clr·rc
··················sleep
only leds on rc.2 through rb.7 and rb.3 to rb.1 turn on.
I know that all of rb and rc should be 0 and should light a led when connected to VDD (they are all in the right way) but I can't get them to do anything.
Comments
· MOV · ·!RA, #0
· MOV ·· !RB, #0
· CLR·· ·RA
· CLR··· RB
Another point: the osc type (RC) doesn't match the speed you're requesting (50 MHz).· I think the upper end of RC is 4 MHz.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
device sx28,OSCRC
device turbo,stackx,optionx
IRC_CAL IRC_SLOW
reset start_point
freq 2_000_000
org 0
start_point mov !rb,#0
clr rb
sleep
The only problem is when I load the program the LED is very dim. When the reset button is hit the program restarts and the LED stays on. Whenever I turn the power off and turn it back on the LED does not come on at all even when hitting the reset button. When I take the SX Key out of the board and plug it back in the LED turns on at its normal brightness, but when the reset button is hit it goes off.
LED only comes on right after program is loaded or after SX key has been removed and replaced.
LED is very dull right after program is loaded.
Reset button only works right after the program was loaded.
Chip does not retain program after turned off, or at least it doesn't run it.
I have power from a 7.5v wall adaptor and the power led is always fully on (its not dim).
Try "GOTO $" instead of "SLEEP"
Try using a brownout option on the device line "BOR42" if using a +5V supply.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
·
"Upon reset, the MODE register is initialized to 0Fh for the SX18/20/28AC and SX18/20/28AC75 or to 1Fh for the SX48/52BD. This makes the port direction registers write-accessible to the "MOV !rx,W" instructions."
But I would not rely upon this behavior, explictly declare it: mov m,#$0F before the mov !rb, #0. Also try bean's suggestion (the assembly equivalent is "jmp $"), sleep causes the SX to go into powerdown mode, it probably shouldn't effect the behavior of the I/O pin's state, but test it to make sure. Also if the watchdog timer is enabled it could effect the behavior of your program, though theoretically it shouldn't. Lastly what is the value for the current limiting resistor your using? measure the voltage at the port pin, across the resistor, across the LED and the current flowing through the two, and report back your findings.
<EDIT> On further inspection of the users manual the mode is always intialized to $0F, the leads me to believe the core of your program is correct, that it is something to do with your external circuit, Is your diode in the correct polarity? Follow Gunther's first program example starting on page 17 of this document http://www.parallax.com/dl/docs/books/ProgSXExcerpt.pdf·and see if it works. </EDIT>
Post Edited (Paul Baker) : 3/13/2005 7:45:52 PM GMT
The only thing that worries me is when the power is turned off or the SX key is removed the chip looses its program. I can't figure out why this is happening.
My understanding is if you use RUN > RUN, it runs only from the SX Key.
To program the device to run stand alone, use RUN > PROGRAM
k
no matter in which mode you run an SX program - it is always executed in the chip (this is also true for the "Run- Run" mode). IOW, first, the program must be transferred into the SX-internal EEPROM. "Run-Run" means that the SX-Key supplies the clock for the SX.
After having tested a program on the SX with the debugger, it is important to "Run - Program" it before disconnecting the SX-Key and connecting the Resonator/Xtal, RC-Network, or using the SX-internal RC clock generator. It will not run "stand alone", when the debug version is still in the EEPROM as this contains additional code to communicate between the SX and the SX-Key.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G