Salve a tutti, dopo aver scritto il programma di un semplice contamarce di una moto, lo assemblo e mi vengono generati una serie di errori:
error 113: symbol not previously defined (C0h)
error 113: symbol not previously defined (F8h)
error 113: symbol not previously defined (primai)
error 113: symbol not previously defined (second)
error 113: symbol not previously defined (primai)
error 113 :symbol not previously defined (second)
error 121: Illegal label (primai)
error 121: illegal label (second)
ora, qualcuno mi potrebbe spiegarmi cosa sono ed aiutarmi a risolvere questi problemi??
grazie mille per la disponibilità
errori in MPLAB
Moderatore:
Paolino
41 messaggi
• Pagina 1 di 5 • 1, 2, 3, 4, 5
1
voti
Per rispondere alla tua domanda, dovresti dare qualche info in più:
- hai aperto un progetto MPLAB oppure hai solo caricato il sorgente?
- sei sicuro che la versione di MLPAB che stai usando sia compatibile con il codice che hai caricato?
- che PIC stai usando?
Ciao.
Paolo.
"Houston, Tranquillity Base here. The Eagle has landed." - Neil A.Armstrong
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-

Paolino
32,6k 8 12 13 - G.Master EY

- Messaggi: 4226
- Iscritto il: 20 gen 2006, 11:42
- Località: Vigevano (PV)
0
voti
Ho aperto un nuovo progetto con la procedura project Wizard, il linguaggio in uso è il classico assembler dalla microchip: mpasm; il PIC in uso è il 16f887, supportato da mplab.
serve altro tipo il listato del programma??
serve altro tipo il listato del programma??
1
voti
La procedura sembra corretta. Ricordati anche di mettere il file di "include" (.inc) e il file per il linker (.lkr), nell'albero di MPLAB, altrimenti potresti incappare in problemi vari di compilazione e/o di linking.
Se vuoi mettere il codice, fallo pure. Ma ricordati di usare i tag [code ] e [ /code] che trovi nell'editor del messaggio, qui nel forum.
Ciao.
Paolo.
Se vuoi mettere il codice, fallo pure. Ma ricordati di usare i tag [code ] e [ /code] che trovi nell'editor del messaggio, qui nel forum.
Ciao.
Paolo.
"Houston, Tranquillity Base here. The Eagle has landed." - Neil A.Armstrong
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-

Paolino
32,6k 8 12 13 - G.Master EY

- Messaggi: 4226
- Iscritto il: 20 gen 2006, 11:42
- Località: Vigevano (PV)
0
voti
Se postassi il codice, potresti darmi una mano a capirli e correggerli spiegandomi anche per quale motivo si deve fare una certa cosa, data la mia scarsa esperienza in questo campo??
grazi mille per l'aiuto e la disponibilità
grazi mille per l'aiuto e la disponibilità
0
voti
Beh, proviamoci 
Ciao.
Paolo.
Ciao.
Paolo.
"Houston, Tranquillity Base here. The Eagle has landed." - Neil A.Armstrong
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-

Paolino
32,6k 8 12 13 - G.Master EY

