Does anybody know what I'm doing wrong? I'm having trouble with some of the instructions. The 16F1827 has a few extra commands in the data sheet for initializing the port A register via banksel that I don't quite get. From the datasheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/41391D.pdf; This code example illustrates
; initializing the PORTA register. The
; other ports are initialized in the same
; manner.
BANKSEL PORTA ;
CLRF PORTA ;Init PORTA
BANKSEL LATA ;Data Latch
CLRF LATA ;
BANKSEL ANSELA ;
CLRF ANSELA ;digital I/O
BANKSEL TRISA ;
MOVLW B'00111000' ;Set RA<5:3> as inputs
MOVWF TRISA ;and set RA<2:
I'm sure that it's something stupid. I know almost nothing about these things. This is my first program and I copied some of the instructions from a textbook.
Here's my program and what I get when I try to Build it:
;************************************
; written by: Me
; date: 2/17/2012
; version: 1.0
; file saved as: Test1
; for PIC16F1827 E/P
; clock frequency: Internal
;************************************
list p=16f1827 ; list directive to define processor
#include <P16F1827.INC> ; processor specific variable definitions
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_OFF
;============
; Declarations:
porta equ 05
org 7FFFh
goto Start
org 0
;============
; Subroutines:
Init clrf porta ; resets Port A
movlw b’00000000’ ; RA0: LED, RA1-7: not connected
tris porta
retlw 0
;============
; Program Start:
Start call Init ; sets up inputs and outputs
Main bsf porta, 0 ; turns on LED
goto Main ; loops back to Main
END
----------------------------------------------------------------------
Debug build of project `C:\Users\Alexander Robotnick\Desktop\Test1.mcp' started.
Language tool versions: MPASMWIN.exe v5.43, mplink.exe v4.41, mplib.exe v4.41
Preprocessor symbol `__DEBUG' is defined.
Fri Feb 17 15:12:19 2012
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F1827 "Test1.asm" /l"Test1.lst" /e"Test1.err" /o"Test1.o" /d__DEBUG=1
Warning[205] C:\USERS\ALEXANDER ROBOTNICK\DESKTOP\TEST1.ASM 11 : Found directive in column 1. (list)
Warning[205] C:\USERS\ALEXANDER ROBOTNICK\DESKTOP\TEST1.ASM 14 : Found directive in column 1. (__CONFIG)
Warning[205] C:\USERS\ALEXANDER ROBOTNICK\DESKTOP\TEST1.ASM 15 : Found directive in column 1. (__CONFIG)
Error[113] C:\USERS\ALEXANDER ROBOTNICK\DESKTOP\TEST1.ASM 27 : Symbol not previously defined (b’00000000’)
Warning[224] C:\USERS\ALEXANDER ROBOTNICK\DESKTOP\TEST1.ASM 28 : Use of this instruction is not recommended.
Warning[205] C:\USERS\ALEXANDER ROBOTNICK\DESKTOP\TEST1.ASM 35 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Users\Alexander Robotnick\Desktop\Test1.mcp' failed.
Language tool versions: MPASMWIN.exe v5.43, mplink.exe v4.41, mplib.exe v4.41
Preprocessor symbol `__DEBUG' is defined.
Fri Feb 17 15:12:20 2012
----------------------------------------------------------------------
BUILD FAILED
-Dave