Mark Birks asked about simulating the SLEEP instruction on a 16C64 using MPLAB. He was trying to simulate the following: > LIST P=16C64 > > MOVLW 0 > TRIS 6 > OPTION > LOOP SLEEP > INCF 6,1 > GOTO LOOP > END This program should work fine on a 16C64 provided the watchdog is enabled. I only saw a couple of replies: M. Hagberg suggested that the program wouldn't work because SLEEP resets the processor - though that's what happens on 12-bit PICs it's not true for 14-bit PICs like the 16C64; J. Scholz mentioned that you really should change to page 1 to set the TRIS and OPTION registers but that's not really necessary as the TRIS and OPTION instructions do the same job even if they are not recommended by Microchip. To make things work: 1. Ensure MPLAB-SIM is simulating watchdog timeouts by selecting "Options|Processor Setup|Hardware" and checking the "WDT Break Enable" radio button. Now a watchdog timeout will happen every 18ms or so (as dictated by the OPTION value of 0 used in the program). 2. To see anything happen without having to wait forever choose a clock frequency such that only a few cycles occur per 18ms watchdog timeout period. To do this select "Window|Stopwatch" and set "Target Frequency" to 5 kHz (say). 3. Either display all registers or add PORTB to a watch window with "Window|New Watch Window". 4. Simulate using "Debug|Run|Animate". Hope that helps. David -- david.tait@man.ac.uk http://www.man.ac.uk/~mbhstdj