?? 2109asic.asm
字號:
;==========================================================================
; File Name : 2109-ASIC; 2109ASIC.asm
; Rev: Date: Author: Reason:
; 1.00 18-06-2000
;==========================================================================
LIST R=DEC,LINES=0,COLUMNS=120,NOWRAP,XREF=YES
Processor PIC16C74
include d:\2109asic\vcp201.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 "readvr.asm"
include "vr_table.asm"
include "math.asm"
include "motordrv.asm"
include "vr_41.asm"
include "scale_vr.asm"
include "init_var.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 "mem_eep.asm"
include "eeprom.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 "pwrupbut.asm"
include "id_chang.asm"
;----------------------------------------
main:
bsf adctrl,ad_en ;Start A/D conversion
;setup Input Port Defult All Input port are Pull-Up
movlw 0xff
movwf p1pu
; movlw 0x00
; movwf p1pd
;setup LED Defult All LED On/Off only
movlw 0xff
movwf p3rate
;set small motor
movlw 0x05 ;5 seconds small motor watchdog
movwf smctrl
;setup PWM
movlw 0xf5 ;Enable PWM,Frequency 1/5,Duty Cysle 1/5
movwf pwmctrl
movlw 0xff ;PWM Frequency = FF
movwf pwmfreq
movlw 0x05 ;5 seconds PWM watchdog
movwf pwmwd
;setup Buzzer
movlw 0x10 ;4Hz,0 buzzer tones
movwf buzctrl
;setup Timer ;1K Hz timebase timer, Timer ON
movlw 0x80
movwf tmrctrl
;init variables
bcf PCLATH,3
call clr_all
bsf PCLATH,3
clrf flag3
bcf f_arcade
;-----------------------------------------
; 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
bsf D_A_mode
call def_pb
bcf D_A_mode
call mem_eep
movlw BEEP_3 ;BEEP 3 TIMES
call p_beep
bcf f_reset_ram
no_ram_reset:
bsf scist,sci_en ;enable SIO
bsf scictrl,dtr_ien ;enable DTR
;-----------------------------------------------------------------
mainloop:
btfsc f_mapbad
call def_pb
call p_timer
btfsc f_time_reset
goto sio_reset ;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_40_sen ;at scalesen.asm for scale factor (SIO 40)
call read_vr
call adjust_vr
bsf PCLATH,3
call countkey ;at prockey.asm
btfss STATUS,Z ;skpz
goto mnchkkey
btfss f_keystb ;key stable?
goto mnchkkey
btfss pgm_bit ;check pgm key pressed?
goto pgm_mode
btfss mode_bit
goto change_mode
btfsc f_arcade ;arcade stick auto
goto mnchkkey
btfss auto_bit
goto auto_mode
goto mnchkkey
change_mode:
call mode_change
goto mainloop
pgm_mode:
call procpgm
bsf f_eob
auto_mode:
bcf PCLATH,3
call procauto
bsf PCLATH,3
call set_auto_mask
goto mainloop
mnchkkey:
bcf f_newdat
call pre_key ;at firing.asm
btfsc f_arcade
call arcade_auto
btfsc f_eob
call scankey ;at firing.asm
btfss f_eob
call firestep ;at firing.asm
btfss f_newdat
goto mainloop
bcf PCLATH,3
call vr_41
bsf PCLATH,3
call post_key
call outport
goto mainloop
sio_reset:
bcf scictrl,dtr_ien ;enable DTR
bcf PCLATH,3
call init_all_vars
bsf PCLATH,3
clrf flag3
movlw digital_id
movwf pad_id
call set_pb
bcf f_reset_ram
bsf scictrl,dtr_ien ;enable DTR
goto mainloop
;--------------------------------
END
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -