📄 1917ev.h
字号:
;*******************************************************************************
; FILENAME : 1917Ev.h
; AUTHOR : SONiX Bryant Chen
; PURPOSE : Constant and Macro definition for Ev Kit emulation code
; User must include 1917EV.h to communication with Ev. Kit
; REVISION : 07/09/2004 V1.0 First issue
;*******************************************************************************
;* (c) Copyright 2003, SONiX TECHNOLOGY CO., LTD.
;*******************************************************************************
;
;-------------------------------------------------------------------------------
;;Define user ram 7DH - 7FH to communication emulation board register
;-------------------------------------------------------------------------------
IF ICE_Mode==1
.DATA
ORG 0x07D
R_Temp2 DS 1
R_Temp1 DS 1
R_Temp0 DS 1
ORG 0x00
EndIF
;-------------------------------------------------------------------------------
;;Define user ICE Mode SIO interface
;-------------------------------------------------------------------------------
INIT_1917EV MACRO
IF ICE_Mode==1
Sio_SCK EQU p3.6
Sio_SO EQU p3.7
Sio_SI EQU p3.4
ICE_Reset EQU p3.1 ; ICE to reset EV Board
Chk_Flag EQU P3.5
V_SioLoopCnt EQU 8
mov a,#00000000b ; Initial port3
mov p3,a ;
mov a,#11101111b ;
mov p3m,a ;
mov a,#00000000b ;
mov p3ur,a ;
Loop_Reset_EV: ; Reset use p3.1 reset emulation board
b0bset FWDRST
decms R_Temp0 ;
jmp $-2 ;
decms R_temp1 ;
jmp Loop_Reset_EV ;
b0bset ICE_Reset ; for sync EV and ICE
mov a,#02h ; delay loop 256*256*2
b0mov R_Temp2,a ;
Loop_Reset_EV_OK: ;
b0bset FWDRST
decms R_Temp0 ;
jmp $-2 ;
decms R_Temp1 ;
jmp Loop_Reset_EV_OK ;
decms R_Temp2 ;
jmp Loop_Reset_Ev_OK ;
ENDIF
ENDM
;-------------------------------------------------------------------------------
; SN8P1917 special register access MACRO
; Write register Usage : XMOV register,A
; Read register Usage : XMOV A, register
;-------------------------------------------------------------------------------
XMOV MACRO REG,VAL
IF ICE_Mode==1
IFIDNI <VAL>,<A> ; check witer mode to emulation board
b0mov R_Temp2,a ; save a value
mov a, #(REG) ; get address value
b0mov R_Temp0,a ; save value in R_tamp0
b0bclr R_Temp0.7 ; use bit7 mark to write mode flag.
call SIO ; sned write address to emulation board
call @@delayTime ; waiting for emulation board procrss command & address
b0mov a,R_Temp2 ; load data to SIO buffer
b0mov R_Temp0,a ;
call SIO ; send data into emulation board address
b0mov a,R_Temp2 ; for keep "Acc" value
elseIFIDNI <REG>,<A> ; check read mode from emulation board
mov a,#(VAL) ; get register address value
b0mov R_Temp0,a ;
b0bset R_Temp0.7 ; use bit7 mark to read mode flag.
call SIO ; send read address to emulation board
call @@delayTime ; waiting for emulation board process command & address
call SIO ; received emulation board data
else
Error!! Check XMOV macro parameter. This macro need "A" parameter.
endif
else ; Real chip mode
IFIDNI <VAL>,<A>
b0mov (REG),a ;
elseIFIDNI <REG>,<A>
b0mov a,(VAL) ;
else
Error!! Check XMOV macro parameter. This macro need "A" parameter.
endif
ENDIF
endm
;************************************************************************************
;XB0MOV same as SMOV *
;************************************************************************************
XB0MOV MACRO REG,VAL
IF ICE_Mode==1
IFIDNI <VAL>,<A> ; check witer mode to emulation board
b0mov R_Temp2,a ; save a value
mov a, #(REG) ; get address value
b0mov R_Temp0,a ; save value in R_tamp0
b0bclr R_Temp0.7 ; use bit7 mark to write mode flag.
call SIO ; sned write address to emulation board
call @@delayTime ; waiting for emulation board procrss command & address
b0mov a,R_Temp2 ; load data to SIO buffer
b0mov R_Temp0,a ;
call SIO ; send data into emulation board address
b0mov a,R_Temp2 ; for keep "Acc" value
elseIFIDNI <REG>,<A> ; check read mode from emulation board
mov a,#(VAL) ; get register address value
b0mov R_Temp0,a ;
b0bset R_Temp0.7 ; use bit7 mark to read mode flag.
call SIO ; send read address to emulation board
call @@delayTime ; waiting for emulation board process command & address
call SIO ; received emulation board data
else
Error!! Check XMOV macro parameter. This macro need "A" parameter.
endif
else ; Real chip mode
IFIDNI <VAL>,<A>
b0mov (REG),a ;
elseIFIDNI <REG>,<A>
b0mov a,(VAL) ;
else
Error!! Check XMOV macro parameter. This macro need "A" parameter.
endif
ENDIF
endm
;-------------------------------------------------------------------------------
; SN8P1909 special register Bit test 0 MACRO
; this macro is only available in R/W register of bank 0
; e.g XB0BTS0 FADCENB
; XB0BTS0 ADCM.0 <== this syntax Not available now
;-------------------------------------------------------------------------------
XB0BTS0 MACRO REG
IF ICE_Mode==1
mov a,#@int(REG) ; get reg. address value
b0mov R_Temp0,a ;
b0bset R_Temp0.7 ; use bit7 mark to read mode flag.
call SIO ; send read address to emulation board
call @@delayTime ; waiting for emulation board process command & address
call SIO ; received emulation board data
mov R_Temp0,a ; save received data
b0bts0 R_Temp0.@bit(REG) ; judge data bit
ELSE
b0bts0 REG
ENDIF
ENDM
;-------------------------------------------------------------------------------
; SN8P1909 special register Bit test 1 MACRO
; this macro is only available in R/W register of bank 0
; e.g XB0BTS1 FADCENB
; XB0BTS1 ADCM.0 <== this syntax Not available now
;-------------------------------------------------------------------------------
XB0BTS1 MACRO REG
IF ICE_Mode==1
mov a,#@int(REG) ; get reg. address value
b0mov R_Temp0,a ;
b0bset R_Temp0.7 ; use bit7 mark to read mode flag.
call SIO ; send read address to emulation board
call @@delayTime ; waiting for emulation board process command & address
call SIO ; received emulation board data
mov R_Temp0,a ; save reecived data
b0bts1 R_Temp0.@bit(REG) ; judge data bit
ELSE
b0bts1 REG
ENDIF
ENDM
;-------------------------------------------------------------------------------
; SN8P1909 special register Bit set MACRO
; this macro is only available in R/W register of bank 0
; e.g XB0BSET FADCENB
; XB0BSET ADCM.0 <== this syntax Not available now
;-------------------------------------------------------------------------------
XB0BSET MACRO REG
IF ICE_Mode==1
mov a,#@int(REG) ; get reg. address value
b0mov R_Temp0,a ;
b0bset R_Temp0.7 ; use bit7 mark to read mode flag.
call SIO ; send read address to emulation board
call @@delayTime ; waiting for emulation board process command & address
call SIO ; received emulation board data
mov R_Temp2,a ; save data
b0bset R_Temp2.@bit(REG) ; process data bit
mov a,#@int(REG) ; get reg. address value
b0mov R_Temp0,a ;
b0bclr R_Temp0.7 ; use bit7 mark to writer mode flag.
call SIO ; sned write address to emulation board
call @@delayTime ; waiting for emulation board process command & address
b0mov a,R_Temp2 ; load data to SIO buffer
b0mov R_Temp0,a ;
call SIO ; send data into emulation board address
ELSE
b0bset REG
ENDIF
endm
;-------------------------------------------------------------------------------
; SN8P1909 special register Bit clear MACRO
; this macro is only available in R/W register of bank 0
; e.g XB0BCLR FADCENB
; XB0BCLR ADCM.0 <== this syntax Not available now
;-------------------------------------------------------------------------------
XB0BCLR MACRO REG
IF ICE_Mode==1
mov a,#@int(REG) ; get reg. address value
b0mov R_Temp0,a ;
b0bset R_Temp0.7 ; use bit7 mark to read mode flag.
call SIO ; send read address to emulation board
call @@delayTime ; waiting for emulation board process command & address
call SIO ; received emulation board data
mov R_Temp2,a ; save data
b0bclr R_Temp2.@bit(REG) ; process data bit
mov a,#@int(REG) ; get reg. address value
b0mov R_Temp0,a ;
b0bclr R_Temp0.7 ; use bit7 mark to writer mode flag.
call SIO ; sned write address to emulation board
call @@delayTime ; waiting for emulation board process command & address
b0mov a,R_Temp2 ; load data to SIO buffer
b0mov R_Temp0,a
call SIO ;send data into emulation board address
ELSE
b0bclr reg
ENDIF
endm
;******************************************************
; @SET_LCDM1 Macro to emulate 1917 LCDM in S8KD-2 ICE
@SET_LCDM1 macro val
IF ICE_MODE == 1 ;Set S8KD-2 ICE LCDM register
mov a,#(val)
and a,#0xfc
b0mov LCDM1,a
mov a,#(val)
; and a,#0x01
; xor a,#0x01
; b0bts0 FZ
; b0bset FP2SEG
ELSE ;;Set SN8P1917 ICE LCDM1 register
mov a,#(val)
b0mov LCDM1,a
ENDIF
endm
;**********************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -