assembly 16f628a derleme sorunu

Başlatan ahmetguvenn, 01 Temmuz 2018, 17:51:06

ahmetguvenn

iyi günler
assembly diliyle 16f628a programlamayı öğrenmeye çalışıyorum.
aşağıdaki kodları yazıyor ve derliyorum.
--------------------------------------------------------------------
LIST P=16F628A
INCLUDE "P16F628A.INC"
__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF


ORG h'0000'
CLRF PORTB
BANKSEL TRISB
CLRF TRISB
BANKSEL PORTB
BASLA
MOVLW h'55'
MOVWF PORTB
DONGU
GOTO DONGU
END
-------------------------------------------------------------------------
derleme sonucunda şu sonuç çıkıyor.
__________________________________________________________________________________
----------------------------------------------------------------------
Debug build of project `C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.mcp' started.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Preprocessor symbol `__DEBUG' is defined.
Sun Jul 01 17:42:39 2018
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.o".
Clean: Deleted file "C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.err".
Clean: Deleted file "C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.lst".
Clean: Deleted file "C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.cof".
Clean: Deleted file "C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.hex".
Clean: Deleted file "C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.mcs".
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F628A "sss.asm" /l"sss.lst" /e"sss.err" /o"sss.o" /d__DEBUG=1
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 1 : Found directive in column 1. (LIST)
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 2 : Found directive in column 1. (INCLUDE)
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 3 : Found directive in column 1. (__CONFIG)
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 6 : Found directive in column 1. (ORG)
Warning[203] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 7 : Found opcode in column 1. (CLRF)
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 8 : Found directive in column 1. (BANKSEL)
Warning[203] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 9 : Found opcode in column 1. (CLRF)
Message[302] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 9 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 10 : Found directive in column 1. (BANKSEL)
Warning[203] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 12 : Found opcode in column 1. (MOVLW)
Warning[203] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 13 : Found opcode in column 1. (MOVWF)
Warning[203] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 15 : Found opcode in column 1. (GOTO)
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\YENI KLASöR\SSS.ASM 16 : Found directive in column 1. (END)
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe" /p16F628A "sss.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"sss.cof" /M"sss.map" /W
MPLINK 4.48, Linker
Device Database Version 1.12
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors    : 0

MP2HEX 4.48, COFF to HEX File Converter
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors    : 0

Loaded C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.cof.
----------------------------------------------------------------------
Debug build of project `C:\Users\asus\Desktop\pic uygulama\Yeni klasör\sss.mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Preprocessor symbol `__DEBUG' is defined.
Sun Jul 01 17:42:41 2018
----------------------------------------------------------------------
BUILD SUCCEEDED
___________________________________________________________________________
bu derleme sonucunda hex dosyasını proteusta simule ettiğimde uygulama çalışmıyor.Aşağıda eklediğim hatayı veriyor. Yardımcı olursanız sevinirim.

ahmetguvenn

iyi günler
assembly diliyle 16f628a programlamayı öğrenmeye çalışıyorum.
aşağıdaki kodları yazıyor ve derliyorum.
;======PROG6.ASM====BOLUM7===SYF:116
LIST P=16F628A
INCLUDE	"P16F628A.INC"
__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
;------------------------------------------------------------------------------------------------
SAYAC1	EQU	h'20'
SAYAC2	EQU	h'21'
	BANKSEL	TRISB
	CLRF	TRISB
	MOVLW	h'FF'
	MOVWF	TRISA
	BANKSEL	PORTB
	MOVLW	h'07'
	MOVWF	CMCON
	CLRF	PORTB
	
BASLA
	MOVLW	h'0A'
	MOVWF	SAYAC1
TEST
	BTFSC	PORTA,0
	GOTO	TEST
	MOVLW	h'FF'
	MOVWF	SAYAC2
GECIKME
	NOP
	NOP
	NOP
	DECFSZ	SAYAC2,F
	GOTO GECIKME
AZALT
	DECFSZ	SAYAC1,F
	GOTO YAK
	GOTO BASLA
YAK
	MOVF	SAYAC1,W
	MOVWF	PORTB
	GOTO 	TEST
	END
