Hallo!
Ich bin leider eine ziemliche niete in Assembler , daher schaff ich das
alleine nicht.
Ich würde gerne für meinen Mikrocontroller C Code diese Routine so
umschreiben , dass sie ein vielfaches von 78 timecycles anstelle von 100
delayt.
kann mir jemand helfen?
danke.
1 | #include "p18cxxx.inc"
|
2 |
|
3 | ;/**********************************************************************
|
4 | ;* Function Name: Delay100TCYx *
|
5 | ;* Return Value: void *
|
6 | ;* Parameters: unit: *
|
7 | ;* Description: This routine delays for multiples of 100 *
|
8 | ;* instruction cycles that is specified in unit. *
|
9 | ;* Special Note: This routine provides multiples of 100 Tcy. *
|
10 | ;* A value of 1 to 255 provides 100 to 25500 Tcy *
|
11 | ;* delay. A value of 0 will provide a delay of *
|
12 | ;* 25600 Tcy. *
|
13 | ;**********************************************************************/
|
14 | EXTERN DelayCounter1
|
15 |
|
16 | D100TCYXCODE CODE
|
17 |
|
18 | Delay100TCYx
|
19 | movlw 0xff
|
20 | movf PLUSW1,0
|
21 | movlb DelayCounter1
|
22 | movwf DelayCounter1
|
23 | movlw 0x1a
|
24 | bra $+2
|
25 | bra $+2
|
26 | bra D100_1
|
27 |
|
28 | D100x
|
29 | movlw 0x20
|
30 | D100_1
|
31 | movwf INDF1
|
32 | decfsz INDF1,1
|
33 | bra $-2
|
34 | decfsz DelayCounter1,1
|
35 | bra D100x
|
36 | bra $+2
|
37 | return
|
38 |
|
39 | GLOBAL Delay100TCYx
|
40 |
|
41 | END
|