Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Password door lock using pic16f877a, using assembly

Status
Not open for further replies.

makemelearn

New Member
Hello guys. I'm new in learning microcontroller. I just got an assignment which i have made all the draft of. But I cannot build the code its again and again showing building failed. I'm attached the code and errors kindly help me urgently. It's due on friday. Thankyou so much.




;pic16f877a
list p=16F877A
#include <p16F877A.inc>
------------------------------------
;declaring variables

STATUS0 equ 09h
STATUS1 equ 29h
STATUS2 equ 39h
STATUS3 equ 49h

PORTA equ 63h
TRISA equ 93h
PORTB equ 68h
TRISB equ 52h

c1 equ 19h
c2 equ 69h
c3 equ 37h
-------------------------------------

; Initializing subroutines
; subrotine to change banks

bank0 BCF STATUS0,2 ;PORTA
BCF STATUS0,3

bank1 BCF STATUS1,2 ;TRISA
BSF STATUS1,3

bank2 BSF STATUS2,2 ;TRISB
BCF STATUS2,3

bank3 BSF STATUS3,2 ;PORTB
BSF STATUS3,3
-------------------------------------

; defining inputs and outputs
call bank1 ; calling bank in which TRISA is present
BSF TRISA ; setting inputs on all pins of TRISA

call bank2 ; calling bank in which TRISB is present
BSF TRISB,0 ; setting input on pin0 of TRISB
BCF TRISB,2 ; setting output on pin2 of TRISB
BCF TRISB,5 ; setting output on pin5 of TRISB

--------------------------------------

; subroutine to call Alarm
Alarm call bank3
BSF PORTB,2
call delay_2sec
goto MAIN

-------------------------------------

; subroutine to call motor
motor call bank3
BSF PORTB,5
call delay_3sec

-------------------------------------
; subroutine for 2 seconds delay

delay_2sec MOVLW d'80' ; adding value of 80 in decimals to the working register
MOVWF c3 ; adding the stored value into Wreg

loop3 MOVLW d'200'
MOVWF c2

loop2 MOVLW d'250'
MOVWF c1

loop nop
nop
decfsz c1,1
goto loop

decfsz c2,1
goto loop2

decfsz c3,1
goto loop3

return
-------------------------------------
; subroutine for 3 second delay

delay_3sec MOVLW d'120'
MOVWF c3

loop3 MOVLW d'200'
MOVWF c2

loop2 MOVLW d'250'
MOVWF c1

loop nop
nop
decfsz c1,1
goto loop

decfsz c2,1
goto loop2

decfsz c3,1
goto loop3

return
-------------------------------------------
; subroutine for entering password for user

enter_password call bank3 ; call bank in which PORTB is present
BTFSS PORTB,0 ; check if B0 is set, if skip next instruction
call alarm ; perform this instruction if B0 is not set
BTFSS PORTB,0 ; check if B0 is set, if yes then skip next instruction
call alarm ; call alarm if B0 is not set

call bank0 ; call bank in which PORTA is present
BTFSS PORTA,1 ; check 3rd digit
call alarm ; call alarm if digit not correct
BTFSS PORTA,4 ; check fourth ddigit
call alarm ; call alarm if digit not correct
BTFSS PORTA,4 ; check fifth digit
call alarm ; call alarm if digit is not correct
BTFSS PORTA,5 ; check sixth digit
call alarm ; call alarm if digit not correct
BTFSS PORTA,5 ; check seventh digit
call alarm ; call alarm if digit not correct
BTFSS PORTA,6 ; check eight digit
call alarm ; call alarm if digit not correct
BTFSS PORTA,0 ; check ninth digit
call alarm ; call alarm if digit not correct
BTFSS PORTA,2 ; check tenth digit
call alarm ;call alarm if digit not correct
goto MAIN
--------------------------------
; MAIN functions to be performed in the program
MAINcall enter_password ; call the subroutine and check the password
call motor ; if password correct on motor
goto enter password ; user able to enter password again
goto MAIN ; endless loop
END ; end of programme