derleme sonucuda aşağıdaki hatayı veriyor.
----------------------------------------------------------------------
Debug build of project `C:\Users\asus\Desktop\pic uygulama\KitapProgramlar1\prog6.mcp' started.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Preprocessor symbol `__DEBUG' is defined.
Mon Jul 09 14:39:28 2018
----------------------------------------------------------------------
Make: The target "C:\Users\asus\Desktop\pic uygulama\KitapProgramlar1\prog6.o" is out of date.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F628A "prog6.asm" /l"prog6.lst" /e"prog6.err" /o"prog6.o" /d__DEBUG=1
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 2 : Found directive in column 1. (LIST)
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 3 : Found directive in column 1. (INCLUDE)
Warning[205] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 4 : Found directive in column 1. (__CONFIG)
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 8 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 8 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 9 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 9 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 10 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 11 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 11 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 12 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 12 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 13 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 14 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 15 : Executable code and data must be defined in an appropriate section
Error[150]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 17 : Labels must be defined in a code or data section when making an object file
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 18 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 19 : Executable code and data must be defined in an appropriate section
Error[150]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 20 : Labels must be defined in a code or data section when making an object file
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 21 : Executable code and data must be defined in an appropriate section
Error[151]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 22 : Operand contains unresolvable labels or is too complex
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 22 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 23 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 24 : Executable code and data must be defined in an appropriate section
Error[150]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 25 : Labels must be defined in a code or data section when making an object file
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 26 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 27 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 28 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 29 : Executable code and data must be defined in an appropriate section
Error[151]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 30 : Operand contains unresolvable labels or is too complex
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 30 : Executable code and data must be defined in an appropriate section
Error[150]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 31 : Labels must be defined in a code or data section when making an object file
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 32 : Executable code and data must be defined in an appropriate section
Error[151]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 33 : Operand contains unresolvable labels or is too complex
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 33 : Executable code and data must be defined in an appropriate section
Error[151]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 34 : Operand contains unresolvable labels or is too complex
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 34 : Executable code and data must be defined in an appropriate section
Error[150]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 35 : Labels must be defined in a code or data section when making an object file
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 36 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 37 : Executable code and data must be defined in an appropriate section
Error[151]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 38 : Operand contains unresolvable labels or is too complex
Error[152]   C:\USERS\ASUS\DESKTOP\PIC UYGULAMA\KITAPPROGRAMLAR1\PROG6.ASM 38 : Executable code and data must be defined in an appropriate section
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Users\asus\Desktop\pic uygulama\KitapProgramlar1\prog6.mcp' failed.
Language tool versions: MPASMWIN.exe v5.50, mplink.exe v4.48, mplib.exe v4.48
Preprocessor symbol `__DEBUG' is defined.
Mon Jul 09 14:39:29 2018
----------------------------------------------------------------------
BUILD FAILED
yardımcı olursanız sevinirim

Tagli

Kod başlangıç adresini "org" ile işaretlememişsin, o yüzden hata veriyor. İlk mesajındaki kodda doğru bir şekilde yapılmış bu.

MPLAB'in kurulum klasörünün içinde her işlemci için hazır kod şablonu bulunur. Bunları incelemen fikir verecektir.

PIC16F628A için olanı aşağıda:
;**********************************************************************
;  This file is a basic code template for assembly code generation  *
;  on the PIC16F628A. This file contains the basic code              *
;  building blocks to build upon.                                    *
;                                                                    *
;  Refer to the MPASM User's Guide for additional information on    *
;  features of the assembler (Document DS33014).                    *
;                                                                    *
;  Refer to the respective PIC data sheet for additional            *
;  information on the instruction set.                              *
;                                                                    *
;**********************************************************************
;                                                                    *
;    Filename:     xxx.asm                                          *
;    Date:                                                            *
;    File Version:                                                    *
;                                                                    *
;    Author:                                                          *
;    Company:                                                        *
;                                                                    *
;                                                                    *
;**********************************************************************
;                                                                    *
;    Files Required: P16F628A.INC                                    *
;                                                                    *
;**********************************************************************
;                                                                    *
;    Notes:                                                          *
;                                                                    *
;**********************************************************************

 list      p=16f628A          ; list directive to define processor
 #include <p16F628A.inc>      ; processor specific variable definitions

 errorlevel  -302              ; suppress message 302 from list file

 __CONFIG  _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT 

; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.




;***** VARIABLE DEFINITIONS
w_temp        EQU    0x7E        ; variable used for context saving 
status_temp  EQU    0x7F        ; variable used for context saving





;**********************************************************************
 ORG    0x000            ; processor reset vector
 goto    main              ; go to beginning of program
 

 ORG    0x004            ; interrupt vector location
 movwf  w_temp            ; save off current W register contents
 movf STATUS,w          ; move status register into W register
 movwf status_temp      ; save off contents of STATUS register

; isr code can go here or be located as a call subroutine elsewhere


 movf    status_temp,w    ; retrieve copy of STATUS register
 movwf STATUS            ; restore pre-isr STATUS register contents
 swapf  w_temp,f
 swapf  w_temp,w          ; restore pre-isr W register contents
 retfie                    ; return from interrupt


main

; remaining code goes here

 goto main   ;loop forever, remove this instruction, for test only


; initialize eeprom locations

 ORG 0x2100
 DE 0x00, 0x01, 0x02, 0x03


 END                      ; directive 'end of program'
Gökçe Tağlıoğlu

bigbey


LIST P=16F628A
INCLUDE "P16F628A.INC"
__CONFIG    satırlarını tab ile satır başından ileri öteledim ve derledim hata görünmedi
TA6R

kudretuzuner

Amatör