Ya escribí mi primer programa en MPLAB 6.4 para el pic16f84a.
Es un programa que establece al puerto a como entrada y al puerto b como salida. Obtiene dato de pto a, le suma 0x02 y luego saca el resultado a pto b.
Salvé el archivo como .asm y adjunté el linker 16f84a.lkr. El programa .asm es como sigue:
----------
LIST P=16F84A
#include <p16F84a.inc>
porta EQU 0x05 ;banco 0
portb EQU 0x06 ;banco 0
estado EQU 0x03 ;status
banco EQU 5 ;bit de localidad status
ORG 0
BSF estado,banco ;pone a uno bit 5 status = banco 1
MOVLW 0xff
MOVWF TRISA ; pto a es de entrada
BCF estado,banco ;pone a cero bit 5 status = banco 0
MOVLW 0x00
MOVWF TRISB ; pto b es de salida
inicio MOVF porta,W ;carga W con pto a
ADDLW 0x02 ;suma W + 0x02
MOVWF portb ;manda W a ptob
GOTO inicio
END
--------------
Según entiendo el código está bien, pero me marca el sig. error al construirlo:
-----------------
Deleting intermediary files... done.
Executing: "C:Archivos de programaMPLAB IDEMCHIP_Toolsmpasmwin.exe" /q /p16F84A "ptoayptob.asm" /l"ptoayptob.lst" /e"ptoayptob.err" /o"ptoayptob.o"
Message[302] C:TEMPORALPICBORRAPTOAYPTOB.ASM 14 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:TEMPORALPICBORRAPTOAYPTOB.ASM 17 : Register in operand not in bank 0. Ensure that bank bits are correct.
Executing: "C:Archivos de programaMPLAB IDEMCHIP_Toolsmplink.exe" "16f84a.lkr" "C: emporalpicborraptoayptob.o" /o"ptoayptob.cof"
MPLINK 3.60, Linker
Copyright (c) 2003 Microchip Technology Inc.
Error - section ".org_0" can not fit the absolute section. Section ".org_0" start=0x00000000, length=0x00000014
Errors : 1
BUILD FAILED: Mon May 03 15:19:08 2004
---------------
Por favor dígame alguien que estoy haciendo mal. Gracias.