Shop OBEX P1 Docs P2 Docs Learn Events
Timer Interrupt? — Parallax Forums

Timer Interrupt?

Right now, I'm sifting through our threads to find the interrupt discussion. Thought I bookmarked it, but apparently didn't.

Anyone testing this?

I'm starting to work on an interrupt frame work for a video signal.

Comments

  • SeairthSeairth Posts: 2,474
    edited 2015-10-16 00:39
    (typing on phone, so being brief...)

    Use ADDCNT to set the timer counter. Use WAITCNT to stall (SETQ with WC for timeout) or POLLCNT to poll.

    To set the ISR:

    mov ijmp1, #isr
    setint1 #1

    (Edit: corrected SETCNT to ADDCNT.)
  • potatohead wrote: »
    Right now, I'm sifting through our threads to find the interrupt discussion. Thought I bookmarked it, but apparently didn't.

    Anyone testing this?

    I'm starting to work on an interrupt frame work for a video signal.
    Same here. Can't seem to find any interrupt info. Search is frustrating.
    Hard to test without some clues to get started :(


  • I got it!

    This worked for me:
    dat
    		orgh	0
    
    
    		org
    		jmp	#init		'make sure to run in COG mode.
    
    init		getcnt	temp
    		addcnt	temp, ##$ffff		'set timer for lots of cycles
    		setint1 #%001		'set timer mode
    		mov	$1f4, #isr1	'set ISR address
    
    loop		setxdac	dwhite
    		jmp	#loop
    
    
    
    isr1		getcnt	temp
    		addcnt	temp, #100		'timer period
    		setxdac	dblank
    		reti1
    

    1632 x 918 - 461K
  • I don't think the getcnt in the ISR is needed.
  • potatohead wrote: »
    I don't think the getcnt in the ISR is needed.

    That depends on if you are setting the next interval from the beginning of the interrupt or not-the-beginning.

  • True. Just figured that out when playing with a few scenarios. It's like "mark time" then work from there.
  • Also, I would suggest seeing the ISR before setint1. And the assembler has predefined labels: ijmp1, ijmp2, ijmp3.
  • Didn't know about the labels. Of course, good call on the order of things.

    I've got enough to make a signal that should tolerate some pixel experiments now. :)

Sign In or Register to comment.