📄 impactr2.c
字号:
void dot_ln(void)
{
unsigned char i,k;
if(prt_dw_flag == 1)
{
k = 0x01;
a_char = 0x00;
b_char = 0x01;
c_char = 0x02;
d_char = 0x03;
e_char = 0x04;
f_char = 0x05;
g_char = 0x06;
h_char = 0x07;
}
else
{
k = 0x03;
a_char = 0x00;
b_char = 0x03;
c_char = 0x06;
d_char = 0x09;
e_char = 0x0C;
f_char = 0x0F;
g_char = 0x12;
h_char = 0x15;
}
while(k != 0)
{
adg_bits();
beh_bits();
cf_bits();
for(i=0;i<6;i++)
{
dot_1(); //1 dot will be printed
}
++a_char;
++b_char;
++c_char;
++d_char;
++e_char;
++f_char;
++g_char;
++h_char;
--k;
}
}
void adg_bits(void)
{
unsigned char ch;
ch = *(line_no+ test_msg[a_char]);
a_dot = ch << 2;
ch = ch >> 1;
ch = *(line_no + test_msg[d_char]);
d_dot = ch << 2;
ch = ch >> 1;
ch = *(line_no + test_msg[g_char]);
g_dot = ch << 2;
ch = ch >> 1;
}
void beh_bits(void)
{
unsigned char ch;
ch = *(line_no+ test_msg[b_char]);
b_dot = ch << 2;
ch = ch >> 1;
ch = *(line_no + test_msg[e_char]);
e_dot = ch << 2;
ch = ch >> 1;
ch = *(line_no + test_msg[h_char]);
h_dot = ch << 2;
ch = ch >> 1;
}
void cf_bits(void)
{
unsigned char ch;
ch = *(line_no+ test_msg[c_char]);
c_dot = ch << 2;
ch = ch >> 1;
ch = *(line_no + test_msg[f_char]);
f_dot = ch << 2;
ch = ch >> 1;
}
void dot_1(void)
{
if(prt_dw_flag == 1)
{
hi_pul();
adg_dots();
lo_pul();
hi_pul();
//DATAOUT_A =0x00;
//prt_enable();
FIO1PIN3 = 0xFF;
beh_dots();
lo_pul();
hi_pul();
//DATAOUT_A =0x00;
//prt_enable();
FIO1PIN3 = 0xFF;
cf_dots();
lo_pul();
hi_pul();
//DATAOUT_A =0x00;
//prt_enable();
FIO1PIN3 = 0xFF;
}
hi_pul();
adg_dots();
lo_pul();
hi_pul();
//DATAOUT_A =0x00;
//prt_enable();
FIO1PIN3 = 0xFF;
beh_dots();
lo_pul();
hi_pul();
//DATAOUT_A =0x00;
//prt_enable();
FIO1PIN3 = 0xFF;
cf_dots();
lo_pul();
hi_pul();
//DATAOUT_A =0x00;
//prt_enable();
FIO1PIN3 = 0xFF;
a_dot = a_dot << 1;
b_dot = b_dot << 1;
c_dot = c_dot << 1;
d_dot = d_dot << 1;
e_dot = e_dot << 1;
f_dot = f_dot << 1;
g_dot = g_dot << 1;
h_dot = h_dot << 1;
}
void adg_dots(void)
{
unsigned char temp;
unsigned char ch;
temp = 0x00; //ff;
ch = a_dot;
bit_1 = ch & 0x80;
if(bit_1 == 1)
{
temp = (temp |0x01); //& 0xfe);
//temp = (temp & 0xfe);
}
ch = d_dot;
bit_4= ch & 0x80;
if(bit_4 == 1)
{
temp = (temp | 0x08); //& 0xf7);
//temp = (temp & 0xf7);
}
ch = g_dot;
bit_7= ch & 0x80;
if(bit_7 == 1)
{
temp = (temp | 0x40); //& 0xbf);
//temp = (temp & 0xbf);
}
//DATAOUT_A = temp;
//prt_enable();
FIO1PIN3 = temp; // invert
}
void beh_dots(void)
{
unsigned char temp;
unsigned char ch;
temp =0x00; //ff;
ch = b_dot;
bit_2= ch & 0x80;
if(bit_2 == 1)
{
temp = (temp | 0x02); // & 0xfd);
//temp = (temp & 0xfd);
}
ch = e_dot;
bit_5= ch & 0x80;
if(bit_5 == 1)
{
temp = (temp | 0x10); //& 0xef);
//temp = (temp & 0xef);
}
ch = h_dot;
bit_8= ch & 0x80;
if(bit_8 == 1)
{
temp = (temp | 0x80); //&0x7F);
//temp = (temp &0x7F);
}
// DATAOUT_A = temp;
// prt_enable();
FIO1PIN3 = ~temp; //invert
}
void cf_dots(void)
{
unsigned char temp;
unsigned char ch;
temp =0x00; //ff;
ch = c_dot;
bit_3= ch & 0x80;
if(bit_3 == 1)
{
temp = (temp | 0x04); // & 0xfb);
//temp = (temp & 0xfb);
}
ch = f_dot;
bit_6= ch & 0x80;
if(bit_6 == 1)
{
temp = (temp | 0x20); //& 0xdf);
//temp = (temp & 0xdf);
}
//DATAOUT_A = temp;
//prt_enable();
FIO1PIN3 = ~temp; //invert
} /////////////////////////////////////////////////
void chk(void)
{
unsigned char chk_cnt;
//while(res_det == 0);
FIO0MASK = ~(1 << 26);
while(!FIO0PIN3);
FIO0MASK = 0;
for(chk_cnt=0;chk_cnt<6;chk_cnt++)
{
hi_pul();
lo_pul();
}
//while(res_det == 1);
FIO0MASK = ~(1 << 26);
while(FIO0PIN3);
FIO0MASK = 0;
//while(time_det == 0);
FIO0MASK = ~(1 << 25);
while(!FIO0PIN3);
FIO0MASK = 0;
//while(time_det == 1);
FIO0MASK = ~(1 << 25);
while(FIO0PIN3);
FIO0MASK = 0;
//while(time_det == 0);
FIO0MASK = ~(1 << 25);
while(!FIO0PIN3);
FIO0MASK = 0;
}
void hi_pul(void)
{
unsigned char hi_cnt;
//while(time_det == 0);
FIO0MASK = ~(1 << 25);
while(!FIO0PIN3);
FIO0MASK = 0;
for(hi_cnt=0;hi_cnt<100;hi_cnt++); //check delays
// __nop__();
//while(time_det == 0);
FIO0MASK = ~(1 << 25);
while(!FIO0PIN3);
FIO0MASK = 0;
}
void lo_pul(void)
{
unsigned int lo_cnt;
//while(time_det == 1);
FIO0MASK = ~(1 << 25);
while(FIO0PIN3);
FIO0MASK = 0;
for(lo_cnt=0;lo_cnt<100;lo_cnt++);
// __nop__();
//while(time_det == 1);
FIO0MASK = ~(1 << 25);
while(FIO0PIN3);
FIO0MASK = 0;
}
void sm_prt(unsigned char prn_msgch)
{
if(prn_msgch == 0x0a)
{
while(smprn_i<24)
{
test_msg[smprn_i]=0x20;
smprn_i++;
}
if(prt_dh_flag == 1)
{
st_prt_dh();
}
else
{
st_prt();
}
smprn_i=0;
}
else
{
test_msg[smprn_i] = prn_msgch;
smprn_i++;
if(smprn_i>=24)
{
if(prt_dh_flag == 1)
{
st_prt_dh();
}
else
{
st_prt();
}
smprn_i=0;
}
}
}
void prt_msg(char * prt_msg_data,unsigned char max_char)
{
unsigned char count,prt_msg_ch;
for(count=0;count<max_char;count++)
{
prt_msg_ch= prt_msg_data[count];
sm_prt(prt_msg_ch);
}
}
void prt_bcd2(unsigned char prt_bcd2_data)
{
unsigned char prt_bcd2_data1;
prt_bcd2_data1=((prt_bcd2_data>>4)&0x0f)+0x30;
sm_prt(prt_bcd2_data1);
prt_bcd2_data1=(prt_bcd2_data&0x0f)+0x30;
sm_prt(prt_bcd2_data1);
}
void prt_date()
{
prt_bcd2(date[0]);
prt_msg("-",1);
prt_bcd2(date[1]);
prt_msg("-",1);
prt_msg("20",2);
prt_bcd2(date[2]);
}
void prt_time()
{
prt_bcd2(time[0]);
prt_msg(":",1);
prt_bcd2(time[1]);
prt_msg(":",1);
prt_bcd2(time[2]);
}
void prt_msgb(char * prt_msg_data)
{
unsigned char count,prt_msg_ch;
count=0;
while(prt_msg_data[count] !='\0')
{
prt_msg_ch= prt_msg_data[count];
sm_prt(prt_msg_ch);
count++;
if(count==24) break;
}
for(;count<24;count++)
{
prt_msg_ch=0x20; //space
sm_prt(prt_msg_ch);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -