Simulation Problem

Status
Not open for further replies.
i suppose it would depend on the type of switch
 
Hi, I have a similar problem -----
cant get out of delay loop with PIC simulator IDE - any help appreciated
Code:
---------------EQUATES----------------------
MCOUNT			EQU		0X0C			
NCOUNT			EQU		0X1D
--------------------------------------------------
;---------------------------------------DELAY--------------------------------------------------

DELAY			MOVLW	0XFF			;0.2S DELAY
				MOVWF	MCOUNT			;MOVING CONTENTS OF WORKING REGISTER TO MCOUNT
GET_N			MOVLW	0XFF			;LOAD WORKING REGISTER WITH VALUE
				MOVWF	NCOUNT			;MOVING CONTENTS OF WORKING REGISTER TO NCOUNT
DEC_N			DECFSZ	NCOUNT,F		;DECREMENT NCOUNT AND SKIP IF ZERO
				GOTO	DEC_N	
				DECFSZ	MCOUNT,F		;DECREMENT MCOUNT AND SKIP IF ZERO
				GOTO	GET_N
				RETURN



Thanks in advance
 
Are you sure you aren't waiting long enough.... This will take 65536 iterations.... even extremely fast simulation it will take a while... The REAL time at 4mhz is about 13 Seconds
 
Wait 2 seconds... Look at the "Actual time" on the sim.. That's the delay you want...
 
Just add a breakpoint after the delay loop. (Use a NOP, if necessary, but it usually isn't needed.) Then use "run" and you will hardly notice it is there. You can also comment out the delay, but I don't like doing that.

John
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…