📄 nec_fp.s
字号:
.module nec_fp.c
.area text(rom, con, rel)
.dbfile D:\avrmcu\AT980\nec_fp.c
.dbfunc s VFD_LL_WriteByte _VFD_LL_WriteByte fI
; i -> R20
; byte -> R16
.even
_VFD_LL_WriteByte:
xcall push_gset1
.dbline -1
.dbline 8
; #include "main.h"
; #include "nec_fp.h"
; #include <iom163.h>
; #include "io.h"
; unsigned char p_keycode[BYTES_USED_TO_SCANKEY];
;
; static void VFD_LL_WriteByte( unsigned char byte )
; {
.dbline 11
; register unsigned char i;
;
; for( i=0x01; i!=0; i<<=1 )
ldi R20,1
xjmp L5
L2:
.dbline 12
; {
.dbline 13
; Set_Fp_CLK_L();
CBI 0x15,7
.dbline 15
;
; if(byte&i)
mov R2,R16
and R2,R20
tst R2
breq L6
.dbline 16
; Set_Fp_DOUT_H();
SBI 0x15,5
xjmp L7
L6:
.dbline 18
; else
; Set_Fp_DOUT_L();
CBI 0x15,5
L7:
.dbline 20
SBI 0x15,7
.dbline 21
L3:
.dbline 11
lsl R20
L5:
.dbline 11
tst R20
brne L2
.dbline -2
.dbline 22
;
; Set_Fp_CLK_H();
; }
; }
L1:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r byte 16 c
.dbfunc s VFD_LL_ReadByte _VFD_LL_ReadByte fI
; value -> R20
; i -> R22
; byte -> R10,R11
.even
_VFD_LL_ReadByte:
xcall push_gset3
movw R10,R16
.dbline -1
.dbline 24
; static void VFD_LL_ReadByte( unsigned char *byte )
; {
.dbline 31
; unsigned char value;
; register unsigned char i;
; // unsigned char value;
;
; //Set_Fp_CLK_H();
; //*byte = 0; //FW 0117 Clear byte first
; value = 0;
clr R20
.dbline 32
; for( i=0; i<8; i++ )
clr R22
xjmp L12
L9:
.dbline 33
; {
.dbline 34
; Set_Fp_CLK_L();
CBI 0x15,7
.dbline 36
; // *byte >>=1;
; value >>=1;
lsr R20
.dbline 37
; soft_delay();
xcall _soft_delay
.dbline 38
; if(Get_Fp_DIN())
sbis 0x13,5
rjmp L13
.dbline 40
; //*byte |= 0x80;
; value |= 0x80;
ori R20,128
L13:
.dbline 41
SBI 0x15,7
.dbline 42
xcall _soft_delay
.dbline 43
L10:
.dbline 32
inc R22
L12:
.dbline 32
cpi R22,8
brlo L9
.dbline 44
; Set_Fp_CLK_H();
; soft_delay();
; }
; *byte = value;
movw R30,R10
std z+0,R20
.dbline -2
.dbline 49
; //Set_Fp_CLK_L();
; //if(Get_Fp_DIN())
; //*byte |= 0x80;
; //Set_Fp_CLK_H();
; }
L8:
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r value 20 c
.dbsym r i 22 c
.dbsym r byte 10 pc
.dbfunc s VFD_LL_SetDim _VFD_LL_SetDim fI
; real_dim_value -> R20
.even
_VFD_LL_SetDim::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 51
; void VFD_LL_SetDim(unsigned char real_dim_value)
; {
.dbline 53
;
; Set_Fp_STB_L();
CBI 0x15,6
.dbline 56
;
;
; VFD_LL_WriteByte( DISPLAY_CONTROL | real_dim_value );
mov R16,R20
ori R16,128
xcall _VFD_LL_WriteByte
.dbline 59
;
;
; Set_Fp_STB_H();
SBI 0x15,6
.dbline -2
.dbline 61
;
; }
L15:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r real_dim_value 20 c
.dbfunc s VFD_LL_SetGrid _VFD_LL_SetGrid fI
.even
_VFD_LL_SetGrid::
.dbline -1
.dbline 63
; void VFD_LL_SetGrid(void)
; {
.dbline 68
;
; //Set_Fp_STB_H();
;
;
; Set_Fp_STB_L();
CBI 0x15,6
.dbline 70
;
; VFD_LL_WriteByte( DISPLAY_MODE| REAL_GRID_VALUE );
ldi R16,10
xcall _VFD_LL_WriteByte
.dbline 71
; Set_Fp_STB_H();
SBI 0x15,6
.dbline -2
.dbline 74
;
; //VFD_LL_SetDim(0x0f);
; }
L16:
.dbline 0 ; func end
ret
.dbfunc s VFD_LL_ReadKeyScan _VFD_LL_ReadKeyScan fI
; i -> R20
.even
_VFD_LL_ReadKeyScan::
xcall push_gset1
.dbline -1
.dbline 78
;
; /****************************************************************************/
; void VFD_LL_ReadKeyScan( void)
; {
.dbline 84
; unsigned char i;
;
; //Set_Fp_STB_H();
;
;
; Set_Fp_STB_L();
CBI 0x15,6
.dbline 87
;
;
; VFD_LL_WriteByte( (unsigned char)(DATA_SETTING | NORMAL_OPERATION | ADDRESS_INCREASE | READ_KEYSCAN ));
ldi R16,66
xcall _VFD_LL_WriteByte
.dbline 90
;
;
; Set_FpDout_To_Input();
CBI 0x14,5
.dbline 92
;
; for(i=0;i<BYTES_USED_TO_SCANKEY;i++)
clr R20
xjmp L21
L18:
.dbline 93
.dbline 95
ldi R24,<_p_keycode
ldi R25,>_p_keycode
mov R16,R20
clr R17
add R16,R24
adc R17,R25
xcall _VFD_LL_ReadByte
.dbline 96
L19:
.dbline 92
inc R20
L21:
.dbline 92
cpi R20,4
brlo L18
.dbline 96
; {
;
; VFD_LL_ReadByte( p_keycode+i );
; };
.dbline 98
;
; Set_FpDout_To_Output();
SBI 0x14,5
.dbline 100
;
; Set_Fp_STB_H();
SBI 0x15,6
.dbline -2
.dbline 102
;
; }
L17:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbfunc s VFD_LL_RefreshLED _VFD_LL_RefreshLED fI
; led -> R20
.even
_VFD_LL_RefreshLED::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 129
;
; /****************************************************************************/
; /*void VFD_LL_ReadInputs( unsigned char *inputs )
; {
;
; //Set_Fp_STB_H();
;
;
; Set_Fp_STB_L();
;
;
; VFD_LL_WriteByte( DATA_SETTING | NORMAL_OPERATION | ADDRESS_INCREASE | READ_INPUTS );
;
; Set_FpDout_To_Input();
;
;
; VFD_LL_ReadByte( inputs );
;
; Set_FpDout_To_Output();
;
;
; Set_Fp_STB_H();
; }
; */
;
; void VFD_LL_RefreshLED( unsigned char led )
; {
.dbline 134
; // delay_us(1);
; // Set_Fp_STB(1);
;
; // delay_us(1);
; Set_Fp_STB_L();
CBI 0x15,6
.dbline 137
;
; //delay_us(1);
; VFD_LL_WriteByte( (unsigned char)(DATA_SETTING | NORMAL_OPERATION | ADDRESS_INCREASE | WRITE_LIGHTS ));
ldi R16,65
xcall _VFD_LL_WriteByte
.dbline 140
;
; //delay_us(1);
; VFD_LL_WriteByte( led );
mov R16,R20
xcall _VFD_LL_WriteByte
.dbline 143
;
; //delay_us(1);
; Set_Fp_STB_H();
SBI 0x15,6
.dbline -2
.dbline 145
;
; }
L22:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r led 20 c
.dbfunc s VFD_LL_WriteDisplayRAM _VFD_LL_WriteDisplayRAM fI
; data -> R20,R21
; grid -> R22
.even
_VFD_LL_WriteDisplayRAM::
xcall push_gset2
movw R20,R18
mov R22,R16
.dbline -1
.dbline 150
;
; /****************************************************************************/
;
; void VFD_LL_WriteDisplayRAM(unsigned char grid,unsigned int data)
; {
.dbline 152
;
; Set_Fp_STB_L();
CBI 0x15,6
.dbline 153
; VFD_LL_WriteByte( (unsigned char)(DATA_SETTING | NORMAL_OPERATION | ADDRESS_INCREASE | WRITE_DISPLAY ));
ldi R16,64
xcall _VFD_LL_WriteByte
.dbline 154
; Set_Fp_STB_H();
SBI 0x15,6
.dbline 155
; soft_delay();
xcall _soft_delay
.dbline 156
; Set_Fp_STB_L();
CBI 0x15,6
.dbline 157
; VFD_LL_WriteByte( (unsigned char) ADDRESS_SETTING | (3*grid));
ldi R24,3
mul R24,R22
movw R16,R0
ori R16,192
xcall _VFD_LL_WriteByte
.dbline 158
; VFD_LL_WriteByte((unsigned char)data );
mov R16,R20
xcall _VFD_LL_WriteByte
.dbline 159
; VFD_LL_WriteByte((unsigned char)(data>>8));
movw R16,R20
mov R16,R17
clr R17
xcall _VFD_LL_WriteByte
.dbline 160
; Set_Fp_STB_H();
SBI 0x15,6
.dbline -2
.dbline 162
;
; }
L23:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r data 20 i
.dbsym r grid 22 c
.area bss(ram, con, rel)
.dbfile D:\avrmcu\AT980\nec_fp.c
_p_keycode::
.blkb 4
.dbsym s p_keycode _p_keycode A[4:4]c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -