// PICプログラム"remcn3.asm"の読み取りと表示 [console版]
// by I.N.
// 2016.11.22 ver.1.0 初版(NEC)
// 2016.11.24 ver.1.1 AEHA, SONYの追加
// 2017.01.10 ver.1.2 SAMSUNG/FUNAIの追加
// 2017.01.11 ver.1.3 VICTORの追加
#include <erslib.h>
int ncom=4;
void main(void)
{
int count=0;
unsigned char buf[32];
char *str[6]={
"N4:NEC",
"V2:VICTOR",
"G4:SAMSUNG",
"A6:AEHA",
"F4:FUNAI",
"S3:SONY"
};
int r;
r=ERS_Open(ncom,4096,4096);
if(r){
printf("com open error.\n");
return;
}
ERS_BaudRate(ncom,38400);
printf("Start\n");
for(;;){
if(ERS_CheckRecv(ncom)>0){
int c= ERS_Getc(ncom);
printf("%04d : ",count++);
for(int i=0;i<6;i++){
if(c==str[i][0]){
printf("[%s] ",&str[i][3]);
int bytes= str[i][1]-'0';
ERS_Recv(ncom,buf,bytes);
for(int k=0; k<bytes; k++){
printf("%02Xh ",buf[k]);
}
printf("\n");
}else if(c==str[i][0]+32){
printf("[%s] Repeat\n",&str[i][3]);
}
}
}
}
ERS_Close(ncom);
printf("End\n");
}
|