Ir ao conteúdo

Botão Pulsador Lig/Des LED - PIC16F84A


ewpreis

Posts recomendados

Postado

Boa Noite amigos, recentemente desenvolvi um programa em assembly para o PIC16F628A, mas na lojas que eu procurei ele estava em falta e eu o substitui pelo PIC16F84A.

Com isso eu só troquei a seguinte linha do meu programa:

#INCLUDE <P16F84A.INC> ;ARQUIVO padrão MICROCHIP PARA O PIC16F84A

que antes era assim:

#INCLUDE <P16F628A.INC> ;ARQUIVO padrão MICROCHIP PARA O PIC16F628A

O programa todo ficou assim:


;*********************************************************
; VERSÃO 1.0
; DESENVOLVIDO POR: EWERTON REIS
; DATA DE CONCLUSÃO:08/07/2013
;*********************************************************

;*********************************************************
#INCLUDE <P16F84A.INC> ;ARQUIVO padrão MICROCHIP PARA O PIC16F84A
;*********************************************************

;*********************************************************
; BITS DE CONFIGURAÇÃO
__CONFIG _BODEN_ON & _CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _XT_OSC
;*********************************************************

;*********************************************************
;PAGINAÇÃO DE MEMORIA
#DEFINE BANK0 BCF STATUS,RP0 ;SETA BANCO 0 DE MEMORIA
#DEFINE BANK1 BSF STATUS,RP0 ;SETA BANCO 1 DE MEMORIA
;*********************************************************

;*********************************************************
;ENTRADAS
#DEFINE BOTAO PORTB,4
;*********************************************************
;SAIDAS
#DEFINE LED PORTA,0
;*********************************************************

;*********************************************************
;INICIO DO PROGRAMA
INICIO
CLRF PORTA
CLRF PORTB

BANK1
MOVLW B'00000000'
MOVWF TRISA
MOVLW B'00010000'
MOVWF TRISB
MOVLW B'00001000'
MOVWF OPTION_REG
MOVLW B'00000000'
MOVWF INTCON

BANK0
MOVLW B'00000111'
MOVWF CMCON
;*********************************************************

;*********************************************************
;ROTINA PRINCIPAL DO PROGRAMA

MAIN
BTFSC BOTAO
GOTO BOTAO_ON
GOTO BOTAO_OFF

BOTAO_ON
BCF LED
GOTO MAIN

BOTAO_OFF
BSF LED
GOTO MAIN

END
;*********************************************************

Quando eu compilei me apareceu o seguinte erro:


Release build of project `D:\Ewerton Documentos\HD Externo\Projetos\Eletrônica\Projeto Eletrônica 3º ano\Botão pulsador Lig-Des LED\Ewerton\Programa\Botão Lig e Desl LED.disposable_mcp' started.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Mon Aug 05 19:16:27 2013
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "Botão Lig e Desl LED.asm" /l"Botão Lig e Desl LED.lst" /e"Botão Lig e Desl LED.err"
Error[113] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 12 : Symbol not previously defined (_BODEN_ON)
Error[113] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 12 : Symbol not previously defined (_LVP_OFF)
Error[113] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 12 : Symbol not previously defined (_MCLRE_ON)
Message[302] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 36 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 38 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 40 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[113] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 46 : Symbol not previously defined (CMCON)
Warning[205] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 65 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Release build of project `D:\Ewerton Documentos\HD Externo\Projetos\Eletrônica\Projeto Eletrônica 3º ano\Botão pulsador Lig-Des LED\Ewerton\Programa\Botão Lig e Desl LED.disposable_mcp' failed.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Mon Aug 05 19:16:28 2013
----------------------------------------------------------------------
BUILD FAILED

Desenho do CKT

post-708147-13884966557741_thumb.jpg

Postado

Já tive esse problema... Faz o seguinte, crie um diretório A PARTIR DA RAIZ c:\ de seu computador, e coloque todo o projeto lá. Esse erro é porque o caminho está muito longo !

Veja se resolve, pois o meu caso resolveu !

Paulo

Postado

As configurações de BITs do 16F84 não são compativeis com o 16F628.

Altere:

	__CONFIG _PWRTE_ON & _WDT_OFF & _XT_OSC ; 

E retire as linhas:

MOVLW B'00000111'

MOVWF CMCON

O 16F84 não é mais fabricado,não use ele para testes.

A dica do Paulo tambem tem que ser seguida.

Postado

As dicas do VTRX resolverá seu problema, e para retirar também os warning e message utilize:

Warning[205] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 65 : Found directive in column 1. (END)

O "END" na segunda coluna, utilize alguns espaços antes dele

Message[302] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 36 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 38 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] D:\EWERTON DOCUMENTOS\HD EXTERNO\PROJETOS\ELETRôNICA\PROJETO ELETRôNICA 3º ANO\BOTãO PULSADOR LIG-DES LED\EWERTON\PROGRAMA\BOTãO LIG E DESL LED.ASM 40 : Register in operand not in bank 0. Ensure that bank bits are correct.


ERRORLEVEL -302

Utilize logo após a configuração de bits

Postado
As configurações de BITs do 16F84 não são compativeis com o 16F628.

Altere:

	__CONFIG _PWRTE_ON & _WDT_OFF & _XT_OSC ; 

E retire as linhas:

O 16F84 não é mais fabricado,não use ele para testes.

A dica do Paulo tambem tem que ser seguida.

Obrigado Paulo, agora deu build succeeded

Eu irei utilizar o PIC16F84A, todos os locais que procurei estava em falta o PIC16F628A

As dicas do VTRX resolverá seu problema, e para retirar também os warning e message utilize:

O "END" na segunda coluna, utilize alguns espaços antes dele


