圣源电子制作
标题:
M50462 红外遥控芯片汇编程序 M50462遥控
[打印本页]
作者:
sydz
时间:
2011-10-10 14:48
标题:
M50462 红外遥控芯片汇编程序 M50462遥控
各种用M50462芯片遥控
(, 下载次数: 50)
上传
点击文件名下载附件
(, 下载次数: 56)
上传
点击文件名下载附件
(, 下载次数: 50)
上传
点击文件名下载附件
芯片
(, 下载次数: 53)
上传
点击文件名下载附件
(, 下载次数: 52)
上传
点击文件名下载附件
/************** YTREM.PLM ********************/
/* 遥控器按键代码表(熊猫 M50462/CL54L2) */
/* 1---00h;2---10h;3---08h;4---18h;5---04h;6---14h;7---0ch;8---1ch; */
/* 9---80h;0---90h;1+---88h;2+---98h;pd+---50h;pd_---48h;ld+---0cch; */
/* ld_---0dch;yl+---44h;yl_---54h;sd+---0c4h;sd_---0d4h;BZ---0D0h; */
/* TV/AV---5CH;PX---D8H;-->.<-- ---0D0H;CLK---0E8H;*/
/* TIME---0F8H;ON.T---0E4H;SEL---0F4H;INC---0ECH; */
start:do;
$include(reg51.dcl)
declare (data1,data2,key,DAT) byte at (30h);
declare (ah,al,NUMBER,jihao,bjihao) byte;
declare Ale literally 'p17',da literally 'p15',clk literally 'p16';
DECLARE ACO(11) BYTE CONSTANT (0EDH,28H,0DCH,7CH,39H,75H,0F5H,2CH,
0FDH,7DH,02H);
DISPLAY: PROCEDURE(NUM);
DECLARE (K,NUM,N) BYTE;
N=NUM;
N=N MOD 10;
N=ACO(N);
DO K=0 TO 7;
N=SCR(N,1);
DA=CY;
CLK=0;
call time(1);
CLK=1;
END;
N=NUM;
N=N/10;
N=ACO(N);
DO K=0 TO 7;
N=SCR(N,1);
DA=CY;
CLK=0;
call time(1);
CLK=1;
END;
ALE=0;
call time(2);
ALE=1;
END DISPLAY;
YTNUMBER: procedure(kk);
declare (kk,relay) byte;
if kk=02 then
DO;
NUMBER=NUMBER+1;
IF NUMBER>4 THEN NUMBER=1;
END;
if kk=01 then
DO;
NUMBER=NUMBER-1;
IF NUMBER=0 THEN NUMBER=4;
END;
CALL DISPLAY(NUMBER);
KEY=0; data2=0;
END YTNUMBER;
recieve: procedure interrupt 4 using 1;
declare (k,ask) byte;
disable;
if data2=0e2h and dat<>0 then
do;
ri=0;
jihao=sbuf;
if jihao=bjihao then
do;
data2=0;
p32=1;
do k=1 to 2;
if k=1 then sbuf=dat;
if k=2 then sbuf=number;
do while ti=0;
end;
ti=0;
call time(1);
end;
p32=0;
do while ri=0;
end;
ri=0;
ask=sbuf;
if ask=0ffh then
do;
;
end;
/* data1=0ffh;dat=0; */
end;
end;
enable;
end recieve;
rem:procedure interrupt 2;
declare k byte;
disable;
/* if data2=0e2h then goto int0end; */
k=16;
loop1:
call time(2);
do while p33=0;
end;
th0=0;
tl0=0;
tr0=1;
call time(2);
do while p33=1;
end;
tr0=0;
ah=th0;
al=tl0;
if ah>=4 then cy=1; /* 11.0592Mhz */
else cy=0;
data1=scl(data1,1);
k=k-1;
if k=8 then data2=data1;
if k<>0 then goto loop1;
if data2=0e2h then
do;
IF DATA1=54H THEN do;KEY=01;dat=0;end; /* YTNUMBER DEC KEY */
IF DATA1=44H THEN do;KEY=02;dat=0;end; /* YTNUMBER ADD KEY */
IF DATA1=00H THEN DAT=1;
IF DATA1=10H THEN DAT=2;
IF DATA1=08H THEN DAT=3;
IF DATA1=18H THEN DAT=4;
IF DATA1=04H THEN DAT=5;
IF DATA1=14H THEN DAT=6;
IF DATA1=0CH THEN DAT=7;
IF DATA1=1CH THEN DAT=8;
IF DATA1=80H THEN DAT=9;
IF DATA1=90H THEN DAT=10;
IF DATA1=88H THEN DAT=11;
IF DATA1=98H THEN DAT=12;
IF DATA1=50H THEN DAT=13;
IF DATA1=48H THEN DAT=14;
IF DATA1=40H THEN DAT=15;
IF DATA1=4CH THEN DAT=16;
IF DATA1=5CH THEN DAT=17;
IF DATA1=0D8H THEN DAT=18;
IF DATA1=0D0H THEN DAT=19;
IF DATA1=0E8H THEN DAT=20;
IF DATA1=0F8H THEN DAT=21;
IF DATA1=0E4H THEN DAT=22;
IF DATA1=0F4H THEN DAT=23;
IF DATA1=0ECH THEN DAT=24;
/* P34=0;CALL TIME(250);P34=1; */
end;
int0end:
ip=0;
DO K=0 TO 3; /* important value */
CALL TIME(250);
END;
enable;
end rem;
main$program:
data1=0;data2=0;dat=0;
p32=0; /* set recieve mode */
clk=1;Ale=1;
p33=1;NUMBER=1;KEY=0;
scon=50h;
pcon=00h;
tmod=21h;
tl1=0fdh; /* 9600 baud rate for 11.0592Mhz */
th1=0fdh;
th0=0;
tl0=0;
tr1=1;
es=1;
ex1=1;
bjihao=1;
enable;
call DISPLAY(NUMBER);
DO WHILE 1=1;
IF KEY=01 OR KEY=02 THEN
DO;
CALL YTNUMBER(KEY);
END;
end start;
复制代码
欢迎光临 圣源电子制作 (https://syyyd.com/)
Powered by Discuz! X3.4