Errors that im getting

Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 4 : Missing symbol
Error[115] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 12 : Duplicate label ("PORTA" or redefining symbol that cannot be redefined)
Error[115] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 13 : Duplicate label ("TRISA" or redefining symbol that cannot be redefined)
Error[115] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 14 : Duplicate label ("PORTB" or redefining symbol that cannot be redefined)
Error[115] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 15 : Duplicate label ("TRISB" or redefining symbol that cannot be redefined)
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 20 : Missing symbol
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 25 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 25 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 26 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 28 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 28 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 29 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 31 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 31 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 32 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 34 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 34 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 35 : Executable code and data must be defined in an appropriate section
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 36 : Missing symbol
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 39 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 39 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 40 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[128] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 40 : Missing argument(s)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 40 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 42 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 42 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 43 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 43 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 44 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 44 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 45 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 45 : Executable code and data must be defined in an appropriate section
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 47 : Missing symbol
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 50 : Labels must be defined in a code or data section when making an object file
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 50 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 50 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 51 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 52 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 52 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 53 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 53 : Executable code and data must be defined in an appropriate section
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 55 : Missing symbol
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 58 : Labels must be defined in a code or data section when making an object file
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 58 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 58 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 59 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 60 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 60 : Executable code and data must be defined in an appropriate section
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 62 : Missing symbol
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 65 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 65 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 66 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 68 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 68 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 69 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 71 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 71 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 72 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 74 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 74 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 75 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 76 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 77 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 77 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 79 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 80 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 80 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 82 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 83 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 83 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 85 : Executable code and data must be defined in an appropriate section
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 86 : Missing symbol
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 89 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 89 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 90 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 92 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 92 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 93 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 95 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 95 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 96 : Executable code and data must be defined in an appropriate section
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 98 : Labels must be defined in a code or data section when making an object file
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 98 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 99 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 100 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 101 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 101 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 103 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 104 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 104 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 106 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 107 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 107 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 109 : Executable code and data must be defined in an appropriate section
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 110 : Missing symbol
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 113 : Labels must be defined in a code or data section when making an object file
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 113 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 113 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 114 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 115 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 115 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 116 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 117 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 117 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 119 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 119 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 120 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 121 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 121 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 122 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 123 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 123 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 124 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 125 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 125 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 126 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 127 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 127 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 128 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 129 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 129 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 130 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 131 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 131 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 132 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 133 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 133 : Executable code and data must be defined in an appropriate section
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 134 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 135 : Symbol not previously defined (alarm)
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 135 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 136 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 136 : Executable code and data must be defined in an appropriate section
Error[111] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 137 : Missing symbol
Warning[207] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 139 : Found label after column 1. (MAIN)
Error[150] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 139 : Labels must be defined in a code or data section when making an object file
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 139 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 139 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 140 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 140 : Executable code and data must be defined in an appropriate section
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 141 : Symbol not previously defined (enter)
Error[113] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 141 : Symbol not previously defined (password)
Error[112] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 141 : Missing operator
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 141 : Executable code and data must be defined in an appropriate section
Error[151] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 142 : Operand contains unresolvable labels or is too complex
Error[152] C:\USERS\HP\DESKTOP\PASWORD_LOCK\ASSIGNMENT1.ASM 142 : Executable code and data must be defined in an appropriate section
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Users\HP\Desktop\pasword_lock\password_lock.mcp' failed.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Preprocessor symbol `__DEBUG' is defined.
Wed Mar 23 21:20:14 2022
----------------------------------------------------------------------
BUILD FAILED
 
All those errors (and maybe warnings) are for you to correct or adjust something.

The soon you start, the better.
 
Each error message contains a line number.

First error is at line 4
The error message is misleading, but examine line 4 and you should spot a glaring error.

fix line 4 and every similar line

Second error should then become the first error in the list
Second error is at line 12. The error message is this time clear and accurate. You have already defined PORTA in your include file. Delete line 12, you do not need it.

Always look at the first error in the list - or maybe first few errors. fixing one early error might also fix many later errors
 
Each error message contains a line number.

First error is at line 4
The error message is misleading, but examine line 4 and you should spot a glaring error.

fix line 4 and every similar line

Second error should then become the first error in the list
Second error is at line 12. The error message is this time clear and accurate. You have already defined PORTA in your include file. Delete line 12, you do not need it.

Always look at the first error in the list - or maybe first few errors. fixing one early error might also fix many later errors
Can you please tell what exactly is the error. Is it indentation or spelling. I'm sorry but I'm totally new to the synatx
 
------- is not a valid assembly instruction and it is not a valid compiler command

