Pozdrav svima
na internetu sam nasao jedan kod za pic16f84a i koji kad povezem sa kompom preko seriskog porta i pokrenem hiper terminal on ispise npr. Zdravo!. Skinuo sam MPlab sa net i kod ubacio u njega i kad sam kliknuo na buid izbacio mi je neke silne greske u cemu je problem??
; ****** Tabela sa tekstom ******
Text addwf PCL,F ; dodaje se na PCL
retlw 'Z' ; Vraca karakter “Z“
retlw 'd' ; Vraca karakter “d“
retlw 'r' ; Vraca karakter “r“
retlw 'a' ; Vraca karakter “a“
retlw 'v' ; Vraca karakter “v“
retlw 'o' ; Vraca karakter “o“
retlw '!' ; Vraca karakter “!“
retlw 0x0d ; Vraca znak Return
retlw 0x0a ; Vraca oznaku za novi red
retlw 0x00 ; Oznacava kraj teksta
Uzmi movwf POINTER ; Postavi vrednost iz W u pointer poruke
Pet movf POINTER,W ; Stavi pointer u W
call Text ; Vraca ASCII karakter u W
addlw 0x00 ; Setuje Zero flag ako je W = 0
btfsc STATUS,Z ; Preskace ako Zero flag nije setovan
return ; Završava podprogram ako je W = 0
call Slan ; Šalje karakter na serijski port
incf POINTER,F ; Pozicioniraj pointer na sledeci karakter
goto Pet ; Još karaktera
Izl movwf TXREG ; Stavi W u registar predaje
movlw 0x08 ; 8 bitova podataka
movwf BITOVI ; Brojac za bitove
bsf PORTA,2 ; Startni bit (izokrenut, secate se) +5V na RA2
Pet movlw .49 ; 49 decimalno, vreme za kasnjenje
call Pau4 ; U podprogramu za pauzu cekaj 49*4=196µS
rrf TXREG,F ; Prebaci zadnji desni bit u Carry flag.
btfsc STATUS,C ; Ako je Carry flag = 0, želi se setovanje bita
; (nizak naponski nivo)
goto Obr ; u protivnom je bit = 0 (visok nivo)
bsf PORTA,2 ; +5V na pinu 1 (RA2)
goto Kraj ; Je li gotovo?
Obr bcf PORTA,2 ; 0V na pinu 1 (RA2)
nop ; da bi obe opcije trajale tacno 12µS
Kraj decfsz BITOVI,F ; 1 bit manje. Preskoci kada dode do 0
goto Pet ; ima još bitova. Kašnjenje za slanje ovog.
movlw .52 ; 52 decimalo, vreme za kašnjenje 208µS
call Pau4 ; Kasnjenje za zadnji bit podataka
bcf PORTA,2 ; 0V (visoko stanje) za stop bitove
movlw .104 ; 104 decimalno
call Pau4 ; za 2 stop bita
return ; Povratak
Slan bsf STATUS,RP0 ; Prebacuje u BANK1
movlw 0x00 ; Postavlja sve pinove kao izlazne
movwf TRISA ; na PORTA
bcf STATUS,RP0 ; Vraca u BANK0
clrf PORTA ; RA2 = 0 (RS232 visoko stanje)
movlw .50 ; Kasnjenje od 50 mS
call Kas ; preko podprograma za duže pauze
movlw 0x00 ; Ofset za prvi karakter poruke
call Izl ; Slanje poruke u kompjuter
Blok goto Blok ; Kraj u beskonacnoj petlji
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Autor ;DaTi
; Datum ;3.12.2007
; Verzija ;0.1
; Naslov ;rs232 komunikacija
; ;
; Opis ;
; ;
; ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
list p=16F84
#include <p16F84.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _RC_OSC
ORG 0x00
; ****** Tabela sa tekstom ******
Text addwf PCL,F ; dodaje se na PCL
retlw 'Z' ; Vraca karakter “Z“
retlw 'd' ; Vraca karakter “d“
retlw 'r' ; Vraca karakter “r“
retlw 'a' ; Vraca karakter “a“
retlw 'v' ; Vraca karakter “v“
retlw 'o' ; Vraca karakter “o“
retlw '!' ; Vraca karakter “!“
retlw 0x0d ; Vraca znak Return
retlw 0x0a ; Vraca oznaku za novi red
retlw 0x00 ; Oznacava kraj teksta
Uzmi movwf POINTER ; Postavi vrednost iz W u pointer poruke
Pet movf POINTER,W ; Stavi pointer u W
call Text ; Vraca ASCII karakter u W
addlw 0x00 ; Setuje Zero flag ako je W = 0
btfsc STATUS,Z ; Preskace ako Zero flag nije setovan
return ; Završava podprogram ako je W = 0
call Slan ; Šalje karakter na serijski port
incf POINTER,F ; Pozicioniraj pointer na sledeci karakter
goto Pet ; Još karaktera
Izl movwf TXREG ; Stavi W u registar predaje
movlw 0x08 ; 8 bitova podataka
movwf BITOVI ; Brojac za bitove
bsf PORTA,2 ; Startni bit (izokrenut, secate se) +5V na RA2
Pet movlw .49 ; 49 decimalno, vreme za kasnjenje
call Pau4 ; U podprogramu za pauzu cekaj 49*4=196µS
rrf TXREG,F ; Prebaci zadnji desni bit u Carry flag.
btfsc STATUS,C ; Ako je Carry flag = 0, želi se setovanje bita
; (nizak naponski nivo)
goto Obr ; u protivnom je bit = 0 (visok nivo)
bsf PORTA,2 ; +5V na pinu 1 (RA2)
goto Kraj ; Je li gotovo?
Obr bcf PORTA,2 ; 0V na pinu 1 (RA2)
nop ; da bi obe opcije trajale tacno 12µS
Kraj decfsz BITOVI,F ; 1 bit manje. Preskoci kada dode do 0
goto Pet ; ima još bitova. Kašnjenje za slanje ovog.
movlw .52 ; 52 decimalo, vreme za kašnjenje 208µS
call Pau4 ; Kasnjenje za zadnji bit podataka
bcf PORTA,2 ; 0V (visoko stanje) za stop bitove
movlw .104 ; 104 decimalno
call Pau4 ; za 2 stop bita
return ; Povratak
Slan bsf STATUS,RP0 ; Prebacuje u BANK1
movlw 0x00 ; Postavlja sve pinove kao izlazne
movwf TRISA ; na PORTA
bcf STATUS,RP0 ; Vraca u BANK0
clrf PORTA ; RA2 = 0 (RS232 visoko stanje)
movlw .50 ; Kasnjenje od 50 mS
call Kas ; preko podprograma za duže pauze
movlw 0x00 ; Ofset za prvi karakter poruke
call Izl ; Slanje poruke u kompjuter
Blok goto Blok ; Kraj u beskonacnoj petlji
end
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p18F452 "dati.asm" /l"dati.lst" /e"dati.err"
Warning[205] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 12 : Found directive in column 1. (list)
Warning[215] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 12 : Processor superseded by command line. Verify processor symbol.
Message[301] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F84.INC 37 : MESSAGE: (Processor-header file mismatch. Verify selected processor.)
Error[126] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F84.INC 116 : Argument out of range (must be greater than or equal to 255)
Error[126] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F84.INC 117 : Argument out of range (__MAXRAM must be used first)
Error[126] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F84.INC 117 : Argument out of range (__MAXRAM must be used first)
Error[126] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F84.INC 117 : Argument out of range (__MAXRAM must be used first)
Warning[205] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 14 : Found directive in column 1. (__CONFIG)
Warning[230] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 14 : __CONFIG has been deprecated for PIC18 devices. Use directive CONFIG.
Error[126] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 14 : Argument out of range (not a valid config register address)
Warning[205] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 15 : Found directive in column 1. (ORG)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 18 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 19 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 20 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 21 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 22 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 23 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 24 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 25 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 26 : Found opcode in column 1. (retlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 27 : Found opcode in column 1. (retlw)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 28 : Symbol not previously defined (POINTER)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 29 : Symbol not previously defined (POINTER)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 30 : Found opcode in column 1. (call)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 31 : Found opcode in column 1. (addlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 32 : Found opcode in column 1. (btfsc)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 33 : Found opcode in column 1. (return)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 34 : Found opcode in column 1. (call)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 35 : Found opcode in column 1. (incf)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 35 : Symbol not previously defined (POINTER)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 36 : Found opcode in column 1. (goto)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 37 : Symbol not previously defined (TXREG)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 38 : Found opcode in column 1. (movlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 39 : Found opcode in column 1. (movwf)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 39 : Symbol not previously defined (BITOVI)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 40 : Found opcode in column 1. (bsf)
Error[116] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 41 : Address label duplicated or different in second pass (Pet)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 42 : Found opcode in column 1. (call)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 42 : Symbol not previously defined (Pau4)
Error[122] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 43 : Illegal opcode (TXREG)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 44 : Found opcode in column 1. (btfsc)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 46 : Found opcode in column 1. (goto)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 47 : Found opcode in column 1. (bsf)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 48 : Found opcode in column 1. (goto)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 50 : Found opcode in column 1. (nop)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 51 : Symbol not previously defined (BITOVI)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 52 : Found opcode in column 1. (goto)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 53 : Found opcode in column 1. (movlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 54 : Found opcode in column 1. (call)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 54 : Symbol not previously defined (Pau4)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 55 : Found opcode in column 1. (bcf)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 56 : Found opcode in column 1. (movlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 57 : Found opcode in column 1. (call)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 57 : Symbol not previously defined (Pau4)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 58 : Found opcode in column 1. (return)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 60 : Found opcode in column 1. (movlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 61 : Found opcode in column 1. (movwf)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 62 : Found opcode in column 1. (bcf)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 63 : Found opcode in column 1. (clrf)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 64 : Found opcode in column 1. (movlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 65 : Found opcode in column 1. (call)
Error[113] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 65 : Symbol not previously defined (Kas)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 66 : Found opcode in column 1. (movlw)
Warning[203] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 67 : Found opcode in column 1. (call)
Warning[205] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 69 : Found directive in column 1. (end)
Error[173] C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM 70 : Source file path exceeds 62 characters (C:\DOCUMENTS AND SETTINGS\DAMIR\MY DOCUMENTS\DAMIR\RS232\DATI.ASM)
Halting build on first failure as requested.
BUILD FAILED: Mon Dec 03 10:32:01 2007