Hi Mike, > I am having difficulty getting MPSim in MPLab to detect that tmr0 on > a C84 has overflowed. I'm not using interrupt, just polling the bit, > but it never detects the bit change, even though it works in the > part itself. Been playing with exactly the same things the whole weekend. I have not used it with the prescaler yet but you must keep an eye on the interaction between the cwdt command and the prescaler, there may be some incorect mutual effects there. You have used the wrong flag. > ; now set up rtcc to count out every 5 ms > bsf sts, rp0 > movlw b'10000100' ; assign ps to rtcc > movwf OptReg ; ps = 32 > bcf sts, rp0 > movlw .94 > movwf RTCC > > > ; Main loop is here > > mainloop > > btfss intcon, rtif > goto mainloop ;loop until rollover occurs > > bsf port_A, 0 > call ServiceRTCC > bcf port_A, 0 > goto mainloop > > > ServiceRTCC > movlw Tmr5ms ; re-initialise the timer > movwf rtcc > bcf intcon, rtif > > ; do other stuff > > return The rtif is used for the port B0 interrupt (selectable edge polarity in OPTION register) and th T0IF is used for the timer 0 overflow flag. BitLoop btfss INTCON, T0IF ; spin on bit counter goto BitLoop The above works fine. Cheers -- Kalle Pihlajasaari kalle@data.co.za Interface Products Box 15775, Doornfontein, 2028, South Africa +27 (11) 402-7750 Fax: +27 (11) 402-7751