⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sv2109.asm

📁 VCP201_CODE is a FPGA source code.
💻 ASM
字号:
;==========================================================================
; File Name : p303.asm
;
; Rev:   Date:    Author:     Reason:
; 1.00   18-06-96 C.H.Lai     First Version
;==========================================================================

        LIST            R=DEC,LINES=0,COLUMNS=120,NOWRAP,XREF=YES

;==========================================================================
; use reg. bank 0 by default. switch to reg. bank 1 when needed. switch
; back to bank 0 right afterward.
;==========================================================================

        Processor       PIC16C74
        include "d:\m16clite\p16c74.inc"

        include "const.asm"
        include "vars.asm"

        ORG     0x00
        clrf    INTCON          ; clear GIE
        clrf    STATUS          ; page 0&1 for indirect access
                                ; page 0 for direct access
        clrf    PCLATH
        goto    start

        ORG             0x04
        include "sio.asm"       ; must be here
        include	"auto.asm"
        include "read_sen.asm"
        include "scalesen.asm"
        include "reverse.asm"
	include "readvr.asm"
	include	"motordrv.asm"
	include "vr_41.asm"
        include "init_var.asm"
	include "vr_table.asm"
	include "scale_vr.asm"
	include "math.asm"
	
	                
start:
        bsf     PCLATH,3        ;SELECT PAGE 1
        goto    main


        org     0x0800          ;MAIN STARTS AT FIRST USABLE PROGRAM MEMORY

        include         "beep.asm"
        include         "dbc.asm"
        include         "eeprom.asm"
        include         "mem_eep.asm"
        include         "prockey.asm"
        include         "led.asm"
        include         "decode.asm"
        include         "firing.asm"
        include         "program.asm"
        include         "crc_8.asm"
        include         "timer.asm"
        include         "readport.asm"
        include         "map2fina.asm"
        include		"auto_con.asm"
        include		"id_chang.asm"
        include		"pwrupbut.asm"


main:
        clrf    temp_buf1
        clrf    temp_buf2
pwr_up_dly:
        clrwdt
        nop
        decfsz  temp_buf1,F
        goto    pwr_up_dly
        clrf    temp_buf1
        decfsz  temp_buf2,F
        goto    pwr_up_dly      

	bsf	STATUS,RP0	; reg.bank 1

; setup OPTION
	movlw	b'00000110'	; x256 TMR0 prescaler-> 26.2ms
	movwf	OPTION_REG
	bcf	STATUS,RP0	; reg bank 0


	bsf	STATUS,RP0	; reg.bank 1
; setup i/o ports
	movlw	DIR_HIZ_A
	movwf	TRISA
	movlw	DIR_HIZ_B
	movwf	TRISB
	movlw	DIR_HIZ_C
	movwf	TRISC
	movlw	DIR_HIZ_D
	movwf	TRISD
	movlw	DIR_HIZ_E
	movwf	TRISE
	bcf	STATUS,RP0	; reg.bank 0


        bcf     all_intr
; setup i/o ports
	clrf	PORTA
	clrf	PORTB
	clrf	PORTC
	clrf	PORTD
	clrf	PORTE

; setup A/D convertor
	bsf	STATUS,RP0
	movlw	ADC_DIG_IN	; config RA pins type
				; bit operation on PORTA is not
				; guarteened since port already read
				; zero
	movwf	ADCON1
	bcf	STATUS,RP0
	movlw	ADC_CONF	; config ADC
	movwf	ADCON0

;setup TMR1
	movlw	0x01		; pre x1, osc off, int clk, tmr1 on
	movwf	T1CON

; setup TMR2
	bsf	STATUS,RP0
        movlw   0x0ff           ; 1 tcyc period
	movwf	PR2
	bcf	STATUS,RP0
        movlw   0x04            ; post x1, tmr2 on, pre x1
	movwf	T2CON

; setup CCP1 
	movlw	0x00		; Capture/Compare/PWM off
	movwf	CCP1CON

