Shop OBEX P1 Docs P2 Docs Learn Events
Using SXSim and the SX Multipurpose Timers — Parallax Forums

Using SXSim and the SX Multipurpose Timers

JDOhioJDOhio Posts: 72
edited 2006-03-23 01:12 in General Discussion
I have a simple program here to help me learn how to use the timers.· The intent of the program is to set up a port as outputs, set up a timer, and toggle the port when the timer overflows.· I am trying this SXSim but it never reaches my interrupt.· Even at divide by three at·4 MHz, I would expect to enter the interrupt at least once if I wait long enough.· Any ideas?

Joe



;
DEVICE DIRECTIVES
··DEVICE··SX48,OSC4MHZ
··IRC_CAL··IRC_4MHZ
··RESET··Main

;
CONSTANTS
T1CNTA··EQU·$17···;write T1 Control A
T1CNTB··EQU·$16···;write T1 Control B
;
DEBUG SETTINGS
··FREQ·4_000_000
;
INTERRUPT ROUTINE
··ORG·0
Interrupt
··mov·W,$05···;toggle LEDs
··xor·RA,W
··retiw

;
MAIN PROGRAM
Main
··mov·W,#$1f
··mov·M,W
··mov·W,#$00
··mov·!RA,W···;RA is all outputs
··mov·W,T1CNTA
··mov·M,W
··mov·W,#$01
··mov·!RB,W···;interrupt on overflow
··mov·W,T1CNTB
··mov·M,W···;set up to write timer 1 B
··mov·W,#$02···;divide by 1, capture/compare
··mov·!RB,W
··mov·W,#$03···;turn on LEDs
··mov·$05,W
loop:··jmp ·loop

Comments

  • BeanBean Posts: 8,129
    edited 2006-03-21 02:10
    I don't think SX-Sim supports the SX48 hardware timers.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012

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

    Product web site: www.sxvm.com

    "Sometimes it is better to remain silent and be thought a fool, than to speak and remove all doubt."
    ·
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-03-22 23:29
    JDOhio - Bean,

    unfortunately, Bean is right - the current version of SXSim does not support the hardware timers.

    This feature is no my TODO list since a while. but I fear that it'll take me more time before I can address that matter due to other "mouth-feeding" business. Nevertheless, I will not forget about it, so please be patient and stay tuned...

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

    G
  • JDOhioJDOhio Posts: 72
    edited 2006-03-23 01:12
    Thank you both! Appreciate the quick response. I saw that the RTCC is supported so I'll experiment there. SXSim is just too fun not to try something!

    Joe
Sign In or Register to comment.