- Messaggi: 4226
- Iscritto il: 20 gen 2006, 11:42
- Località: Vigevano (PV)
0
voti
Allora eccoti il programma, tutto quello sopra il MAIN e sotto EDN è comparso dopo aver aggiunto il file .asm del PIC.
- Codice: Seleziona tutto
;**********************************************************************
; This file is a basic code template for assembly code generation *
; on the PIC16F887. This file contains the basic code *
; building blocks to build upon. *
; *
; Refer to the MPASM User's Guide for additional information on *
; features of the assembler (Document DS33014). *
; *
; Refer to the respective PIC data sheet for additional *
; information on the instruction set. *
; *
;**********************************************************************
; *
; Filename: xxx.asm *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
; *
;**********************************************************************
; *
; Files Required: P16F887.INC *
; *
;**********************************************************************
; *
; Notes: *
; *
;**********************************************************************
list p=16f887 ; list directive to define processor
#include <p16f887.inc> ; processor specific variable definitions
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_ON & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
__CONFIG _CONFIG2, _WRT_OFF & _BOR21V
;***** VARIABLE DEFINITIONS
w_temp EQU 0x7D ; variable used for context saving
status_temp EQU 0x7E ; variable used for context saving
pclath_temp EQU 0x7F ; variable used for context saving
;**********************************************************************
ORG 0x000 ; processor reset vector
nop
goto main ; go to beginning of program
ORG 0x004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
movf PCLATH,w ; move pclath register into w register
movwf pclath_temp ; save off contents of PCLATH register
; isr code can go here or be located as a call subroutine elsewhere
movf pclath_temp,w ; retrieve copy of PCLATH register
movwf PCLATH ; restore pre-isr PCLATH register contents
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
79 main banksel 06h
clrf 06h ;inizializzazione port B
banksel 86h
movlw 07h ;RB<o;2> impostati come ingressi, RB<3;7> come uscite
movwf 86h
banksel 08h
clrf 08h ;inizializzazione port D
banksel 88h
movlw 00h ; port Dimpostato tutto come uscita
movwf 88h
banksel 81h
bcf 81h,07h ; abilitazione pull-up sul port B
banksel 06h
clrf 06h ; inizializzazione port B
banksel 95h
movlw 07h ; pull-up abilitati su RB<0;2>
movwf 95h
folle btfsc 02h,06h ; test di RB2, finché è a 1 is sistema non parte
goto prima
banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw c0h ; RD<0;5> inpostati come ingressi, RD<6;7> come uscita
movwf 88h
goto folle
prima btfss 01h,06h ; test di RB1, se è a 1 si è in prima, se è a 0 si è comunque in prima
goto primai
btfss 00h,06h ; test di RB0, se è a 1 si è in seconda, se è a 0 si rimane in prima
goto second
btfsc 02h,06h ; test di RB2, se è a 1 si è in prima, se è a 0 si va in folle
goto folle
primai banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw F8h
movwf 88h ; visualizzazione di 1 sul display
goto prima
seconda btfss 01h,06h ; test di RB1, se è a 1 si è in seconda, se è a 0 si è in prima
goto primai
btfss 00h,06h ; test di RB0, se è a 1 si è in seconda, se è a 0 si è in terza
goto terzai
btfsc 02h,06h ; test di RB2, se è a 1 si è in seconda, se è a 0 si va in folle
goto folle
second banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw 24h ; RD<0,1,3,4,6,7> impostati come uscite, RD<2,5> impistati come ingressi
movwf 88h ; visualizzazione di 2 sul display
goto seconda
terza btfss 01h,06h ; test di RB1, se è a 1 si è in terza, se è a 0 si è in seconda
goto second
btfss 00h,06h ; test di RB0, se è a 1 si è in terza, se è a 0 si è in quarta
goto quartai
terzai banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw 30h ; RD<0,1,2,3,6,7> impostati come uscite, RD<4,5> impostati come ingressi
movwf 88h ; visualizzazione di 3 sul display
goto terza
quarta btfss 01h,06h ; test di RB1, se è a 1 si è in quarta, se è a 0 si è in terza
goto terzai
btfss 00h,06h ; test di RB0, se è a 1 si è in quarta, se è a 0 si è in quinta
goto quintai
quartai banksel 08h
clrf 08h ; inizializzazione del port D
banksel 88h
movlw 19h ; RD<1,2,5,6,7> impostati come uscite, RD<0,3,4>impostati come ingressi
movwf 88h ; visualizzazione di 4 sul display
goto terza
quinta btfss 01h,06h ; test di RB1, se è a 1 si è in quinta, se è a 0 si è in quarta
goto quartai
btfss 00h,06h ; test di RB0, se è a 1 si è in quinta, se è a 0 si è in sesta
goto sestai
quintai banksel 08h
clrf 08h ; inizializzazione del port D
banksel 88h
movlw 12h ; RD<0,2,3,5,6,7> impostati come uscite, RD<1,4> impostati come ingressi
movwf 88h ; visualizzazione di 5 sul display
goto quinta
sesta btfss 01h,06h ; test di RB1, se è a 1 si è in sesta, se è a 0 si è in quinta
goto quintai
btfss 00h,06h ; test di RB0, se è a 1 si è in sesta, se è a 0 si è comunque in sesta
sestai banksel 08h
clrf 08h ; inizializzazione del port D
banksel 88h
movlw 20h ; RD<0,1,2,3,4,6,7> impostati come uscite, RD<5> impostato come ingresso
movwf 88h
goto sesta
END ; directive 'end of program'
; remaining code goes here
; example of preloading EEPROM locations
ORG 0x2100
DE 5, 4, 3, 2, 1
Ultima modifica di
Paolino il 18 feb 2012, 22:25, modificato 1 volta in totale.
Motivazione: Aggiunti i tag [code] e [/code] per inserire il codice
Motivazione: Aggiunti i tag [code] e [/code] per inserire il codice
1
voti
Allora, ho corretto qua e là un po' di errori, i più dovuti a errori di indentazione del codice (chissà cosa ne pensa il mio amico
carlomariamanenti
)
Ecco qui:
Rispetto al tuo, c'è qualche correzione. Ora, io non so cosa fa il tuo codice, anche perché l'hardware ce lo hai tu e solo tu puoi fare le prove. Copialo nel tuo progetto, così intendato come ho fatto io, compila e poi dimmi.
EDIT
Le correzioni, se non le hai individuate, sono in queste righe:
e
Quando usi la istruzione movlw seguito da un valore esadecimale maggiore o uguale di A0, devi far scrivere l'istruzione in due modi:
Ciao.
Paolo.
P.S. Ho rimosso anche queste righe, perché prive di senso:
; example of preloading EEPROM locations
ORG 0x2100
DE 5, 4, 3, 2, 1
Ecco qui:
- Codice: Seleziona tutto
;**********************************************************************
; This file is a basic code template for assembly code generation *
; on the PIC16F887. This file contains the basic code *
; building blocks to build upon. *
; *
; Refer to the MPASM User's Guide for additional information on *
; features of the assembler (Document DS33014). *
; *
; Refer to the respective PIC data sheet for additional *
; information on the instruction set. *
; *
;**********************************************************************
; *
; Filename: xxx.asm *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
; *
;**********************************************************************
; *
; Files Required: P16F887.INC *
; *
;**********************************************************************
; *
; Notes: *
; *
;**********************************************************************
list p=16f887 ; list directive to define processor
#include <p16f887.inc> ; processor specific variable definitions
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_ON & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
__CONFIG _CONFIG2, _WRT_OFF & _BOR21V
;***** VARIABLE DEFINITIONS
w_temp EQU 0x7D ; variable used for context saving
status_temp EQU 0x7E ; variable used for context saving
pclath_temp EQU 0x7F ; variable used for context saving
;**********************************************************************
ORG 0x000 ; processor reset vector
nop
goto main ; go to beginning of program
ORG 0x004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
movf PCLATH,w ; move pclath register into w register
movwf pclath_temp ; save off contents of PCLATH register
; isr code can go here or be located as a call subroutine elsewhere
movf pclath_temp,w ; retrieve copy of PCLATH register
movwf PCLATH ; restore pre-isr PCLATH register contents
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
main
banksel 06h
clrf 06h ;inizializzazione port B
banksel 86h
movlw 07h ;RB<o;2> impostati come ingressi, RB<3;7> come uscite
movwf 86h
banksel 08h
clrf 08h ;inizializzazione port D
banksel 88h
movlw 00h ; port Dimpostato tutto come uscita
movwf 88h
banksel 81h
bcf 81h,07h ; abilitazione pull-up sul port B
banksel 06h
clrf 06h ; inizializzazione port B
banksel 95h
movlw 07h ; pull-up abilitati su RB<0;2>
movwf 95h
folle
btfsc 02h,06h ; test di RB2, finché è a 1 is sistema non parte
goto prima
banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw 0xc0 ; RD<0;5> inpostati come ingressi, RD<6;7> come uscita
movwf 88h
goto folle
prima
btfss 01h,06h ; test di RB1, se è a 1 si è in prima, se è a 0 si è comunque in prima
goto primai
btfss 00h,06h ; test di RB0, se è a 1 si è in seconda, se è a 0 si rimane in prima
goto second
btfsc 02h,06h ; test di RB2, se è a 1 si è in prima, se è a 0 si va in folle
goto folle
primai
banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw 0xF8
movwf 88h ; visualizzazione di 1 sul display
goto prima
seconda
btfss 01h,06h ; test di RB1, se è a 1 si è in seconda, se è a 0 si è in prima
goto primai
btfss 00h,06h ; test di RB0, se è a 1 si è in seconda, se è a 0 si è in terza
goto terzai
btfsc 02h,06h ; test di RB2, se è a 1 si è in seconda, se è a 0 si va in folle
goto folle
second
banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw 24h ; RD<0,1,3,4,6,7> impostati come uscite, RD<2,5> impistati come ingressi
movwf 88h ; visualizzazione di 2 sul display
goto seconda
terza
btfss 01h,06h ; test di RB1, se è a 1 si è in terza, se è a 0 si è in seconda
goto second
btfss 00h,06h ; test di RB0, se è a 1 si è in terza, se è a 0 si è in quarta
goto quartai
terzai
banksel 08h
clrf 08h ; inizializzazione port D
banksel 88h
movlw 30h ; RD<0,1,2,3,6,7> impostati come uscite, RD<4,5> impostati come ingressi
movwf 88h ; visualizzazione di 3 sul display
goto terza
quarta
btfss 01h,06h ; test di RB1, se è a 1 si è in quarta, se è a 0 si è in terza
goto terzai
btfss 00h,06h ; test di RB0, se è a 1 si è in quarta, se è a 0 si è in quinta
goto quintai
quartai
banksel 08h
clrf 08h ; inizializzazione del port D
banksel 88h
movlw 19h ; RD<1,2,5,6,7> impostati come uscite, RD<0,3,4>impostati come ingressi
movwf 88h ; visualizzazione di 4 sul display
goto terza
quinta
btfss 01h,06h ; test di RB1, se è a 1 si è in quinta, se è a 0 si è in quarta
goto quartai
btfss 00h,06h ; test di RB0, se è a 1 si è in quinta, se è a 0 si è in sesta
goto sestai
quintai
banksel 08h
clrf 08h ; inizializzazione del port D
banksel 88h
movlw 12h ; RD<0,2,3,5,6,7> impostati come uscite, RD<1,4> impostati come ingressi
movwf 88h ; visualizzazione di 5 sul display
goto quinta
sesta
btfss 01h,06h ; test di RB1, se è a 1 si è in sesta, se è a 0 si è in quinta
goto quintai
btfss 00h,06h ; test di RB0, se è a 1 si è in sesta, se è a 0 si è comunque in sesta
sestai
banksel 08h
clrf 08h ; inizializzazione del port D
banksel 88h
movlw 20h ; RD<0,1,2,3,4,6,7> impostati come uscite, RD<5> impostato come ingresso
movwf 88h
goto sesta
END ; directive 'end of program'
; remaining code goes here
Rispetto al tuo, c'è qualche correzione. Ora, io non so cosa fa il tuo codice, anche perché l'hardware ce lo hai tu e solo tu puoi fare le prove. Copialo nel tuo progetto, così intendato come ho fatto io, compila e poi dimmi.
EDIT
Le correzioni, se non le hai individuate, sono in queste righe:
- Codice: Seleziona tutto
movlw 0xc0 ; RD<0;5> inpostati come ingressi, RD<6;7> come uscita
e
- Codice: Seleziona tutto
movlw 0xF8
Quando usi la istruzione movlw seguito da un valore esadecimale maggiore o uguale di A0, devi far scrivere l'istruzione in due modi:
- Codice: Seleziona tutto
;così
movlw 0F8h;
; oppure
movlw 0xF8
Ciao.
Paolo.
P.S. Ho rimosso anche queste righe, perché prive di senso:
; example of preloading EEPROM locations
ORG 0x2100
DE 5, 4, 3, 2, 1
"Houston, Tranquillity Base here. The Eagle has landed." - Neil A.Armstrong
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-

