T3STY
Full Member level 4
- Joined
- Apr 17, 2012
- Messages
- 239
- Helped
- 24
- Reputation
- 48
- Reaction score
- 24
- Trophy points
- 1,308
- Activity points
- 3,715
#DEFINE T0 0xFA ;250
#DEFINE T1 0xFA ;250
#DEFINE T2 0x40 ; 16
Delay
CBLOCK 0x0C
TIMER_0: 1
TIMER_1: 1
TIMER_2: 1
ENDC
MOVLW T0
MOVWF TIMER_0
MOVLW T1
MOVWF TIMER_1
MOVLW T2
MOVWF TIMER_2
loop_t0 ; 1ST loop
DECFSZ TIMER_0,f;
GOTO loop_t1 ; while not 0: go to loop_t1
RETURN ; else: the delay has finished, return from call
loop_t1
DECFSZ TIMER_1,f; 2ND loop
GOTO loop_t2 ; while not 0: go to loop_t2
MOVLW T1 ; else: restore value into TIMER_1
MOVWF TIMER_1 ; needed for any further loop
GOTO loop_t0 ; then go to loop_t0
loop_t2 ; 3RD loop
DECFSZ TIMER_2,f;
GOTO loop_t2 ; while not 0: DEC TIMER_2
MOVLW T2 ; else: restore value into TIMER_2
MOVWF TIMER_2 ; needed for any further loop
GOTO loop_t1 ; then go to loop_t1
END
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 PROCESSOR 16F84A RADIX DEC INCLUDE "P16F84A.INC" __CONFIG 0x3FF1 ORG 0x0C TIMER_0 RES 1 TIMER_1 RES 1 TIMER_2 RES 1 TIMER_3 RES 1 ORG 0x00 BANKSEL TRISA CLRF TRISA BANKSEL PORTA GOTO main Delay MACRO nCK ; TOT: 8 + 4 + 16*nCK MOVLW nCK & 0xFF ; 1 MOVWF TIMER_0 ; 1 MOVLW (nCK >> 0x0000FF) & 0xFF ; 1 MOVWF TIMER_1 ; 1 MOVLW (nCK >> 0x00FFFF) & 0xFF ; 1 MOVWF TIMER_2 ; 1 MOVLW (nCK >> 0xFFFFFF) & 0xFF ; 1 MOVWF TIMER_3 ; 1 CALL f_delay ; TOT: 4 + 16*nCK ENDM main BSF PORTA, 0 Delay 62499 BCF PORTA, 0 Delay 62499 GOTO main f_delay MOVLW 0x01 ; 1 SUBWF TIMER_0, f ; 1 BTFSC STATUS, C ; 1 SUBWF TIMER_1, f ; 1 BTFSC STATUS, C ; 1 SUBWF TIMER_2, f ; 1 BTFSC STATUS, C ; 1 SUBWF TIMER_3, f ; 1 CLRW ; 1 IORWF TIMER_0, W ; 1 IORWF TIMER_1, W ; 1 IORWF TIMER_2, W ; 1 IORWF TIMER_3, W ; 1 BTFSS STATUS, Z ; 1 GOTO f_delay ; 2 NOP ; 1 RETURN ; 2 END
----------------------------------------------------------------------
Release build of project `C:\Users\T3STY\Documents\MPLAB\ASMTest\ASMTest.mcp' started.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Sat Dec 15 18:53:01 2012
----------------------------------------------------------------------
Make: The target "C:\Users\T3STY\Documents\MPLAB\ASMTest\main.o" is out of date.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "main.asm" /l"main.lst" /e"main.err"
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 1 : Found directive in column 1. (PROCESSOR)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 2 : Found directive in column 1. (RADIX)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 3 : Found directive in column 1. (INCLUDE)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 4 : Found directive in column 1. (__CONFIG)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 6 : Found directive in column 1. (ORG)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 12 : Found directive in column 1. (ORG)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 13 : Found directive in column 1. (BANKSEL)
Warning[203] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 14 : Found opcode in column 1. (CLRF)
Message[302] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 14 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 15 : Found directive in column 1. (BANKSEL)
Warning[203] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 17 : Found opcode in column 1. (GOTO)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 30 : Found directive in column 1. (ENDM)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 27 : Overwriting previous address contents (000C)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 27 : Overwriting previous address contents (000C)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 29 : Overwriting previous address contents (000D)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 29 : Overwriting previous address contents (000D)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 35 : Overwriting previous address contents (000E)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 35 : Overwriting previous address contents (000E)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 20 : Overwriting previous address contents (000F)
Error[118] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 20 : Overwriting previous address contents (000F)
Warning[203] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 37 : Found opcode in column 1. (GOTO)
Warning[203] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 63 : Found opcode in column 1. (RETURN)
Warning[205] C:\USERS\T3STY\DOCUMENTS\MPLAB\ASMTEST\MAIN.ASM 65 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Release build of project `C:\Users\T3STY\Documents\MPLAB\ASMTest\ASMTest.mcp' failed.
Language tool versions: MPASMWIN.exe v5.44, mplink.exe v4.42, mplib.exe v4.42
Sat Dec 15 18:53:02 2012
----------------------------------------------------------------------
BUILD FAILED
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?