マイコンを使った工作
pnseqpic.asm
最終更新:
匿名ユーザー
-
view
pnseqpic.asm
;********************************************************************** ; * ; Filename: pnseqpic.asm * ; Date: 23, August, 2003 * ; File Version: version 1.00 * ; Target: PIC12C509A * ; * ; Author: Chuck * ; * ;********************************************************************** ; * ; Notes: * ; This program is free software; you can redistribute it and/or * ; modify it under the terms of the GNU General Public License * ; as published by the Free Software Foundation; either version 2 * ; of the License, or (at your option) any later version. * ; * ; This program is distributed in the hope that it will be useful, * ; but WITHOUT ANY WARRANTY; without even the implied warranty of * ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * ; GNU General Public License for more details. * ; * ; You should have received a copy of the GNU General Public License * ; along with this program; if not, write to * ; the Free Software Foundation, Inc., * ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ; * ;********************************************************************** ; * ; Template file assembled with MPLAB V3.99.18 and MPASM V2.15.06. * ; * ;********************************************************************** list p=12c509a ; list directive to define processor #include ; processor specific variable definitions __CONFIG _CP_OFF & _WDT_OFF & _MCLRE_OFF & _IntRC_OSC __IDLOCS H'0100' ;V1.00, 23 AUG 2003 ; '__CONFIG' directive is used to embed configuration word 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. ;***** VARIABLE DEFINITIONS temp EQU 0x07 ;example variable definition cblock H'08' SREGH SREGM SREGL GPIOOUT TAPREG endc NOISE EQU 0 ; GP0 noise output IOSET EQU H'3E' ; TAP_A EQU 7 TAP_B EQU 6 TAP_C EQU 6 TAP_D EQU 0 ; SREGH SREGM SREGL ; 7......07......07.......0 ; 23......................0 ; 23, 22, 14, 0 -> tapping ;********************************************************************** ORG 0x3FF ; processor reset vector ; Internal RC calibration value is placed at location 0x3FF by Microchip ; as a movlw k, where the k is a literal value. ORG 0x000 ; coding begins here movwf OSCCAL ; update register with factory cal value ; remaining code goes here movlw H'D0' ; 1101-0000 option movlw IOSET TRIS GPIO clrf GPIOOUT movf GPIOOUT,W movwf GPIO clrf TAPREG movlw H'AA' movwf SREGH movwf SREGL movlw H'0F' movwf SREGM LOOP ; clrf FSR movlw H'00' btfsc SREGH,TAP_A ; SREGH.TAP_A = 0, then skip next line movlw H'01' movwf TAPREG movlw H'00' btfsc SREGH,TAP_B ; SREGH.TAP_B = 0, then skip next line movlw H'01' xorwf TAPREG,F movlw H'00' btfsc SREGL,TAP_C ; SREGL.TAP_C = 0, then skip next line movlw H'01' xorwf TAPREG,F movlw H'00' btfsc SREGL,TAP_D ; SREGL.TAP_D = 0, then skip next line movlw H'01' xorwf TAPREG,F bsf GPIOOUT,NOISE ; NOISE output btfss SREGL,NOISE bcf GPIOOUT,NOISE movf GPIOOUT,W movwf GPIO bcf STATUS,W ; Shift btfsc TAPREG,NOISE bsf STATUS,W rrf SREGH,F rrf SREGM,F rrf SREGL,F goto LOOP END ; directive 'end of program'