Hey, thanks for the encouraging words!

I FEEL lazy but, when I'm up at 4am for the n_th night in a row, I guess I'm either doing SOME work, or I'm obsessed ! [probably a bit of both].

Like your project - in fact I'm ordering a 18F4550 right now, so I can try it. I could convert parts of it I suppose, but hey, I need an excuse to buy another chip!

My irq code is here - don't be too hard on it ;-), I'm still playing with the numbers to see at what point it falls over.

I haven't yet fired up the calculator or the 'scope to do any formal timing tests...

What it does show is how superb picbasic is at allowing us to mix assembler and basic. I know I could have coded the led toggling with a couple of lines of assembler but I had great fun just dropping in and out of inline code type mixing [if that makes sense].

Onwards and upwards... [or, in my case, sideways!]

Thanks again.

Giulio


;===================================
asm
myint
movwf wsave ;save off relevant registers
swapf STATUS,w
clrf STATUS
movwf ssave
movf PCLATH,w
movwf psave

btfss PIR1,TMR1IF ;test for time1 irq
goto T0_IRQ ;no - go test for timer0
endasm
toggle portc.7 ;yes - flash led [too fast at these settings...]
USBService ;keep connection alive
asm
movlw .250 ;next interrupt
movwf TMR1L ;lo
movlw .210 ;next interrupt
movwf TMR1H ;hi
bcf PIR1,TMR1IF ;acknowledge timer1 interrupt
T0_IRQ
btfss INTCON,TMR0IF ;test for timer0 irq
goto pull ;no - clean up

movlw .0 ;yes set up next irq
movwf TMR0L
movlw .100
movwf TMR0H
bcf INTCON,TMR0IF
endasm
toggle portc.6 ;flash led
asm

pull ;clean up
movf psave,w ;pull registers
movwf PCLATH
swapf ssave,w
movwf STATUS
swapf wsave,f
swapf wsave,w
out
retfie ;done
endasm
;===================================