; setup CCP2 
        clrf    CCPR2L
        movlw   0x0c            ; Capture/Compare/PWM off-- PWM on
	movwf	CCP2CON

;--------- here after is initial for comm. -------
;	movlw	b'00010100'		; Config SPI slave mode, /SS pin control enabled.
	movlw	b'00010101'		; Config SPI slave mode, /SS pin control disabled.
	movwf	SSPCON
	
	bsf	DSR			; initial /DSR
	
	bsf	INTCON,INTE		; Enable external interrupt
        bsf	STATUS,RP0		; Select Bank 1
        bcf	PIE1,SSPIE		; Disable SPI interrupt
	bcf	STATUS,RP0		; Select Bank 0
       	
;	bsf	SSPCON,SSPEN		; Enable SPI serial port
	bcf	PIR1,SSPIF
        clrf	SSPBUF			;

; init variables
        bcf   	PCLATH,3
	call	clr_all
;       	call  	init_all_vars
        bsf   	PCLATH,3  
        clrf	flag3
        
	clrf	PIR1		; clear all intr. flags.
	clrf	PIR2

;-------------------------------------------------------------------------
;	load eeprom data here
;-------------------------------------------------------------------------
     
        movlw	digital_id
        movwf	pad_id

        call    set_pb

	call	readport        
        bcf	PCLATH,3
        call	set_sen_null
        call	read_sen
        call	scalesen
        call	read_vr
        bsf	PCLATH,3       

	movf	xaxis_val,W
	movwf	xaxis_null
	movf	yaxis_val,W
	movwf	yaxis_null
	movf	zaxis_val,W
	movwf	zaxis_null
	movf	raxis_val,W
	movwf	raxis_null
	
	call	pwr_up_but_chk

	btfss	f_reset_ram
	goto	no_ram_reset

        movlw   BEEP_3          	;BEEP 3 TIMES
        call    p_beep	

        bsf	D_A_mode
        call	def_pb
        bcf	D_A_mode
        call	mem_eep

     
;        movlw   0x0             	;WAIT FOR PROGRAM KEY OFF BEFORE EXIT
;        call    waitkey
	bcf	f_reset_ram
        

no_ram_reset:      
	bsf	INTCON,PEIE		; Enanle peripheral interrupt
	bsf	INTCON,GIE		; Enable global	




mainloop:
        clrwdt
        
        btfsc   f_mapbad
        call    def_pb

        call    p_timer
        btfsc	f_time_reset
        goto	main			; 3sec time out reset

	call	update_id     

	bcf	PCLATH,3
	call	motordrv
	bsf	PCLATH,3

        bcf     f_dbcpb
        call    readport
        bcf	PCLATH,3
        call	read_sen
        call	scalesen
        call	adj_4_sen
        call	read_vr
        call	adjust_vr
        bsf	PCLATH,3

        call    countkey        
        skpz
        goto    mnchkkey

        btfss   f_keystb
        goto    mnchkkey
        btfss   pgm_bit
        goto    pgm_mode
        btfss	auto_bit
        goto	auto_mode
	btfss	mode_bit
	goto	change_mode        
        goto    mnchkkey

change_mode:
	call	mode_change
	goto	mainloop

pgm_mode:
        call    procpgm
        bsf     f_eob
        goto    mainloop

auto_mode:
	bcf	PCLATH,3
	call	procauto
	bsf	PCLATH,3
	call	set_auto_mask
	goto	mainloop

mnchkkey:
        bcf     f_newdat
        call    pre_key
        btfsc   f_eob
        call    scankey
        btfss   f_eob
        call    firestep
        btfss   f_newdat
        goto    mainloop
        bcf	PCLATH,3
        call	vr_41
        bsf	PCLATH,3
        call    post_key
        call    outport
        goto    mainloop

;mn_w_f_off:
;        call    readport
;        call    p_timer
;        btfss   f_keystb
;        goto    mn_w_f_off
;        btfss   pgm_bit
;        goto    mn_w_f_off
;        btfss   auto_bit
;        goto    mn_w_f_off
;        goto    mainloop



;--------------------------------

        END




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -