;********************************************************************** ; This file is a basic code template for object module code * ; generation on the PICmicro PIC16F873A. This file contains the * ; basic code building blocks to build upon. As a project minimum * ; the 16F873A.lkr file will also be required for this file to * ; correctly build. The .lkr files are located in the MPLAB * ; directory. * ; * ; If interrupts are not used all code presented between the * ; code section "INT_VECTOR and code section "MAIN" can be removed. * ; In addition the variable assignments for 'w_temp' and * ; 'status_temp' can be removed. * ; * ; If interrupts are used, as in this template file, the 16F873A.lkr * ; file will need to be modified as follows: Remove the lines * ; CODEPAGE NAME=vectors START=0x0 END=0x4 PROTECTED * ; and * ; SECTION NAME=STARTUP ROM=vectors * ; and change the start address of the page0 section from 0x5 to 0x0 * * ; * ; Refer to the MPASM User's Guide for additional information on * ; features of the assembler and linker (Document DS33014). * ; * ; Refer to the respective PICmicro data sheet for additional * ; information on the instruction set. * ; * ;********************************************************************** ; * ; Filename: xxx.asm * ; Date: * ; File Version: * ; * ; Author: * ; Company: * ; * ; * ;********************************************************************** ; * ; Files required: * ; 16F873a.lkr * ; * ; * ;********************************************************************** ; * ; Notes: * ; * ; * ; * ; * ;********************************************************************** list p=16F873A ; list directive to define processor #include ; processor specific variable definitions __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_ON & _CPD_OFF ; '__CONFIG' directive is used to embed configuration data within .asm file. ; The lables following the directive are located in the respective .inc file. ; See respective data sheet for additional information on configuration word. ERRORLEVEL -302 ; Unterdrücken BANK SELECTION MESSAGES ; Dies unterdrückt im Compiler die Nachricht "Register in operand not in bank 0. ;****************************************************************** ; variablen v equ 0x60 ;*************************************************************** ; mathe routine einfügen INCLUDE ; PIC16 device specific definitions ;P16_MAP2 SET 0xFF ; Use the PIC16F873a memory map ;P16CXX SET TRUE ;P16_MAP2 SET TRUE INCLUDE ; PIC16 math library definitions ;************************************************************************* ;********************************************************************** ORG 0x000 ; processor reset vector nop ; nop required for icd goto main ; go to beginning of program main ;Multiplikation ; 16bit mal 8bit , 3214 * Radumfang (radu) movlw 0x8E ; laden von 0C8E(3214) in multiplikation movwf AARGB0 movlw 0x0C movwf AARGB1 movlw d'207' ; laden von Radumfang in multiplikation movwf BARGB0 call FXM1608U ; max 126 cycles ; ergebnis in AARGB0, AARGB1, AAEGB2 ;Division ; 24bit/16bit , ergebnis multiplikation : zählerstand timer1 ; ergebnis von multiplikation ist startwert für division (AARGB0, AARGB1, AAEGB2) movlw 0x00 movfw AARGB3 ; 32bit division...oberstes byte 0 laden movlw 0xFF ; aktueller Zählerstand in division laden movwf BARGB0 movlw 0xFF movwf BARGB1 movlw 0x00 ; aktueller Zählerstand in division laden movwf BARGB2 call FXD3224U ; max 529 cycles ;ergebnis in AARGB0, AARGB1, AAEGB2 und rest in REMB0, REMB1 movf AARGB0,0 ; geschwindigkeit laden-> kleiner 256 deshalb nur in AARGB0 movwf v ; aktuelle geschwindigkeit in v (vorkommawert, z.B. 30) goto main ; applikationen einbinden #include ; Fixed-multiplication routines (24 bits = 16 bits x 8 bits) #include end