
This is I use LIC7135 an electronic scale AD conversion part, want to ask, how SCM from 7135 digital quantity is converted to a weight, according to above the LCD1602, 7135 with the method of inquiry is interrupted,
The following attached to the C language programming of the chip, is there anyone help to point out if there is a error in the programming,
# include & lt; Reg51. H>
# define uint unsigned int
# define uchar unsigned char
Sbit icl_rn=P3 ^ 3;
Sbit icl_st=P3 ^ 2;
Uchar k, m;
Uchar ADBUF [8]=0;//AD buffer
Void delay (uchar z);
Void init_into ();
Void main (void)
{
Init_into ();
Icl_rn=1;//start end can make start the AD conversion
}
Void init_into ()//initializes the external interrupt 0
{
IT0=1;
EX0=1;
EA=1;
}
Void delay (uchar z)
{
Uchar x, y;
For (x=z; X> 0; X -)
For (y=110; y> 0; y--);
}
Void exter0 interrupt 0//external interrupt 0 () subroutine
{
EA=0;
K=P2.
If ((P2 & amp; 0 x10)!=0 x10)
{
Do//one thousand
{
K=P2.
} while ((k& 0 x08)!=0 x08);
ADBUF [1]=P1 & amp; 0 x0f;
Do//one hundred
{
K=P2.
} while ((k& 0 x04)!=0 x04);
ADBUF [2]=P1 & amp; 0 x0f;
Do//10
{
K=P2.
} while ((k& 0 x02)!=0 x02);
ADBUF [3]=P1 & amp; 0 x0f;
Do//bits
{
K=P2.
} while ((k& 0 x01)!=0 x01);
ADBUF [4]=P1 & amp; 0 x0f;
}
The else
{
If ((P1 & amp; 0 x08)==0 x08)//range
Delay (1000);
The else//owe range
{
If ((P1 & amp; 0 x04)==0 x04)
Delay (1000);
The else//ten thousand
ADBUF [0]=P1 & amp; 0 x0f;
}
}
}