![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| 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 Mark[/code]
__________________ Muss es Sein? Es muss sein... | |
| |
| | (permalink) |
| Use the stopwatch in MPLAB to see how long your loop takes. | |
| |
| | (permalink) |
| Thanks Exo, didn't know the stopwatch existed. It performs as required. Cheers Mark
__________________ Muss es Sein? Es muss sein... | |
| |
| | (permalink) |
| is MPLAB v6.40 have stopwatch? | |
| |
| | (permalink) |
| 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... | |
| |