ERRORLEVEL -302

Utilize logo após a configuração de bits

Não entendi o que você falou sobre o erro level 302

Depois do quickbuild ficou assim:

Release build of project `C:\Botão pulsador Lig-Des LED\Eliza\Programa\Botão Lig e Desl LED.disposable_mcp' started.

Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48

Tue Aug 06 17:55:26 2013

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

Clean: Deleting intermediary and output files.

Clean: Done.

Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "Botão Lig e Desl LED.asm" /l"Botão Lig e Desl LED.lst" /e"Botão Lig e Desl LED.err"

Message[302] C:\BOTãO PULSADOR LIG-DES LED\ELIZA\PROGRAMA\BOTãO LIG E DESL LED.ASM 36 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] C:\BOTãO PULSADOR LIG-DES LED\ELIZA\PROGRAMA\BOTãO LIG E DESL LED.ASM 38 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] C:\BOTãO PULSADOR LIG-DES LED\ELIZA\PROGRAMA\BOTãO LIG E DESL LED.ASM 40 : Register in operand not in bank 0. Ensure that bank bits are correct.

Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p16F84A "Botão Lig e Desl LED.o" /z__MPLAB_BUILD=1 /o"Botão Lig e Desl LED.cof" /M"Botão Lig e Desl LED.map" /W /x

MPLINK 4.48, Linker

Device Database Version 1.12

Copyright © 1998-2011 Microchip Technology Inc.

Errors : 0

Loaded C:\Botão pulsador Lig-Des LED\Eliza\Programa\Botão Lig e Desl LED.cof.

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

Release build of project `C:\Botão pulsador Lig-Des LED\Eliza\Programa\Botão Lig e Desl LED.disposable_mcp' succeeded.

Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48

Tue Aug 06 17:55:28 2013

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

BUILD SUCCEEDED

Postado

O ERRORLEVEL -302 irá retirar essas mensagens do log de compilação:

Message[302] C:\BOTãO PULSADOR LIG-DES LED\ELIZA\PROGRAMA\BOTãO LIG E DESL LED.ASM 36 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] C:\BOTãO PULSADOR LIG-DES LED\ELIZA\PROGRAMA\BOTãO LIG E DESL LED.ASM 38 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] C:\BOTãO PULSADOR LIG-DES LED\ELIZA\PROGRAMA\BOTãO LIG E DESL LED.ASM 40 : Register in operand not in bank 0. Ensure that bank bits are correct.

O compilador está informando que você não está no banco 0, é só uma mensagem.

use:

__CONFIG _PWRTE_ON & _WDT_OFF & _XT_OSC ;

ERRORLEVEL -302

Postado
O ERRORLEVEL -302 irá retirar essas mensagens do log de compilação:

O compilador está informando que você não está no banco 0, é só uma mensagem.

use:

Agora eu entendi, rs

Ficou assim:

;****************************************************************************
; VERSÃO 2.0
; DESENVOLVIDO POR: EWERTON REIS
; DATA DE CONCLUSÃO:05/08/2013
;****************************************************************************

;****************************************************************************
#INCLUDE <P16F84A.INC> ;ARQUIVO padrão MICROCHIP PARA O PIC16F84A
;****************************************************************************
; BITS DE CONFIGURAÇÃO
__CONFIG _PWRTE_ON & _WDT_OFF & _XT_OSC ;
ERRORLEVEL -302
;****************************************************************************

;****************************************************************************
;PAGINAÇÃO DE MEMORIA
#DEFINE BANK0 BCF STATUS,RP0 ;SETA BANCO 0 DE MEMORIA
#DEFINE BANK1 BSF STATUS,RP0 ;SETA BANCO 1 DE MEMORIA
;****************************************************************************

;****************************************************************************
;ENTRADAS
#DEFINE BOTAO PORTB,4
;****************************************************************************
;SAIDAS
#DEFINE LED PORTA,0
;****************************************************************************

;****************************************************************************
;INICIO DO PROGRAMA
INICIO
CLRF PORTA
CLRF PORTB

BANK1
MOVLW B'00000000'
MOVWF TRISA
MOVLW B'00010000'
MOVWF TRISB
MOVLW B'00001000'
MOVWF OPTION_REG
MOVLW B'00000000'
MOVWF INTCON
;****************************************************************************

;****************************************************************************
;ROTINA PRINCIPAL DO PROGRAMA

MAIN
BTFSC BOTAO
GOTO BOTAO_ON
GOTO BOTAO_OFF

BOTAO_ON
BCF LED
GOTO MAIN

BOTAO_OFF
BSF LED
GOTO MAIN

END

Log do quickbuild:

----------------------------------------------------------------------
Release build of project `C:\Botão pulsador Lig-Des LED\Ewerton\Programa\Botão Lig e Desl LED.disposable_mcp' started.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Thu Aug 08 20:13:32 2013
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "Botão Lig e Desl LED.asm" /l"Botão Lig e Desl LED.lst" /e"Botão Lig e Desl LED.err"
Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p16F84A "Botão Lig e Desl LED.o" /z__MPLAB_BUILD=1 /o"Botão Lig e Desl LED.cof" /M"Botão Lig e Desl LED.map" /W /x
MPLINK 4.48, Linker
Device Database Version 1.12
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors : 0

Loaded C:\Botão pulsador Lig-Des LED\Ewerton\Programa\Botão Lig e Desl LED.cof.
----------------------------------------------------------------------
Release build of project `C:\Botão pulsador Lig-Des LED\Ewerton\Programa\Botão Lig e Desl LED.disposable_mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Thu Aug 08 20:13:33 2013
----------------------------------------------------------------------
BUILD SUCCEEDED

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

Ebook grátis: Aprenda a ler resistores e capacitores!

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!