📄 radio.s
字号:
.module radio.c
.area text(rom, con, rel)
.dbfile D:\avrmcu\AT980\bu2624\radio.c
.dbfunc s save_fre _save_fre fI
.even
_save_fre::
sbiw R28,2
.dbline -1
.dbline 37
; #include "..\bu2624\bu2624.h"
; #include "..\bu1923\bu1923.h"
; #include "..\main.h"
; #include <iom163.h>
; #include "..\io.h"
; #include <eeprom.h>
; extern NV_SETTINGS gps;
; extern unsigned int freq;
; extern unsigned char g_ui_tmp_msg_cnt;
; extern unsigned char is_autosearching;
; extern unsigned char search_ok;
; extern unsigned char search_dir;
; extern unsigned char autosrch_step;
; extern unsigned char station_no;
; extern unsigned char *err_msg;
; extern unsigned int radio_count;
; extern unsigned char radio_is_muted;
; extern unsigned char is_stereo;
; extern unsigned int info;
; unsigned char store_bit;
;
; #ifdef SGJM_RDS
; extern unsigned char rds_display_type;
; extern unsigned char rds_dis_string[65];
; extern unsigned char pty_is_searching;
; extern unsigned char rds_status;
; extern RDS_DATA_STRUCT rds_data;
; //#define pty_dis_type rds_dis_string[0]
; //#define pty_search_type rds_dis_string[1]
; //#define pty_search_delay rds_dis_string[2]
; #endif
; extern unsigned char Mchvol;
;
; extern unsigned char amfm_flag,station_no,display_type;
; extern unsigned char uicc_code,last_key;
; void save_fre(void)
; {
.dbline 38
; if(amfm_flag)
lds R2,_amfm_flag
tst R2
breq L3
.dbline 39
; {
.dbline 40
; EEPROM_WRITE((int)&(gps.ps_amfre),freq);
ldi R24,2
ldi R25,0
std y+0,R24
std y+1,R25
ldi R18,<_freq
ldi R19,>_freq
ldi R16,<_gps+6
ldi R17,>_gps+6
xcall _EEPROMWriteBytes
.dbline 42
;
; }
xjmp L4
L3:
.dbline 44
.dbline 45
ldi R24,2
ldi R25,0
std y+0,R24
std y+1,R25
ldi R18,<_freq
ldi R19,>_freq
ldi R16,<_gps+4
ldi R17,>_gps+4
xcall _EEPROMWriteBytes
.dbline 46
L4:
.dbline -2
.dbline 47
; else
; {
; EEPROM_WRITE((int)&(gps.ps_fmfre),freq);
; }
; }
L2:
adiw R28,2
.dbline 0 ; func end
ret
.dbfunc s find_station_no _find_station_no fI
; val -> y+2
; i -> R20
.even
_find_station_no::
xcall push_gset1
sbiw R28,4
.dbline -1
.dbline 49
; unsigned char find_station_no(void)
; {
.dbline 52
; unsigned char i;
; unsigned int val;
; if(amfm_flag)
lds R2,_amfm_flag
tst R2
breq L8
.dbline 53
; {
.dbline 54
; for(i=0;i<MAX_AM_STATION;i++)
clr R20
xjmp L13
L10:
.dbline 55
; {
.dbline 56
; EEPROM_READ((int)&gps.ps_am_station[i],val);
ldi R24,2
ldi R25,0
std y+0,R24
std y+1,R25
movw R24,R28
adiw R24,2
movw R18,R24
ldi R24,<_gps+68
ldi R25,>_gps+68
mov R16,R20
clr R17
lsl R16
rol R17
add R16,R24
adc R17,R25
xcall _EEPROMReadBytes
.dbline 57
; if(val == freq)
lds R3,_freq+1
lds R2,_freq
ldd R4,y+2
ldd R5,y+3
cp R4,R2
cpc R5,R3
brne L15
.dbline 58
; return i;
mov R16,R20
clr R17
xjmp L7
L15:
.dbline 59
L11:
.dbline 54
inc R20
L13:
.dbline 54
cpi R20,20
brlo L10
.dbline 59
; };
.dbline 60
; return 255;
ldi R16,255
ldi R17,0
xjmp L7
L8:
.dbline 63
; }
; else
; {
.dbline 64
; for(i=0;i<MAX_FM_STATION;i++)
clr R20
xjmp L20
L17:
.dbline 65
; {
.dbline 66
; EEPROM_READ((int)&gps.ps_fm_station[i],val);
ldi R24,2
ldi R25,0
std y+0,R24
std y+1,R25
movw R24,R28
adiw R24,2
movw R18,R24
ldi R24,<_gps+8
ldi R25,>_gps+8
mov R16,R20
clr R17
lsl R16
rol R17
add R16,R24
adc R17,R25
xcall _EEPROMReadBytes
.dbline 67
; if(val==freq)
lds R3,_freq+1
lds R2,_freq
ldd R4,y+2
ldd R5,y+3
cp R4,R2
cpc R5,R3
brne L22
.dbline 68
; return i;
mov R16,R20
clr R17
xjmp L7
L22:
.dbline 69
L18:
.dbline 64
inc R20
L20:
.dbline 64
cpi R20,30
brlo L17
.dbline 69
; };
.dbline 70
; return 255;
ldi R16,255
ldi R17,0
.dbline -2
L7:
adiw R28,4
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym l val 2 i
.dbsym r i 20 c
.dbfunc s radio_action _radio_action fI
.area func_lit(rom, con, rel)
L208:
.word `L80
.word `L146
.word `L79
.word `L78
.area text(rom, con, rel)
.dbfile D:\avrmcu\AT980\bu2624\radio.c
.area func_lit(rom, con, rel)
L209:
.word `L165
.word `L165
.word `L165
.word `L165
.word `L165
.word `L165
.word `L165
.word `L165
.word `L165
.word `L165
.word `L25
.word `L25
.word `L25
.word `L28
.word `L128
.word `L139
.word `L181
.word `L25
.word `L119
.area text(rom, con, rel)
.dbfile D:\avrmcu\AT980\bu2624\radio.c
.area func_lit(rom, con, rel)
L210:
.word `L123
.word `L25
.word `L25
.word `L25
.word `L29
.word `L56
.word `L178
.word `L25
.word `L25
.word `L25
.word `L25
.word `L25
.word `L83
.word `L117
.word `L118
.word `L99
.area text(rom, con, rel)
.dbfile D:\avrmcu\AT980\bu2624\radio.c
.area func_lit(rom, con, rel)
L55:
.word `L53
.word `L45
.word `L47
.word `L49
.word `L51
.area text(rom, con, rel)
.dbfile D:\avrmcu\AT980\bu2624\radio.c
; i -> R20
.even
_radio_action::
xcall push_gset1
sbiw R28,2
.dbline -1
.dbline 75
; }
; }
;
; void radio_action(void)
; {
.dbline 78
;
; unsigned char i;
; switch(uicc_code)
lds R20,_uicc_code
clr R21
cpi R20,49
ldi R30,0
cpc R21,R30
brlt L206
ldi R24,52
ldi R25,0
cp R24,R20
cpc R25,R21
brlt L207
ldi R24,<L208
ldi R25,>L208
movw R30,R20
sbiw R30,49
lsl R30
rol R31
add R30,R24
adc R31,R25
lpm R0,Z+
lpm R1,Z
movw R30,R0
ijmp
L206:
cpi R20,1
ldi R30,0
cpc R21,R30
brge X2
xjmp L25
X2:
ldi R24,19
ldi R25,0
cp R24,R20
cpc R25,R21
brge X3
xjmp L25
X3:
ldi R24,<L209
ldi R25,>L209
movw R30,R20
sbiw R30,1
lsl R30
rol R31
add R30,R24
adc R31,R25
lpm R0,Z+
lpm R1,Z
movw R30,R0
ijmp
L207:
cpi R20,133
ldi R30,0
cpc R21,R30
brge X4
xjmp L25
X4:
ldi R24,148
ldi R25,0
cp R24,R20
cpc R25,R21
brge X5
xjmp L25
X5:
ldi R24,<L210
ldi R25,>L210
movw R30,R20
subi R30,133
sbci R31,0
lsl R30
rol R31
add R30,R24
adc R31,R25
lpm R0,Z+
lpm R1,Z
movw R30,R0
ijmp
X0:
.dbline 79
; {
L28:
.dbline 83
;
;
; case UICC_EJECT:
; display_type = DISPLAY_VERSION;
ldi R24,19
sts _display_type,R24
.dbline 84
; g_ui_tmp_msg_cnt = 20;
ldi R24,20
sts _g_ui_tmp_msg_cnt,R24
.dbline 85
; break;
xjmp L26
L29:
.dbline 88
; #ifdef SGJM_RDS
; case RD_DISPLAY:
; if(amfm_flag) break;
lds R2,_amfm_flag
tst R2
breq L30
.dbline 88
xjmp L26
L30:
.dbline 92
; #ifdef RDS_SW
; if(get_rds_sw()) break;
; #endif
; if(uicc_code == last_key)
lds R2,_last_key
lds R3,_uicc_code
cp R3,R2
brne L32
.dbline 93
; {
.dbline 94
; rds_status = 0;
clr R2
sts _rds_status,R2
.dbline 95
; rds_display_type = (rds_display_type + 1)%5;
ldi R17,5
lds R16,_rds_display_type
subi R16,255 ; addi 1
xcall mod8u
sts _rds_display_type,R16
.dbline 96
; for(i=0;i<65;i++)
clr R20
xjmp L37
L34:
.dbline 97
ldi R24,<_rds_dis_string
ldi R25,>_rds_dis_string
mov R30,R20
clr R31
add R30,R24
adc R31,R25
ldi R24,32
std z+0,R24
L35:
.dbline 96
inc R20
L37:
.dbline 96
cpi R20,65
brlo L34
.dbline 98
; rds_dis_string[i] = ' ';
; if(rds_display_type == DIS_PS_NAME)
lds R24,_rds_display_type
cpi R24,1
brne L38
.dbline 99
; {
.dbline 100
; rds_init();
xcall _rds_init
.dbline 101
; open_rds();
xcall _open_rds
.dbline 102
; }
xjmp L39
L38:
.dbline 103
; else if(rds_display_type == DIS_FREQUENCY)
lds R2,_rds_display_type
tst R2
brne L40
.dbline 104
; close_rds();
xcall _close_rds
L40:
L39:
.dbline 105
L32:
.dbline 105
; };
.dbline 106
; switch(rds_display_type)
lds R20,_rds_display_type
clr R21
cpi R20,0
ldi R30,0
cpc R21,R30
brge X6
xjmp L42
X6:
ldi R24,4
ldi R25,0
cp R24,R20
cpc R25,R21
brlt L42
ldi R24,<L55
ldi R25,>L55
movw R30,R20
lsl R30
rol R31
add R30,R24
adc R31,R25
lpm R0,Z+
lpm R1,Z
movw R30,R0
ijmp
X1:
.dbline 107
; {
L45:
.dbline 109
; case DIS_PS_NAME:
; err_msg = "PS NAME";
ldi R24,<L46
ldi R25,>L46
sts _err_msg+1,R25
sts _err_msg,R24
.dbline 110
; break;
xjmp L43
L47:
.dbline 112
; case DIS_PTY:
; pty_is_searching = 0;
clr R2
sts _pty_is_searching,R2
.dbline 113
; err_msg = " PTY";
ldi R24,<L48
ldi R25,>L48
sts _err_msg+1,R25
sts _err_msg,R24
.dbline 114
; break;
xjmp L43
L49:
.dbline 116
; case DIS_RT:
; err_msg = " RT";
ldi R24,<L50
ldi R25,>L50
sts _err_msg+1,R25
sts _err_msg,R24
.dbline 117
; break;
xjmp L43
L51:
.dbline 119
; case DIS_CT:
; err_msg = " CT";
ldi R24,<L52
ldi R25,>L52
sts _err_msg+1,R25
sts _err_msg,R24
.dbline 120
; break;
xjmp L43
L53:
.dbline 122
; case DIS_FREQUENCY:
; err_msg = " FREQ";
ldi R24,<L54
ldi R25,>L54
sts _err_msg+1,R25
sts _err_msg,R24
.dbline 123
; break;
L42:
L43:
.dbline 126
; }
;
; display_type = ERROR_MSG;
ldi R24,13
sts _display_type,R24
.dbline 127
; g_ui_tmp_msg_cnt = 10;
ldi R24,10
sts _g_ui_tmp_msg_cnt,R24
.dbline 131
; // rds_msg_detect_cnt = 25;
;
; // printf("begin rds key\n");
; break;
xjmp L26
L56:
.dbline 133
; case RD_SEARCH:
; if(amfm_flag) break;
lds R2,_amfm_flag
tst R2
breq L57
.dbline 133
xjmp L26
L57:
.dbline 138
; #ifdef RDS_SW
; if(get_rds_sw()) break;
; #endif
; //judge the first pressed pty search
; if(pty_is_searching==0)
lds R2,_pty_is_searching
tst R2
brne L59
.dbline 139
; {
.dbline 140
; pty_is_searching = 1;
ldi R24,1
sts _pty_is_searching,R24
.dbline 142
; //g_ui_tmp_msg_cnt = 15;
; if(rds_display_type!=DIS_FREQUENCY)
lds R2,_rds_display_type
tst R2
breq L61
.dbline 143
; {
.dbline 144
; if(rds_data.syc_flag)
lds R2,_rds_data+10
tst R2
breq L63
.dbline 145
; {
.dbline 146
; pty_search_type = (unsigned char)((rds_data.B_word>>5)&0x001f);
ldi R18,5
ldi R19,0
lds R17,_rds_data+2+1
lds R16,_rds_data+2
xcall lsr16
movw R24,R16
andi R24,31
andi R25,0
sts _rds_dis_string+1,R24
.dbline 147
; if((pty_search_type!=PTY_ALARM)&&(pty_search_type>PTY_OTHER_M))
cpi R24,31
breq L62
ldi R24,15
lds R2,_rds_dis_string+1
cp R24,R2
brsh L62
.dbline 148
; {
.dbline 149
; pty_search_type = PTY_NONE;
clr R2
sts _rds_dis_string+1,R2
.dbline 150
; };
.dbline 150
.dbline 151
; }
xjmp L62
L63:
.dbline 153
; else
; pty_search_type = PTY_NONE;
clr R2
sts _rds_dis_string+1,R2
.dbline 154
; }
xjmp L62
L61:
.dbline 156
; else
; {
.dbline 157
; rds_init();
xcall _rds_init
.dbline 158
; open_rds();
xcall _open_rds
.dbline 159
; pty_search_type = PTY_NONE;
clr R2
sts _rds_dis_string+1,R2
.dbline 160
L62:
.dbline 160
; };
.dbline 161
; rds_display_type = DIS_PTY;
ldi R24,2
sts _rds_display_type,R24
.dbline 162
; display_type = rds_display_type;
mov R2,R24
sts _display_type,R2
.dbline 163
; }
xjmp L26
L59:
.dbline 169
; // else if(pty_is_searching==2) //the 3rd
; // {
; // pty_is_searching = 0;
; // is_autosearching = 0;
; // }
; else if(pty_is_searching == 1) //the 2rd
lds R24,_pty_is_searching
cpi R24,1
breq X7
xjmp L26
X7:
.dbline 170
; {
.dbline 171
; pty_is_searching = 2;
ldi R24,2
sts _pty_is_searching,R24
.dbline 172
; search_ok = 0;
clr R2
sts _search_ok,R2
.dbline 173
; search_dir = 1;
ldi R24,1
sts _search_dir,R24
.dbline 174
; is_autosearching = 1;
sts _is_autosearching,R24
.dbline 175
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -