I am trying the basic serial communication test on ASM, but having this error:
The error message:
Code:
;
;
;
list p=16F88, r=DEC
errorlevel -302
#include <p16f88.inc>
__config _CONFIG1, _BODEN_OFF & _WDT_OFF & _LVP_OFF & _MCLR_OFF & _PWRTE_ON & _INTRC_IO
;----------------------
; DECLARE VARIABLES
;----------------------
UDATA
tmp1 res 1
;----------------------
; START
;----------------------
main code
movlw 7
movwf CMCON ; CMCON = 7 set comperators off
banksel TRISB
movlw b'00000100' ; RB2 is RX, and is therefore an input
movwf TRISB
banksel SPBRG
movlw 0x19 ; 0x19=9600 bps (0x0C=19200 bps)
movwf SPBRG
movlw b'00100100' ; brgh = high (2)
movwf TXSTA ; enable Async Transmission, set brgh
banksel RCSTA
movlw b'10010000' ; enable Async Reception
movwf RCSTA
; Provide a settling time for startup
clrf tmp1
settle
decfsz tmp1, f
goto settle
movf RCREG, W ; Flush RX buffer
movf RCREG, W
movf RCREG, W
; Send a character through the UART
loop
movlw 'A'
call send
goto loop
goto $
;----------------------
; RECEIVE function
;----------------------
receive
btfss PIR1, RCIF ; Check if data has been received
goto receive
movf RCREG, W ; Save received data in W
return
;----------------------
; SEND function
;----------------------
send
movwf TXREG ; Send data which has been stored in W
trans_wt
banksel TXSTA
btfss TXSTA, TRMT ; Loop until data is sent
goto trans_wt
return
end
The error message:
Code:
----------------------------------------------------------------------
Debug build of project `D:\Test\Test.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Sun Mar 15 00:33:51 2009
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F88 "f3c2a2afe.asm" /l"f3c2a2afe.lst" /e"f3c2a2afe.err" /d__DEBUG=1
Error[149] D:\TEST\F3C2A2AFE.ASM 14 : Directive only allowed when generating an object file
Error[149] D:\TEST\F3C2A2AFE.ASM 21 : Directive only allowed when generating an object file
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `D:\Test\Test.mcp' failed.
Preprocessor symbol `__DEBUG' is defined.
Sun Mar 15 00:33:52 2009
----------------------------------------------------------------------
BUILD FAILED