change --------
to ; -----------
semicolon for a comment
 
no symbol is missing

Do not take error messages too seriously. Some times the message is helpful, sometimes not
The assembler simply cannot make any sense of ------ and has to make a guess at what you intended to do.
The assembler has no understanding of what you intended to do, so often it guesses completely wrong, as in this case
 
Last edited:
If you INCLUDE the the .inc file as Max suggests in post #2 you don't need to define the the addresses of registers as this is what the .inc file does.
This is the line I used in a program using a PIC16F677A
#include <p16f877A.inc>

Your subroutines for bank selection will not work as they do not end with a RETURN instruction.
There are other ways to do this.
You could write a macro to do it.
Here is an example of the macro. This code includes the macro up to the first time the macro is used.

Code:
;******************************************************************************************
        LIST    P=PIC12F1822,ST=OFF,R=DEC
        INCLUDE  "P12F1822.inc"

        __CONFIG _CONFIG1,  _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF &  _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF


        __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_HI & _LVP_OFF

;*******************************************************************************
; Constants
;*******************************************************************************


RAM_START       equ     0x20


; The periods are timed with timer1 which is set to run at the internal clock
; rate (4 Mhz) of Fosc/4 or 1.0MHz which is equal to a 1 uS period.




DELAY_18MS    equ    D'8993'     ;Value to give delay of 18 mS = 0x2321



;SDELAY_18_75uS    equ    D'25'
;SDELAY_84uS    equ    D'112'




;*******************************************************************************
; Pin Assignments
;*******************************************************************************
;
;    PIC signals
;
    #DEFINE        TX_Data        PORTA, 0        ;
    #DEFINE        RX_Data        PORTA, 1        ;
;
    #DEFINE        DHT22_Pin    PORTA, 2        ;


; I/O pin use
;    RA0    TX                        (Pin 7)         (To pin 4 on programmer connection)
;    RA1    RX                (Pin 6)         (To pin 5 on programmer connection)
;    RA2    DHR22 data             (Pin 5)
;    RA3    Trigger button       (Pin 4)    NOTE THIS PIN CAN ONLY BE USED AS AN INPUT.   Use for push button to trigger a read of the DHT22
;                     (This is VPP for programming This could be connected to pin 3 or 5 of the header to program the chip on header.)
;    RA4    Not used              (Pin 3)
;    RA5                        (Pin 2)




;  Define GENERAL PURPOSE RAM AREA (80 bytes maximum)

;*******************************************************************************
; File Register Variables
;*******************************************************************************
        cblock  RAM_START

param1:    1          ; parameter 1    (Used in delay cycles routine)
param2:    1          ; parameter 2    (Used in delay cycles routine)
Temp_1:    1        ;Used in 2 second delay

tmpData:    1        ; Used in output_hexbyte routine

; delay counters

    d30us0:     1

    d40us0:     1
      
DHT_Data0:    1    ; 40 bit value from DHT
DHT_Data1:    1    ; 0 & 1 Humidity
DHT_Data2:    1    ; 2 & 3 Temperature Bit 7 of byte 2 is sign bit (Set for negative.)
DHT_Data3:    1
DHT_Data4:    1    ; Byte 4 is the checksum

; bit counter
    bitcnt:     1
; byte counter
    bytcnt:     1

ESEVN:    1        ; 10 000,000 (digit 8)
ESIX:    1        ; 1000,000s (digit 7 )
EFIVE:    1        ; 100,000s digit 6 store
EFOUR:    1        ; 10,000s digit 5 store
ETHREE:    1        ; 1000s digit 4 store (kHz)
ETWO:    1        ; 100s digit 3 store
EONE:    1        ; 10s digit 2 store
EZERO:    1        ; 1's digit 1 store (Hz)

REG_C:    1
REG_B:    1
REG_A:    1

COUNT:    1

BCD1:    1        ; overrange
BCD2:    1        ; MS decimal value
BCD3:    1        ;
BCD4:    1        ; decimal value
BCD5:    1        ; ls decimal value
  
BIN1:    1        ; LS binary value
BIN2:    1        ;
BIN3:    1        ;
BIN4:    1        ; MS binary value

TEMP:    1


        endc
;*******************************************************************************
; Common RAM (0x70 to 0x7F)
;*******************************************************************************

