void DataOut(int inData,char len)
{
int hundreds,tens,ones=0;
char loopBits;
thousands = (inData / 1000) + 0x30;
hundreds = (inData / 100) + 0x30;
tens = (inData / 10) + 0x30;
ones = (inData % 10) + 0x30;
if(len == 4)
{
len--;
for(loopBits=0;loopBits<8;loopBits++)
{
CS2 =0;
SCL =0; SI=0;
if( thousands & 0x80 == 1)
{
SI=1; SCL =1; SI=0; SCL =0;
}
thousands <<= 1;
CS2 =1;
}
}
if(len == 3)
{
len--;
for(loopBits=0;loopBits<8;loopBits++)
{
CS2 =0;
SCL =0; SI=0;
if( hundreds & 0x80 == 1)
{
SI=1; SCL =1; SI=0; SCL =0;
}
hundreds <<= 1;
CS2 =1;
}
}
if(len == 2)
{
len--;
for(loopBits=0;loopBits<8;loopBits++)
{
CS2 =0;
SCL =0; SI=0;
if( tens & 0x80 == 1)
{
SI=1; SCL =1; SI=0; SCL =0;
}
tens <<= 1;
CS2 =1;
}
}
if(len == 1)
{
len--;
for(loopBits=0;loopBits<8;loopBits++)
{
CS2 =0;
SCL =0; SI=0;
if( ones & 0x80 == 1)
{
SI=1; SCL =1; SI=0; SCL =0;
}
ones <<= 1;
CS2 =1;
}
}
}