汇合语言.docx
《汇合语言.docx》由会员分享,可在线阅读,更多相关《汇合语言.docx(120页珍藏版)》请在冰豆网上搜索。
![汇合语言.docx](https://file1.bdocx.com/fileroot1/2023-8/3/fa68e52a-b344-4ddc-912f-55cd8f1b1af7/fa68e52a-b344-4ddc-912f-55cd8f1b1af71.gif)
汇合语言
includeHT45R2G.inc
@CODE.SECTION'CODE'
L0000:
;604
;605voidmain()
CALLSTARTSEC
JMPbegin
@DUMMY.SECTION'CODE'
CALLbegin
@startad.SECTION'CODE'
_startad:
;33
;34
;35#define_ctr_led_1_pcc3
;36#define_set_led_1_pc3
;37#define_ctr_bat_1_pac6
;38#define_set_bat_1_pa6
;39#define_ctr_led_2_pac0
;40#define_set_led_2_pa0
;41#define_ctr_bat_2_pcc2
;42#define_set_bat_2_pc2
;43#define_ctr_led_3_pbc2
;44#define_set_led_3_pb2
;45#define_ctr_bat_3_pbc1
;46#define_set_bat_3_pb1
;47#define_ctr_led_4_pac4
;48#define_set_led_4_pa4
;49#define_ctr_bat_4_pac5
;50#define_set_bat_4_pa5
;51#define_ctr_led_5_pcc1
;52#define_set_led_5_pc1
;53#define_ctr_bat_5_pbc0
;54#define_set_bat_5_pb0
;55#define_ctr_led_6_pb3
;56#define_set_led_6_pbc3
;57#define_ctr_bat_6_pac7
;58#define_set_bat_6_pa7
;59#definefail20//0.1
;60#defineaction225//1.1
;61#definecharg246//1.2
;62#definedischarg266//1.3
;63#defineover348//1.7
;64#definenoload512//2.5
;65#definevmax307//2.5
;66
;67#definefail120//0.7
;68#definerg198//7.6
;69
;70#definer205//8.5
;71#definegr226//9.1
;72#defineg311//11.8
;73#defineno512//12.8
;74voidstartad(){
;75_start=0;
CLRSTART
;76_start=1;
SETSTART
;77_start=0;}
CLRSTART
L1:
RET
STARTSEC:
STARTUP:
STARTSEC:
RET
@@_Timer0.SECTION'CODE'
;78
;79
;80void_Timer0(void){
JMP__Timer0
@led_red_1.SECTION'CODE'
_led_red_1:
;102voidled_red_1(){
;103_ctr_led_1=0;
CLRPCC3
;104_set_led_1=0;}
CLRPC3
L7:
RET
@@_ADC0.SECTION'CODE'
;176
;177void_ADC0(void){
JMP__ADC0
@_Timer0.SECTION'CODE'
__Timer0:
MOVV2A,A
MOVA,STATUS
MOVV2S,A
;81time_500us++;
INC_time_500us
;82if(time_500us==100){
MOVA,_time_500us
XORA,064H
SNZZ
JMPL2
;83time_500us=0;
CLR_time_500us
;84time_50ms++;
INC_time_50ms
;85time_50ms_1_1++;
INC_time_50ms_1_1
;86time_50ms_1_2++;
INC_time_50ms_1_2
;87time_50ms_1_3++;
INC_time_50ms_1_3
;88time_50ms_1_4++;
INC_time_50ms_1_4
;89time_50ms_2_4++;
INC_time_50ms_2_4
;90time_50ms_3_4++;
INC_time_50ms_3_4
;91time_50ms_4_4++;
INC_time_50ms_4_4
;92time_50ms_5_4++;
INC_time_50ms_5_4
;93time_50ms_6_4++;
INC_time_50ms_6_4
;94if(time_50ms==200){
MOVA,_time_50ms
XORA,0C8H
SNZZ
JMPL2
;95time_50ms=0;
CLR_time_50ms
;96time_10s_1++;
INC_time_10s_1
SZZ
INC_time_10s_1[1]
;97time_10s_2++;
INC_time_10s_2
SZZ
INC_time_10s_2[1]
;98time_10s_3++;
INC_time_10s_3
SZZ
INC_time_10s_3[1]
;99time_10s_4++;
INC_time_10s_4
SZZ
INC_time_10s_4[1]
;100time_10s_5++;
INC_time_10s_5
SZZ
INC_time_10s_5[1]
;101time_10s_6++;}}}
INC_time_10s_6
SZZ
INC_time_10s_6[1]
L5:
L3:
L2:
MOVA,V2S
MOVSTATUS,A
MOVA,V2A
RETI
@led_gre_1.SECTION'CODE'
_led_gre_1:
;105voidled_gre_1(){
;106_ctr_led_1=0;
CLRPCC3
;107_set_led_1=1;}
SETPC3
L8:
RET
@b1c_1.SECTION'CODE'
_b1c_1:
;108voidb1c_1(){
;109_ctr_bat_1=0;
CLRPAC6
;110_set_bat_1=1;}
SETPA6
L9:
RET
@b0c_1.SECTION'CODE'
_b0c_1:
;111voidb0c_1(){
;112_ctr_bat_1=0;
CLRPAC6
;113_set_bat_1=0;}
CLRPA6
L10:
RET
@led_red_2.SECTION'CODE'
_led_red_2:
;202f=6;}
CLRPAC0
;114
;115voidled_red_2(){
;116_ctr_led_2=0;
;117_set_led_2=0;}
CLRPA0
L11:
;180
;181voidadc123(){
;182unsignedintdsb;
RET
@led_gre_2.SECTION'CODE'
_led_gre_2:
;118
;119voidled_gre_2(){
;120_ctr_led_2=0;
CLRPAC0
;603q=16;}}
SETPA0
L12:
RET
@b1c_2.SECTION'CODE'
_b1c_2:
;565
;566//6
;567voidshow_led_6(){
;568unsignedcharq;
CLRPCC2
;121_set_led_2=1;}
;122voidb1c_2(){
;123_ctr_bat_2=0;
;124_set_bat_2=1;}
SETPC2
L13:
;680}}
RET
@b0c_2.SECTION'CODE'
_b0c_2:
;606{
;607unsignedint*addr;
CLRPCC2
;178num_l=_adrh;
;179num_l=((num_l<<2)+(_adrl>>6));}
CLRPC2
L14:
RET
@led_red_3.SECTION'CODE'
_led_red_3:
CLRPBC2
;125voidb0c_2(){
;126_ctr_bat_2=0;
;127_set_bat_2=0;}
;128voidled_red_3(){
;129_ctr_led_3=0;
;130_set_led_3=0;}
CLRPB2
L15:
;32unsignedintnum_l;
RET
@led_gre_3.SECTION'CODE'
_led_gre_3:
;131voidled_gre_3(){
;132_ctr_led_3=0;
CLRPBC2
;31unsignedintdsbmax_h[6];
SETPB2
L16:
RET
@b1c_3.SECTION'CODE'
_b1c_3:
;133_set_led_3=1;}
;134
;135voidb1c_3(){
;136_ctr_bat_3=0;
CLRPBC1
;137_set_bat_3=1;}
SETPB1
L17:
RET
@b0c_3.SECTION'CODE'
_b0c_3:
;138
;139
;140voidb0c_3(){
;141_ctr_bat_3=0;
CLRPBC1
;142_set_bat_3=0;}
CLRPB1
L18:
RET
@led_red_4.SECTION'CODE'
_led_red_4:
;143
;144voidled_red_4(){
;145_ctr_led_4=0;
CLRPAC4
;146_set_led_4=0;}
CLRPA4
L19:
RET
@led_gre_4.SECTION'CODE'
_led_gre_4:
;147
;148voidled_gre_4(){
;149_ctr_led_4=0;
CLRPAC4
;30unsignedchari;
SETPA4
L20:
;29unsignedchark;
RET
@b1c_4.SECTION'CODE'
_b1c_4:
;28unsignedcharf;
CLRPAC5
;27unsignedcharan1,an2,an3,an4;
SETPA5
L21:
RET
@b0c_4.SECTION'CODE'
_b0c_4:
CLRPAC5
CLRPA5
L22:
;26unsignedcharfage_6;
RET
@led_red_5.SECTION'CODE'
_led_red_5:
;25unsignedcharfage_5;
CLRPCC1
;24unsignedcharfage_4;
CLRPC1
L23:
;23unsignedcharfage_3;
RET
@led_gre_5.SECTION'CODE'
_led_gre_5:
;22unsignedcharfage_2;
CLRPCC1
;21unsignedcharfage_1;
SETPC1
L24:
;20unsignedcharStep_4;
RET
@led_red_6.SECTION'CODE'
_led_red_6:
;19unsignedcharStep_3;
CLRPB3
;18unsignedcharStep_2;
CLRPBC3
L25:
;17unsignedcharStep_1;
RET
@led_gre_6.SECTION'CODE'
_led_gre_6:
;16unsignedinttime_10s_1,time_10s_2,time_10s_3,time_10s_4,time_10s_5,time_10s_6;
CLRPB3
;150_set_led_4=1;}
;151
;152voidb1c_4(){
;153_ctr_bat_4=0;
;154_set_bat_4=1;}
;155
;156
;157voidb0c_4(){
;158_ctr_bat_4=0;
;159_set_bat_4=0;}
;160
;161voidled_red_5(){
;162_ctr_led_5=0;
;163_set_led_5=0;}
;164
;165voidled_gre_5(){
;166_ctr_led_5=0;
;167_set_led_5=1;}
;168
;169voidled_red_6(){
;170_ctr_led_6=0;
;171_set_led_6=0;}
;172
;173voidled_gre_6(){
;174_ctr_led_6=0;
;175_set_led_6=1;}
SETPBC3
L26:
RET
@_ADC0.SECTION'CODE'
__ADC0:
MOVV3A,A
MOVA,STATUS
MOVV3S,A
MOVA,ADRH
MOV_num_l,A
CLR_num_l[1]
CLRC
RLCA_num_l
MOVb0_23,A
;15unsignedchartime_500us;
RLCA_num_l[1]
;14unsignedchartime_50ms;
MOVb0_23[1],A
;13unsignedchartime_50ms_6_4;
CLRC
;12unsignedchartime_50ms_5_4;
RLCb0_23
;11unsignedchartime_50ms_4_4;
RLCb0_23[1]
;10unsignedchartime_50ms_3_4;
RLAADRL
;9unsignedchartime_50ms_2_4;
RLACC
;8unsignedchartime_50ms_1_4;
ANDA,03H
;7unsignedchartime_50ms_1_3;
MOVb1_23,A
;6unsignedchartime_50ms_1_2;
CLRb1_23[1]
;1#include"HT45r2G.H"
;2//#pragmavectorIsr_4@0x4;
;3#pragmavector_ADC0@0x0C;
;4#pragmavector_Timer0@0x08;
;5unsignedchartime_50ms_1_1;
MOVA,b1_23
ADDA,b0_23
MOV_num_l,A
MOVA,b1_23[1]
ADCA,b0_23[1]
MOV_num_l[1],A
L27:
MOVA,V3S
MOVSTATUS,A
MOVA,V3A
RETI
@adc123.SECTION'CODE'
_adc123:
;183dsb=0;
CLRCR1
CLRCR1[1]
;184for(i=0;i<64;i++){
CLR_i
JMPL32
L29:
;185_clrwdt();
CLRWDT
;186_nop();
CALLL0000
;187startad();
CALL_startad
;188_nop();
JMPL0000
;189_nop();
JMPL0000
JMPL34
L33:
;192_nop();
NOP
L34:
;190
;191while(_eocb)
SZEOCB
JMPL33
;193_nop();
NOP
;194
;195
;196dsb+=num_l;
MOVA,_num_l
ADDMA,CR1
MOVA,_num_l[1]
ADCMA,CR1[1]
;197_nop();
NOP
;198if(i==63)
MOVA,_i
XORA,03FH
SNZZ
JMPL30
;199num_l=dsb/64;}
MOVA,CR1
MOV_num_l,A
MOVA,CR1[1]
MOV_num_l[1],A
MOVA,06H
sha42:
CLRC
RRC_num_l[1]
RRC_num_l
SDZACC
JMPsha42
L36:
L30:
INC_i
L32:
MOVA,_i
SUBA,040H
SNZC
JMPL29
;200if(f==6)return;
MOVA,_f
XORA,06H
SNZZ
JMPL38
JMPL28
L38:
;201if(num_l>dsbmax_h[f])dsbmax_h[f]=num_l;
CLRC
RLCA_f
ADDA,054H
MOVb0_24,A
MOVA,b0_24
MOVMP0,A
MOVA,[00H]
MOVb0_24,A
INCMP0
MOVA,[00H]
MOVb0_24[1],A
MOVA,b0_24[1]
SUBA,_num_l[1]
SNZC
JMPL43
SNZZ
JMPL40
MOVA,b0_24
SUBA,_num_l
SZC
JMPL40
L43:
CLRC
RLCA_f
ADDA,054H
MOVb0_24,A
MOVA,b0_24
MOVMP0,A
MOVA,_num_l
MOV[00H],A
INCMP0
MOVA,_num_l[1]
MOV[00H],A
L40:
MOVA,06H
MOV_f,A
L28:
RET
@show_led_1.SECTION'CODE'
_show_led_1:
;203
;204
;205
;206
;207
;208//第一
;209voidshow_led_1(){
;210_adcr=4;
MOVA,04H
MOVADCR,A
;211adc123();
CALL_adc123
;212if(num_l>noload){//2.5
MOVA,02H
SUBA,_num_l[1]
SNZC
JMPL121
SNZZ
JMPL45
MOVA,00H
SUBA,_num_l
SZC
JMPL45
L121:
;213dsbmax_h[0]=0;
CLR_dsbmax_h
CLR_dsbmax_h[1]
;214_ctr_led_1=1;
SETPCC3
;215_ctr_bat_1=1;
SETPAC6
;216time_50ms_1_4=0;
CLR_time_50ms_1_4
;217fage_1=0;
CLR_fage_1
;218time_10s_1=0;return;}
CLR_time_10s_1
CLR_time_10s_1[1]
JMPL44
L45:
;219
;220if((fage_1)||(num_lSZ_fage_1
JMPL49
MOVA,_num_l[1]
SUBA,00H
SNZC
JMPL49
SNZZ
JMPL47
MOVA,_num_l
SUBA,014H
SZC
JMPL47
L122:
L49:
;221fage_1=1;
MOVA,01H
MOV_fage_1,A
;222_ctr_bat_1=1;
SETPAC6
;223if(time_50ms_1_1<10)led_red_1();
MOVA,_time_50ms_1_1
SUBA,0AH
SZC
JMPL50
CALL_led_red_1
JMPL44
L50:
;224else_ctr_led_1=1;return;}
SETPCC3
JMPL44
L47:
;225if(time_50ms_1_4<100){
MOVA,_time_50ms_1_4
SUBA,064H
SZC
JMPL52
;226if(num_lMOVA,_num_l[1]
SUBA,00H
SNZC
JMPL123
SNZZ
JMPL54
MOVA,_num_l
SUBA,0E1H
SZC
JMPL54
L1