TX_temp        EQU 0x70        ;Temporary storage for character to be transmitted.

;*******************************************************************************
;  Define Macro     Takes 2 uS
;*******************************************************************************
SELBANK MACRO   #BANK_NO
        MOVLW   #BANK_NO    ;1 cycle - 1 uS
        MOVWF   BSR        ;1 cycle - 1 uS
        ENDM


; *****************************

        ORG     0h
        GOTO    START
        ORG     4h
        GOTO    START
START
; *****************************
;   Initialized Segment
; *****************************
; Initialise OSC (4MHz, IntOSC)
        SELBANK 1               ; SET BANK1
        MOVLW   B'11101010'     
        MOVWF   OSCCON

    BCF    INTCON,GIE

; Initialise I/O port
        SELBANK 1               ; SET BANK1
        MOVLW   B'00010010'        ; Bits 0, output Bit 1, 3, 4 input. Bit 2 Initialy an output but changed during DHT data read.
        MOVWF   TRISA

;Set pullup on PORTA,4

    BCF    OPTION_REG,NOT_WPUEN

          SELBANK 4               ; SET BANK 4
    MOVLW    B'00010000'
    MOVWF    WPUA

           SELBANK 3               ; SET BANK 3
    MOVLW    0x00
    MOVWF    ANSELA        ; All I/O set to digital

If you do a search for "macro" (Without the inverted commas.) you will see where it is defined and used.

Yet another way is to use the banksel directive

[code}
banksel OSCCON

MOVLW B'11101010' ;Value for 4 Mhz
MOVWF OSCCON
[/code]

You just follow the banksel directive with the name of the register you are about to use. You don't need to look up which bank the register is in.
EDIT. I have just noticed that the example macro is for a PIC with a bank select register.
You will have to put the bit set and bit clear for the status register in your macro.
You will have to have a different macro for each bank as you can't pass the bank number as a parameter as it can't
just be loaded into the status register in the same way as it can to the BSR.
Les.
 
Last edited:
If you INCLUDE the the .inc file as Max suggests in post #2 you don't need to define the the addresses of registers as this is what the .inc file does.
This is the line I used in a program using a PIC16F677A
#include <p16f877A.inc>

Your subroutines for bank selection will not work as they do not end with a RETURN instruction.
There are other ways to do this.
You could write a macro to do it.
Here is an example of the macro. This code includes the macro up to the first time the macro is used.

Code:
;******************************************************************************************
        LIST    P=PIC12F1822,ST=OFF,R=DEC
        INCLUDE  "P12F1822.inc"

        __CONFIG _CONFIG1,  _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF &  _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF


        __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_HI & _LVP_OFF

;*******************************************************************************
; Constants
;*******************************************************************************


RAM_START       equ     0x20


; The periods are timed with timer1 which is set to run at the internal clock
; rate (4 Mhz) of Fosc/4 or 1.0MHz which is equal to a 1 uS period.




DELAY_18MS    equ    D'8993'     ;Value to give delay of 18 mS = 0x2321



;SDELAY_18_75uS    equ    D'25'
;SDELAY_84uS    equ    D'112'




;*******************************************************************************
; Pin Assignments
;*******************************************************************************
;
;    PIC signals
;
    #DEFINE        TX_Data        PORTA, 0        ;
    #DEFINE        RX_Data        PORTA, 1        ;
;
    #DEFINE        DHT22_Pin    PORTA, 2        ;


; I/O pin use
;    RA0    TX                        (Pin 7)         (To pin 4 on programmer connection)
;    RA1    RX                (Pin 6)         (To pin 5 on programmer connection)
;    RA2    DHR22 data             (Pin 5)
;    RA3    Trigger button       (Pin 4)    NOTE THIS PIN CAN ONLY BE USED AS AN INPUT.   Use for push button to trigger a read of the DHT22
;                     (This is VPP for programming This could be connected to pin 3 or 5 of the header to program the chip on header.)
;    RA4    Not used              (Pin 3)
;    RA5                        (Pin 2)




;  Define GENERAL PURPOSE RAM AREA (80 bytes maximum)

;*******************************************************************************
; File Register Variables
;*******************************************************************************
        cblock  RAM_START

param1:    1          ; parameter 1    (Used in delay cycles routine)
param2:    1          ; parameter 2    (Used in delay cycles routine)
Temp_1:    1        ;Used in 2 second delay

