Continue to Site

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.

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

errors from MPASM when i run this program

Status
Not open for further replies.

charles01

New Member
list p=16F876 ;define target processor

#include <p16f876.inc> ;include processor specific definitions
RADIX HEX

__CONFIG, _CONFIG1 _T1OS0_ON & _CCP1_ON & _CCP2_ON & _WDT_OFF & _STVERN_ON
_CONFIG2 _XINST_OFF & _CP0_OFF & _FOSC_ECPLL & _FOSC2_ON &_IESO_OFF & _WDTPS_32768
; Constants
#define CHANNEL .000;

CBLOCK 0x8
CountH ;16-bit counter
CountL
RxBuffer: .512 ;512 bytes buffer allocation
ENDC

ORG 0x0
Main
call SetupSerial ;Setup Serial port and buffers
MainLoop

WaitBreak
btfsc PIR1,RCIF ; if a byte is received correctly
movf RCREG,W ; discard it
btfss RCSTA,FERR ; else
goto WaitBreak ; continue waiting until a frame error is detected
movf RCREG,W ; read the Receive buffer to clear the error condition


WaitForStart
btfss PIR1,RCIF ; wait until a byte is correctly received
goto WaitForStart
btfsc RCSTA,FERR
goto WaitForStart
movf RCREG,W

; check for the START code value
andlw 0xff
bnz MainLoop ; ignore the rest of the frame if not zero

; init receive counter and buffer pointer
clrf CountL
clrf CountH
lfsr RxBuffer

; third loop, receiving 512 bytes of data
WaitForData
btfsc RCSTA,FERR
goto RXend
; attempted
btfss PIR1,RCIF
goto WaitForData ;
movf RCREG,W ; MoveData
movwf POSTINC0

; (auto-incrementing pointer)

incf CountL,F ; increment 16-bit counter
btfss STATUS,C
goto WaitForData
incf CountH,F
btfss CountH,1 ; check if 512 bytes of data received
goto WaitForData


RXend
lfsr RxBuffer ; use indirect pointer 0 to address the receiver buffer
GetData
movlw LOW(CHANNEL) ; add the offset for the select channel
addwf FSR0L,F
movlw HIGH(CHANNEL)
addwfc FSR0H,F
movff INDF,CCPR2L ; retrieve the data and assign MSB to control PWM2
movff INDF,CCPR1L ; retreive the data and assign MSB to control PWM1

goto MainLoop ; return to main loop

; Setup Serial port and buffers
SetupSerial
; Clear the receive buffer

lfsr RxBuffer
CBloop
clrf POSTINC0 ; clear INDF register then increment pointer
incf CountL,F
btfss STATUS,C
goto CBloop
incf CountH,F
btfss CountH,1
goto CBloop
; Setup EUSART

bsf TRISC,B'10000000' ; allow the EUSART RX to control pin RC7
bsf TRISC,B'10000000'; allow the EUSART TX to control pin RC6
movlw 0x04 ; Disable transmission
movwf TXSTA ; enable transmission and CLEAR high baud rate
movlw 0x90
movwf RCSTA ; enable serial port and reception
bsf BAUDCON,BRG16 ; Enable UART for 16-bit Asyn operation
clrf SPBRGH
movlw .15 ; Baud rate is 250KHz for 16MHz Osc. freq.
movwf SPBRGH
; Setup PWM module

movlw 0x0c ; configure CCP2 for PWM mode
movwf CCP2CON
movlw 0x0c ; configure CCP1 for PWM mode
movwf CCP1CON
movlw 0X09 ; configure TIMER1 FOR OSCILLATOR OUTPUT
movwf T1CON

; Timer2 control
movlw 0x04 ; enable Timer2, select a prescale of 1:1
movwf T2CON
; PWM period
movlw 0xFF ; 256 x .25us = 64us period
movwf PR2
; init I/O
movlw b'11111111' ; make pins on port b input
movwf TRISB
; init I/O
movlw b'00000000' ; make pins on port a output
movwf TRISA
; init I/O
movlw b'10010000' ; make pins on port c input or output
movwf TRISC
return
END
Clean: Deleting intermediary and output files.
Clean: Done.
 
hi Charles,
What errors are displayed in the MPLAB output window.?
 
You can't take code written for an 18 series chip and just change the include file to 16F876.

Mike.
 
