Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 29th March 2004, 11:47 AM   (permalink)
Default Delay check...

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]
__________________
Muss es Sein? Es muss sein...
Mark Lazarides is offline  
Old 29th March 2004, 02:05 PM   (permalink)
Default

Use the stopwatch in MPLAB to see how long your loop takes.
Exo is offline  
Old 29th March 2004, 02:43 PM   (permalink)
Default

Thanks Exo, didn't know the stopwatch existed. It performs as required.

Cheers

Mark
__________________
Muss es Sein? Es muss sein...
Mark Lazarides is offline  
Old 31st March 2004, 05:20 PM   (permalink)
Default stop watch

is MPLAB v6.40 have stopwatch?
nenayd is offline  
Old 1st April 2004, 09:03 AM   (permalink)
Default

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.
__________________
Muss es Sein? Es muss sein...
Mark Lazarides is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 05:35 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker