• 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.

compiling with MPLAB

Status
Not open for further replies.

evandude

New Member
I am trying to compile this program in MPLAB. (attached... rename to .asm)I didn't write it, it's from EPE magazine; it's the code for their 16F877 based function generator. The article is from 1999 I believe...

MPLAB won't compile it.

I'll spare you the full error log, but here's a sample

Code:
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 372 : Symbol not previously defined (ANSA2)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 373 : Symbol not previously defined (OUT6)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 374 : Symbol not previously defined (ANSA1)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 375 : Symbol not previously defined (OUT5)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 376 : Symbol not previously defined (DEC1)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 377 : Symbol not previously defined (OUT4)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 380 : Symbol not previously defined (RSLINE)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 381 : Symbol not previously defined (MARK1)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 383 : Symbol not previously defined (OUT7)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 384 : Symbol not previously defined (FSR)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 386 : Symbol not previously defined (LOOPA)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 387 : Symbol not previously defined (INDF)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 388 : Symbol not previously defined (STATUS)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 388 : Symbol not previously defined (Z)
Error[113]   D:\MY DOCUMENTS\PROJECTS\EPE FUNCTION GENERATOR\PICGN220.ASM 390 : Symbol not previously defined (MARK1)
that goes on for pages. I don't do anything in assembly... I'm just trying to verify that my board will work to some degree before i go wading through tons of C code to write my own firmware. Am I doing something wrong? (I tried quickbuild, and then making a project with the wizard... with equal results)

or is it because i'm using a relatively recent version of MPLAB (6.61) and the code is from last millenium?

Thanks in advance... I hate to be asking such a dumb question, but the only time I touch assembly (or MPLAB) is when I need to compile someone else's program...
 

Attachments

pike

Member
Hmm you see that massive listing of equ's. it means 'equates'. Just makes it easier to write the program.

it's a bit like developing slang for assembly language (assembly language is full of wierd words like "movlw") , and the table of equ's tells the compiler which slang word means which compiler word.

I personally never use equ's because it 'loosens' the human mind. I like to stay sharp with mental memory juggling.

sorry this post probably hasn't helped but i'll guarantee that the problem lies in the table of equ's

Code:
INDF:    .EQU $00  ;page 0, 1, 2, 3
TMR0:    .EQU $01  ;page 0, 2
OPTION:  .EQU $01  ;page 1, 3
PCL:     .EQU $02  ;page 0, 1, 2, 3
STATUS:  .EQU $03  ;page 0, 1, 2, 3
FSR:     .EQU $04  ;page 0, 1, 2, 3

PORTA:   .EQU $05  ;page 0
TRISA:   .EQU $05  ;page 1
PORTB:   .EQU $06  ;page 0, 2
TRISB:   .EQU $06  ;page 1, 3
PORTC:   .EQU $07  ;page 0
TRISC:   .EQU $07  ;page 1
PORTD:   .EQU $08  ;page 0
TRISD:   .EQU $08  ;page 1
PORTE:   .EQU $09  ;page 0
TRISE:   .EQU $09  ;page 1

INTCON:  .EQU $0B  ;page 0, 1, 2, 3
ADCON0:  .EQU $1F  ;page 0
ADCON1:  .EQU $1F  ;page 1

LOOPA:   .EQU $20       ;loop used by LCD send routine
LOOPB:   .EQU $21       ;general loop
STORE:   .EQU $22       ;general store
STORE1:  .EQU $23       ;general store
STORE2:  .EQU $24       ;general store
STORE3:  .EQU $25       ;general store
RSLINE:  .EQU $26       ;LCD function flag store
SWITCH:  .EQU $27       ;switch status store
MARK1:   .EQU $28       ;freq count polarity marker 1
MARK2:   .EQU $29       ;freq count polarity marker 2

DEC1:    .EQU $2A       ;decimalisation byte 1
DEC2:    .EQU $2B       ; byte 2
DEC3:    .EQU $2C       ; byte 3
DEC4:    .EQU $2D       ; byte 4
DEC5:    .EQU $2E       ; byte 5
DEC6:    .EQU $2F       ; byte 6 (dummy)      

ANSA1:   .EQU $30       ;decimalisation answer store 1
ANSA2:   .EQU $31       ; answer 2
ANSA3:   .EQU $32       ; answer 3
ANSA4:   .EQU $33       ; answer 4
ANSA5:   .EQU $34       ; answer 5

FREQ0:   .EQU $35       ;frequency counter lsb
FREQ1:   .EQU $36       ;frequency counter nsb
FREQ2:   .EQU $37       ;frequency counter nsb
FREQ3:   .EQU $38       ;frequency counter nsb
FREQ4:   .EQU $39       ;frequency counter msb
CLKCNT:  .EQU $3A       ;timing counter
SLOWIT:  .EQU $3B       ;delay factor for PAUSE
LOOPX:   .EQU $3C       ;delay loop for LCDOUT

OUT7:    .EQU $3D       ;8 bytes for freq store and output to LCD
OUT6:    .EQU $3E
OUT5:    .EQU $3F
OUT4:    .EQU $40
OUT3:    .EQU $41
OUT2:    .EQU $42
OUT1:    .EQU $43
OUT0:    .EQU $44
LCDSTOR1: .EQU $45
LCDSTOR2: .EQU $46
STOREC:   .EQU $47
STORED:   .EQU $48
TENFLG:   .EQU $49
TENCNT:   .EQU $4A
RANGE:    .EQU $4B      ;frequency cap selection
SHAPE:    .EQU $4C      ;waveform shape selection
SAMPLE:   .EQU $4D      ;1sec/10sec flag
CLKVAL1:  .EQU $4E
CLKVAL2:  .EQU $4F

                    ;extends to $7F (max limit)

W:       .EQU 0
F:       .EQU 1
C:       .EQU 0
DC:      .EQU 1
Z:       .EQU 2

RP0:     .EQU 5         ;STATUS reg
RP1:     .EQU 6         ;STATUS reg
GIE:     .EQU 7         ;INTCON reg
This is the equ table.
 

csaba911

Member
Here you have it.

Just compare the diferent in my code.

Make sure you disabble the case sensivity in MPLAB, under "project ", "Build Option".

Have fun !

STEVE
 

Attachments

evandude

New Member
at first glance, it appears you just took out a bunch of periods and semicolons. whatever the case may be, it seems to have worked! at least, the code compiles now.

thanks! :D
 

Nigel Goodwin

Super Moderator
Most Helpful Member
You need to be careful with EPE code, much of it doesn't use the MicroChip assembler MPASM - the editor of EPE had never heard of MPASM when he started with PIC's (which is really unbelievable!), and he used a shareware assembler, which isn't MPASM compatible.

Their Toolkit Mk3 includes a facility to convert between the two source file types, it's a free download from their website.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top