Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Delay check...

Status
Not open for further replies.
I've modified a Delay loop (cheers Nigel!) to incorporate checking for a received byte in the USART every couple of uSeconds. I've modified the inner most iteration to take 10 uS to complete, and have tried to adjust the outer to comply with this. As i don't have the means to practically assess whether I've been accurate with the delay, I was hoping somebody could verify it for me? It's supposed to wait for a period of 250mS, doing the Byte checking thing continuously.

Code:
USERC
	MOVLW	D'250'
	MOVWF	COUNT1
STD3	
	MOVLW	0X63		;	do countA 99 times
	MOVWF	COUNTA
	MOVLW	0X01
	MOVWF	COUNTB
DELAY_3
	BTFSC	PIR1, RCIF	         ;	     if a byte received, call RECVUSER2
	CALL	RECVUSER2
	GOTO	$+1
	NOP
	DECFSZ	COUNTA, F
	GOTO	$+2
	DECFSZ  COUNTB,	F
	GOTO	DELAY_3

	GOTO	$+1
	GOTO	$+1
	DECFSZ	COUNT1,	F
	GOTO	STD3

Thanks in advance...

Mark[/code]
 
yes it does nenayd.

You need to have set MPLAB SIM, then select stopwatch in the debugger menu. You need to put the cursor at the start of thr routine you'd like to time, then right click and select "set PC to cursor". Then put the cursor at the end of the timed section, R/click and select "run to cursor". the stopwatch window will tell you how many instructions executed and how long it took. Don't forget to set the PIC configuration you're using so it uses the correct clocking freq.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top