thank you, i am getting the following errors:
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F876 "dmx512.asm" /l"dmx512.lst" /e"dmx512.err" /o"dmx512.o" /c-
Error[113] C:\MY PROJECT\DMX512.ASM 15 : Symbol not previously defined (CONFIG1)
Error[113] C:\MY PROJECT\DMX512.ASM 15 : Symbol not previously defined (_T1CON_ON)
Error[112] C:\MY PROJECT\DMX512.ASM 15 : Missing operator
Warning[207] C:\MY PROJECT\DMX512.ASM 16 : Found label after column 1. (CONFIG2)
Error[122] C:\MY PROJECT\DMX512.ASM 16 : Illegal opcode (_XINST_OFF)
Warning[207] C:\MY PROJECT\DMX512.ASM 27 : Found label after column 1. (MAIN)
Warning[207] C:\MY PROJECT\DMX512.ASM 29 : Found label after column 1. (START)
Warning[207] C:\MY PROJECT\DMX512.ASM 31 : Found label after column 1. (WAITBREAK)
Warning[207] C:\MY PROJECT\DMX512.ASM 39 : Found label after column 1. (WAITFORSTART)
Warning[219] C:\MY PROJECT\DMX512.ASM 51 : Invalid RAM location specified.
Warning[219] C:\MY PROJECT\DMX512.ASM 52 : Invalid RAM location specified.
Error[113] C:\MY PROJECT\DMX512.ASM 53 : Symbol not previously defined (RXBUF)
Warning[207] C:\MY PROJECT\DMX512.ASM 56 : Found label after column 1. (WAITFORDATA)
Error[113] C:\MY PROJECT\DMX512.ASM 63 : Symbol not previously defined (POSTINC0)
Warning[219] C:\MY PROJECT\DMX512.ASM 67 : Invalid RAM location specified.
Warning[219] C:\MY PROJECT\DMX512.ASM 70 : Invalid RAM location specified.
Warning[219] C:\MY PROJECT\DMX512.ASM 71 : Invalid RAM location specified.
Warning[207] C:\MY PROJECT\DMX512.ASM 77 : Found label after column 1. (RXEND)
Warning[207] C:\MY PROJECT\DMX512.ASM 79 : Found label after column 1. (GETDATA)
Error[113] C:\MY PROJECT\DMX512.ASM 81 : Symbol not previously defined (FSR0L)
Error[113] C:\MY PROJECT\DMX512.ASM 83 : Symbol not previously defined (FSR0H)
Error[108] C:\MY PROJECT\DMX512.ASM 84 : Illegal character (,)
Error[108] C:\MY PROJECT\DMX512.ASM 85 : Illegal character (,)
Warning[207] C:\MY PROJECT\DMX512.ASM 90 : Found label after column 1. (SETUPSERIAL)
Warning[207] C:\MY PROJECT\DMX512.ASM 94 : Found label after column 1. (CBLOOP)
Error[113] C:\MY PROJECT\DMX512.ASM 95 : Symbol not previously defined (POSTINC0)
Warning[219] C:\MY PROJECT\DMX512.ASM 96 : Invalid RAM location specified.
Warning[219] C:\MY PROJECT\DMX512.ASM 99 : Invalid RAM location specified.
Warning[219] C:\MY PROJECT\DMX512.ASM 100 : Invalid RAM location specified.
Message[302] C:\MY PROJECT\DMX512.ASM 104 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[202] C:\MY PROJECT\DMX512.ASM 104 : Argument out of range. Least significant bits used.
Message[302] C:\MY PROJECT\DMX512.ASM 105 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[202] C:\MY PROJECT\DMX512.ASM 105 : Argument out of range. Least significant bits used.
Message[302] C:\MY PROJECT\DMX512.ASM 107 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[113] C:\MY PROJECT\DMX512.ASM 110 : Symbol not previously defined (BAUDCON)
Error[113] C:\MY PROJECT\DMX512.ASM 110 : Symbol not previously defined (BRG16)
Error[113] C:\MY PROJECT\DMX512.ASM 111 : Symbol not previously defined (SPBRGH)
Error[113] C:\MY PROJECT\DMX512.ASM 113 : Symbol not previously defined (SPBRGH)
Message[302] C:\MY PROJECT\DMX512.ASM 128 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\MY PROJECT\DMX512.ASM 131 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[128] C:\MY PROJECT\DMX512.ASM 131 : Missing argument(s)
Message[302] C:\MY PROJECT\DMX512.ASM 137 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[128] C:\MY PROJECT\DMX512.ASM 137 : Missing argument(s)
Message[302] C:\MY PROJECT\DMX512.ASM 143 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[128] C:\MY PROJECT\DMX512.ASM 143 : Missing argument(s) Halting build on first failure as requested.
BUILD FAILED: Tue Feb 02 09:13:34 2010
 
i am trying to use the PIC16F876 to run three LEDs which will respond to the DMX512 input signal

hi,
As Pommie has explained you cannot just change the PIC type.

If you wish to use a 16F876 you MUST use the correct CONFIG also the correct statements in the program.:)
 
I was trying to follow the example form the books and i guess they don't put everything
What is the difference with the CONFIG for the 18F and the 16F PICs
Now i have to find the correct coding for the PIC16F876.
There is an example in document AN1076 from microchip and it uses the PIC18F so i thought it might do the trick.
 
I was trying to follow the example form the books and i guess they don't put everything
What is the difference with the CONFIG for the 18F and the 16F PICs
Now i have to find the correct coding for the PIC16F876.
There is an example in document AN1076 from microchip and it uses the PIC18F so i thought it might do the trick.

hi Charles,
The difference between the 18F and 16F CONFIGs is major.

Look at Nigels PIC tutorials, the link is near my signature on this post.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top