Please look at the code below. Help me to fix the problem. This code is taken from your website. I just use my MPLAB IDE v8.3, I use MPASM Assembler toolsuite and once after I 'Build All' to assemble the code I got this error:
----------------------------------------------------------------------
Debug build of project `C:\Users\ISMI\Desktop\EC501\LAB3.mcp' started.
Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01
Preprocessor symbol `__DEBUG' is defined.
Tue Mar 05 00:23:48 2013
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Users\ISMI\Desktop\EC501\P1_1.o".
Clean: Deleted file "C:\Users\ISMI\Desktop\EC501\P1_1.err".
Clean: Deleted file "C:\Users\ISMI\Desktop\EC501\P1_1.lst".
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F4550 "C:\Users\ISMI\Downloads\PR1 MPLABX\PR1 MPLABX\PR1_1 MPLABX\P1_1.asm" /l"P1_1.lst" /e"P1_1.err" /o"P1_1.o" /d__DEBUG=1
Warning[207] C:\USERS\ISMI\DOWNLOADS\PR1 MPLABX\PR1 MPLABX\PR1_1 MPLABX\P1_1.ASM 76 : Found label after column 1. (D1)
Warning[207] C:\USERS\ISMI\DOWNLOADS\PR1 MPLABX\PR1 MPLABX\PR1_1 MPLABX\P1_1.ASM 77 : Found label after column 1. (D2)
Warning[207] C:\USERS\ISMI\DOWNLOADS\PR1 MPLABX\PR1 MPLABX\PR1_1 MPLABX\P1_1.ASM 78 : Found label after column 1. (D3)
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe" /p18F4550 "P1_1.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"LAB3.cof" /M"LAB3.map" /W
MPLINK 4.30.01, Linker
Copyright (c) 2009 Microchip Technology Inc.
Error - file './P1_1.o', section '.org_0', Symbol '_.org_0_0056' is not word-aligned.
It can not be used as the target of a call or goto instruction.
Errors : 1
Link step failed.
----------------------------------------------------------------------
Debug build of project `C:\Users\ISMI\Desktop\EC501\LAB3.mcp' failed.
Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01
Preprocessor symbol `__DEBUG' is defined.
Tue Mar 05 00:23:49 2013
----------------------------------------------------------------------
BUILD FAILED
- CODE: SELECT_ALL_CODE
;==========================================================================================
;
; Author : Cytron Technologies
; Project : DIY Project
; Project Descrription : PR1 (LED Blinking)
; Date : 25 May 2009
;
;===========================================================================================
;===========================================================================================
; Project Description
;===========================================================================================
; This file is a basic code template for assembly code generation on the PICmicro PIC16F84A.
; This file contains the basic code building blocks to build upon.
;
; If interrupts are not used all code presented between the ORG 0x004 directive and the
; label main can be removed. In addition the variable assignments for 'w_temp' and
; 'status_temp' can be removed.
;
; Refer to the MPASM User's Guide for additional information on
; features of the assembler (Document DS33014).
;
; Refer to the respective PICmicro data sheet for additional
; information on the instruction set.
;
;=============================================================================================
;
;
; Files required:
;
;
;==============================================================================================
;
; Notes:
; 1. For beginner, the parts that you need to edit are: BANK, TRIS, PORT, DELAY
; 2. All the general I/O pin only can use as input or output with the prior setting at TRIS.
; 3. Let say in this case, we use pin 1,2 and 3 (RA2, RA3, RA4) as input and pin 10,11,12 (RB4, RB5, RB6) as output. So, we must
; set TRISA,2 TRISA,3 TRISA,4 to '1' and TRISB,4 TRISB,5 TRISB,6 to '0'(in assembly, set '1' we use BSF, set '0' we use BCF
; which we can write in this way:
; BSF TRISA,2
; BSF TRISA,3
; BSF TRISA,4
;
; BCF TRISB,4
; BCF TRISB,5
; BCF TRISB,6
; 4. But, pls remember that before you can change TRISA, you need to switch from BANK0 to BANK1, then switch back to BANK0 after
; setting the TRISA.BANK0 is used to control the actual operation of the PIC.For example to tell the PIC which bits of Port
; are input and which are output.BANK1 is used to manipulated the data.
; 5. Bare in mind that in programming, we read the input; and write the output.
; 6. In assembly, to read we use BTFSC or BTFSS; while to write we use MOVLW, MOVWF, CLF, BSF or BCF. (and other type of
; insrtuction that you can refer to PIC datasheet)
; 7. DELAY is a kind of method that we used to use it to delay our PIC for some operation.
; 8. We already prepare the DELAY subroutine, you just CALL DELAY when you need it.
; 9. You also can change the delay time by changing the value in DELAY subroutine. (the maximum value is 255)
;
;=================================================================================================
list p=18F4550 ; list directive to define processor
#include <p18F4550.inc> ; processor specific variable definitions
; __CONFIG 0X3FF2
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;==================================================================================
; VARIABLE DEFINITION
;==================================================================================
D1 EQU 0X20 ;REGISTER FOR DELAY
D2 EQU 0X21 ;REGISTER FOR DELAY
D3 EQU 0X22 ;REGISTER FOR DELAY
;====================================================================================
;=====================================================================================
; WRITE YOUR PROGRAM HERE
;=====================================================================================
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
main
; initialize of your PIC, setting the general I/O in TRIS
BSF STATUS,5 ;SWITCH TO BANK1; BIT 5 OF STATUS REGISTER IS SET TO 1
CLRF TRISB ;SET PORTB AS OUTPUT ;PORTB = B'00000000'
BSF TRISA,2 ;SET RA2 AS INPUT ;RA2=1
BSF TRISA,3 ;SET RA3 AS INPUT ;RA3=1
BSF TRISA,4 ;SET RA4 AS INPUT ;RA4=1
BCF STATUS,5 ;SWITCH TO BANK0; BIT 5 OF STATUS REGISTER IS SET TO 0
MOVLW B'11111111'
MOVWF PORTB ;SET ALL 8 PIN IN PORTB TO HIGH(1)
; The main program begin here
START
BTFSS PORTA,2 ;check signal at pushbutton1, if press then goto following line, else skip the following line
CALL RED ;button1 pressed, program execute the operation in subroutine RED
BTFSS PORTA,3 ;check signal at pushbutton2, if press then goto following line, else skip the following line
CALL GREEN ;button2 pressed, program execute the operation in subroutine GREEN
BTFSS PORTA,4 ;check signal at pushbutton3, if press then goto following line, else skip the following line
CALL YELLOW ;button3 pressed, program execute the operation in subroutine YELLOW
GOTO START ;no any button being pressed, program keep looping to check the pushbuttons' signal
RED
BSF PORTB,4 ;ON YELLOW LED
BSF PORTB,5 ;ON GREEN LED
BSF PORTB,6 ;ON RED LED
BCF PORTB,6 ;OFF RED LED
RETURN
GREEN
BSF PORTB,4 ;ON YELLOW LED
BSF PORTB,5 ;ON GREEN LED
BSF PORTB,6 ;ON RED LED
BCF PORTB,5 ;OFF GREEN LED
RETURN
YELLOW
BSF PORTB,4 ;ON YELLOW LED
BSF PORTB,5 ;ON GREEN LED
BSF PORTB,6 ;ON RED LED
BCF PORTB,4 ;OFF YELLOW LED
RETURN
;========================================================================================
; DELAY SUBROUTINE
;========================================================================================
DELAY MOVLW D'200' ;PAUSE FOR ABOUT 500mS (u can change the 200, 3, 1 value to obtain different delay timing)
MOVWF D3
MOVLW D'3'
MOVWF D2
MOVLW D'1'
MOVWF D1
DECFSZ D1 ;DECREASE THE VALUE OF D1 AND SKIP THE NEXT LINE WHEN IT REACH ZERO
GOTO $-1 ;IF NOT ZERO, IT WILL LEAD THE PROGRAM TO 1 LINE ABOVE
DECFSZ D2 ;DECREASE THE VALUE OF D2 AND SKIP THE NEXT LINE WHEN IT REACH ZERO
GOTO $-5 ;IF NOT ZERO, IT WILL LEAD THE PROGRAM TO 5 LINE ABOVE
DECFSZ D3 ;DECREASE THE VALUE OF D3 AND SKIP THE NEST LINE WHEN IT REACH ZERO
GOTO $-9 ;IF NOT ZERO, IT WILL LEAD THE PROGRAM TO 9 LINE ABOVE
RETURN ;RETURN FROM SUBROUTINE
END ; directive 'end of program'