piclist 2005\10\09\143800a >
Thread: - Very Newbie -Why won't this program compile?. Was: What Do I Do Now?
www.piclist.com/techref/microchip/begin.htm?key=pic
flavicon
face BY : Ed Edmondson email (remove spam text)



I have been trying to get this very small program to compile, however,
below are the program code and error messages I received. I get 15 errors
about symbols not being defined. I found what the 113 error was in an
excerpt of chapter 8 of the Assembler/Linker/Librarian Users guide. 113 is
"Symbol not previously defined" I tried to add #define to the program with
only minor success. See below: I may not be the brighest coal in the fire
but I will be the most persistent.

;testprog.asm
;
; 8th October 2005
;
; LED blinky

  list P = 16F877
  include "P16F877.inc"

errorlevel -302, -305, -306

; turn off some MPASM messages

; 302 not in bank0
; 305 default destination of 1
; 306 crossing page boundary
; 113 symbol not previously defined "Can't disable this error code"

; Instruction cycle time = 400ns with 10MHz crystal

;set configuration

 __CONFIG _CP_OFF & _WRT_ENABLE_ON & _HS_OSC & _WDT_OFF & _PWRTE_OFF &
_BODEN_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF

        cblock 0x20

        varname1             ;some variables
        varname2
        varname3

        endc

; define a pin name

#define  led     portb,1      ;pin to drive LED
#define porta
#define portb
#define portc
#define portd
#define porte
#define trisa
#define trisb
#define trisc
#define trisd
#define option_reg

;program address start in memory

        org     0x00         ;start address
        goto    delay

; interrupt vector

;         org     0x04         ;REM if interrupts not used
;         goto    isr          ;REM if interrupts not used

init     clrf    status       ;bank0

        clrf    porta
        clrf    portb
        clrf    portc
        clrf    portd
        clrf    porte

        banksel trisa        ;set data direction on pins

        movlw   b'00000000'  ;all PortA as output
        movwf   trisa


        movlw   b'00000000'  ;all PortB as output
        movwf   trisb


        movlw   b'10000000'  ;all PortC as output
        movwf   trisc

        movlw   b'10000000'  ;all PortD as output
        movwf   trisd

        movlw   b'10000000'
;                  1           internal pull-ups off

        movwf   option_reg   ;INTEDG = 0, falling edge for microswitch

        banksel porta        ;return to bank0

;===============================================

led_loop bsf     led          ;turn LED on
        call    delay        ;0.2s delay
        bcf     led          ;turn LED off
        call    delay        ;0.2s delay
        goto    led_loop     ;blink forever (what a life)

delay    movlw   .56          ;call 1ms delay 200 times
        movwf   varname1
ms1      call    msec01
        incfsz  varname1
        goto    ms1
        return

msec01   movlw   .30          ;delay approx 1ms @ 10MHz
        movwf   varname2
loop     nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        incfsz  varname2
        goto    loop
        return

 end


Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "I:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F877
"testprog.asm" /l"testprog.lst" /e"testprog.err" /o"testprog.o"
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 48 : Symbol not previously defined
(status)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 50 : Symbol not previously defined
(porta)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 51 : Symbol not previously defined
(portb)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 52 : Symbol not previously defined
(portc)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 53 : Symbol not previously defined
(portd)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 54 : Symbol not previously defined
(porte)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 56 : Symbol not previously defined
(trisa)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 59 : Symbol not previously defined
(trisa)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 63 : Symbol not previously defined
(trisb)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 67 : Symbol not previously defined
(trisc)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 70 : Symbol not previously defined
(trisd)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 75 : Symbol not previously defined
(option_reg)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 77 : Symbol not previously defined
(porta)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 81 : Symbol not previously defined
(portb)
Error[113]   I:\MPLAB FILES\TESTPROG.ASM 83 : Symbol not previously defined
(portb)
Halting build on first failure as requested.
BUILD FAILED: Sat Oct 08 18:16:53 2005

<032201c5cd00$951a9ad0$6401a8c0@edscomputer> 7bit

See also: www.piclist.com/techref/microchip/begin.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) - Very Newbie -Why won't this program compile?. Was: What Do I Do Now?

month overview.

new search...