![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
How can i call a program that is in another assembly file. I mean; Our main program file in which we are working. Code: main movlw .255 movwf PORTB Call delay movlw .0 movwf PORTB call delay Goto $ - 6 End. Code: delay movlw 255 movwf i ;our variable i DecFSZ i, F Goto $ - 1 return | |
| |
| | #2 |
|
A simple option is to put them in an include file, and add it at the top of the program - but a more complicated (and better?) option is to use the linker - personally I never have, I'd sooner cut and paste my common subroutines in.
| |
| |
| | #3 |
|
Is there any subroutine of delay on any website??? __________________________________________________ _______________ /*Nigel Goodwin likes C complier for microcontrollers*/ /*Nigel Goodwin always use MPLABSIM simulator */ | |
| |
| | #4 | |
| Quote:
| ||
| |
| | #5 |
|
Ayne, When you find the delay code generator, could you post a link to it. I would like to have that. | |
| |
| | #6 | |
| Quote:
Here's the link! http://www.piclist.com/techref/picli...egen/delay.htm | ||
| |
| | #7 |
|
I thought if Ayne needs it and was off to find it, I could ask him for a link. He does not have to post it. I do not see where it has to do with anything but I will go find it later. I can find the PIClist site and wing the delay code generator part. ![]() I do stuff for others to help them out when they ask, if I can, and it was not like asking a lot. Sorry. I tought I would save time on something that I might use (sure I would try it and going full on PIC assembler and out of the BASIC) as well others might want it as well and be able to find it here from a link. By the tone, I take it PICList should be something I check though I still use BASIC? | |
| |
| | #8 |
|
Online version: http://www.piclist.com/techref/picli...egen/delay.htm or http://www.piclist.com/cgi-bin/delay.exe EDIT: Never found the Windows version. But that works for me. Last edited by mramos1; 16th January 2007 at 01:20 AM. | |
| |
| | #9 |
|
Here's a windows version - http://www.mnsi.net/~boucher/picloops.html | |
| |
| | #10 |
| Code: Delay X cycles (7-1030) exclusive (11 to 1034 cycles inclusive of call and return)
From Dwayne Reid
;10 bit delay routine providing 1 cycle resolution. Works with both 12 & 14 bit core PICs.
;Original idea from Mike Harrison. This version by Dwayne Reid
;
;enters with upper 8 bits of delay in DELAYU, lower 2 bits in bits 1,0 of DELAYL
;bits 7..2 in DELAYL can be used as flags for whatever purpose desired.
;returns with W destroyed
Delay10bit ;delay is 10 bit value + 7 cycles ( + call + return, if any)
incf DELAYU,F ;correct for dec & test instead of test & dec
Dly10bLoop
comf DELAYL,W ;invert LSBs
decfsz DELAYU,F
goto Dly10bLoop ;coarse delay to closest 4 cycles
andlw b'00000011'
addwf PCL,F
nop
nop
nop
I found this on the PICLIST. Code: ;bits 7..2 in DELAYL can be used as flags for whatever purpose desired. | |
| |
| | #11 |
|
Why not use the delay code generator there?, two of us have now posted direct links to it.
| |
| |
| | #12 | ||
| Quote:
Just like this Quote:
But the code generater creat a fix delay. | |||
| |
| | #13 |
|
Thank u..... Nigel Goodwin , gregmcc , mramos1....
| |
| |
| | #14 | |
| Quote:
| ||
| |
| | #15 |
|
Ayne. You can pick the range of delays times you need, say 1ms to 500ms (1/2 a second). I would make a 1ms delay via the online calc/delay generator. Then convert it to a subroutine you can CALL. Each time you call it you get about 1ms (there is some overhead). For 25ms make a loop to call it 25 times. MPLABS has a stopwatch you can time it with too. If you need 500ms, you can call another routine that you call 100msec and loop 5 times calling it. And of course 100msec: calls your 1ms subroutine 100 times. Hope that makes since. | |
| |
|
| Tags |
| call |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| PLL WITH PIC AND TSA5511 | savnik | Micro Controllers | 23 | 26th April 2009 08:50 PM |
| Problem with LCD code? | spondootre | Micro Controllers | 15 | 29th April 2008 10:15 AM |
| DS1302 with PIC16f877 program | RasCreationKing | Micro Controllers | 28 | 3rd May 2007 01:03 PM |
| patgen | ppcv | Micro Controllers | 8 | 19th January 2005 09:01 AM |
| ya | mari_69 | Micro Controllers | 4 | 7th June 2004 02:29 PM |