![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
still trying to learn assembly If I'm thinking right this would loop until PORTA,1 is set but if I needed it to carry on if PORTA,1 does not set in say 20 sec. what would be the best way to do it in assembly BTFSC PORTA,1 GOTO AUNT NANCY'S GOTO $-2 GOTO UNCLE Bob'S something like this is how I would do it in Pic Basic Pro A VAR WORD For A= 0 TO 20000 '20 SEC. Pause 1 IF PORTA,1 =1 Then goto aunt Nancy's EndIF Next A goto uncle Bob's thanks to all | |
| |
| | #2 |
|
Hi, Labels need to be one word in assembler e.g. AUNT_NANCY'S, UNCLE_Bob'S. As for the time maybe something like; Code: BTFSC Timer1_done_bit ;has timer 1 timed out (overflowed)? GOTO UNCLE_Bob'S ;yes it has BTFSC PORTA,1 ;no it has not GOTO AUNT_NANCY'S GOTO $-4 UNCLE_Bob'S: bcf Timer1_done_bit ('Timer1_done' is a made up label) Last edited by Angry Badger; 12th February 2009 at 07:51 AM. Reason: Added code tags | |
| |
| | #3 |
|
You can do it pretty much the same as your basic program, Code: movlw high(.20000)+1 movwf CounterHi movlw low(.20000) movwf CounterLo WaitPortA call Delay1mS btfsc PORTA,1 goto Done decfsz CounterLo,F goto WaitPortA decfsz CounterHi,F goto WaitPortA Done nop Code: Delay1mS movlw .249 DelayLoop addlw .255 btfss STATUS,Z goto DelayLoop return Mike. | |
| |
| | #4 |
|
Thanks Guy just what the doctor ordered different people have to learn things different ways and hate to say it but I'm one of the one that has to do it on a "as need be bases" because tomorrow when I wake up I will have forgot not only how I did something BUT WHY I EVEN DID IT as always thanks | |
| |
|
| Tags |
| loop, time |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Continious time loop computer | Jarek Duda | Electronic Projects Design/Ideas/Reviews | 14 | 28th December 2008 09:49 PM |
| 555 timer (t= 13 minutes) On-time = Off-time | greenmeup | Electronic Projects Design/Ideas/Reviews | 11 | 12th September 2008 08:18 AM |
| MPLAB C18, Added a Nop() to loop, decreased execution time? | Fred.Amoson | Micro Controllers | 6 | 22nd April 2008 03:23 AM |
| FOR loop in C | eblc1388 | Micro Controllers | 12 | 10th January 2007 11:24 PM |
| Enquiry For Discrete Time Convolution & continuous time | shermaine | General Electronics Chat | 3 | 4th August 2004 09:25 PM |