Paolino
32,6k 8 12 13 - G.Master EY

- Messaggi: 4226
- Iscritto il: 20 gen 2006, 11:42
- Località: Vigevano (PV)
1
voti
[10] Re: errori in MPLAB
No, il problema delle label "illegali" era dovuto al fatto che non avevi indentato il codice come vule MPASM.
Hai provato a caricare il file che ti ho passato io? Tutto ok?
Ciao.
Paolo.
Hai provato a caricare il file che ti ho passato io? Tutto ok?
Ciao.
Paolo.
"Houston, Tranquillity Base here. The Eagle has landed." - Neil A.Armstrong
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-------------------------------------------------------------
PIC Experience - http://www.picexperience.it
-

Paolino
32,6k 8 12 13 - G.Master EY

- Messaggi: 4226
- Iscritto il: 20 gen 2006, 11:42
- Località: Vigevano (PV)
41 messaggi
• Pagina 1 di 5 • 1, 2, 3, 4, 5
Torna a Firmware e programmazione
Chi c’è in linea
Visitano il forum: Nessuno e 14 ospiti

Elettrotecnica e non solo (admin)
Un gatto tra gli elettroni (IsidoroKZ)
Esperienza e simulazioni (g.schgor)
Moleskine di un idraulico (RenzoDF)
Il Blog di ElectroYou (webmaster)
Idee microcontrollate (TardoFreak)
PICcoli grandi PICMicro (Paolino)
Il blog elettrico di carloc (carloc)
DirtEYblooog (dirtydeeds)
Di tutto... un po' (jordan20)
AK47 (lillo)
Esperienze elettroniche (marco438)
Telecomunicazioni musicali (clavicordo)
Automazione ed Elettronica (gustavo)
Direttive per la sicurezza (ErnestoCappelletti)
EYnfo dall'Alaska (mir)
Apriamo il quadro! (attilio)
H7-25 (asdf)
Passione Elettrica (massimob)
Elettroni a spasso (guidob)
Bloguerra (guerra)