tmpData:    1        ; Used in output_hexbyte routine

; delay counters

    d30us0:     1

    d40us0:     1
       
DHT_Data0:    1    ; 40 bit value from DHT
DHT_Data1:    1    ; 0 & 1 Humidity
DHT_Data2:    1    ; 2 & 3 Temperature Bit 7 of byte 2 is sign bit (Set for negative.)
DHT_Data3:    1
DHT_Data4:    1    ; Byte 4 is the checksum

; bit counter
    bitcnt:     1
; byte counter
    bytcnt:     1

ESEVN:    1        ; 10 000,000 (digit 8)
ESIX:    1        ; 1000,000s (digit 7 )
EFIVE:    1        ; 100,000s digit 6 store
EFOUR:    1        ; 10,000s digit 5 store
ETHREE:    1        ; 1000s digit 4 store (kHz)
ETWO:    1        ; 100s digit 3 store
EONE:    1        ; 10s digit 2 store
EZERO:    1        ; 1's digit 1 store (Hz)

REG_C:    1
REG_B:    1
REG_A:    1

COUNT:    1

BCD1:    1        ; overrange
BCD2:    1        ; MS decimal value
BCD3:    1        ;
BCD4:    1        ; decimal value
BCD5:    1        ; ls decimal value
   
BIN1:    1        ; LS binary value
BIN2:    1        ;
BIN3:    1        ;
BIN4:    1        ; MS binary value

TEMP:    1


        endc
;*******************************************************************************
; Common RAM (0x70 to 0x7F)
;*******************************************************************************

TX_temp        EQU 0x70        ;Temporary storage for character to be transmitted.

;*******************************************************************************
;  Define Macro     Takes 2 uS
;*******************************************************************************
SELBANK MACRO   #BANK_NO
        MOVLW   #BANK_NO    ;1 cycle - 1 uS
        MOVWF   BSR        ;1 cycle - 1 uS
        ENDM


; *****************************

        ORG     0h
        GOTO    START
        ORG     4h
        GOTO    START
START
; *****************************
;   Initialized Segment
; *****************************
; Initialise OSC (4MHz, IntOSC)
        SELBANK 1               ; SET BANK1
        MOVLW   B'11101010'      
        MOVWF   OSCCON

    BCF    INTCON,GIE

; Initialise I/O port
        SELBANK 1               ; SET BANK1
        MOVLW   B'00010010'        ; Bits 0, output Bit 1, 3, 4 input. Bit 2 Initialy an output but changed during DHT data read.
        MOVWF   TRISA

;Set pullup on PORTA,4

    BCF    OPTION_REG,NOT_WPUEN

          SELBANK 4               ; SET BANK 4
    MOVLW    B'00010000'
    MOVWF    WPUA

           SELBANK 3               ; SET BANK 3
    MOVLW    0x00
    MOVWF    ANSELA        ; All I/O set to digital

If you do a search for "macro" (Without the inverted commas.) you will see where it is defined and used.

Yet another way is to use the banksel directive

[code}
banksel OSCCON

MOVLW B'11101010' ;Value for 4 Mhz
MOVWF OSCCON
[/code]

You just follow the banksel directive with the name of the register you are about to use. You don't need to look up which bank the register is in.

Les.
Thankyou so much for your reply. If i write return ti the subroutines would it be of help. And if i only use banksel irrespective of using subroutines for bank switching. Would it be good enough. As i Don't know what micro is Don't know how it works like
 
If you download the Micro Chip User guide for the Assembler ( DS33014H).
You can look up the Error number flagged and see the description.
Section: Errors, Warnings, Messages and Limitations.
 
You will find details of using macroes and the banksel directive in the documentation that Max has pointed out in post #14.
Your "Duplicate label ("PORTA" or redefining symbol that cannot be redefined)" error id because PORTA has already been defined in the .inc file.

Les.
 
You have many lines consisting of --------------. This isn't valid, remove them all. Your subroutines should always end with return and never goto.

Mike.
 
You will find details of using macroes and the banksel directive in the documentation that Max has pointed out in post #14.
Your "Duplicate label ("PORTA" or redefining symbol that cannot be redefined)" error id because PORTA has already been defined in the .inc file.

Les.
So should i remove only porta or even statuses and other tris
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top