Требуется программист в Зеленограде
- обработка данных с датчиков; ColdFire; 40 тыс. e-mail:jobsmp@pochta.ru |
//////////////////////////
void itoa1(unsigned int binval)
{
register unsigned int temp;
register unsigned char binc,atemp;
////////////////////////
temp = 30000;
if( binval >= temp )
{
binval -= temp;
atemp = '3';
}/*if*/
else
{
atemp = '0';
}/*else*/
temp = 10000;
while(binval >= temp)
{
atemp++;
binval -= temp;
}/*while*/
*(asc+0) = atemp;
////////////////////////
////////////////////////
temp = 5000;
if( binval >= temp )
{
binval -= temp;
atemp = '5';
}/*if*/
else
{
atemp = '0';
}/*else*/
temp = 1000;
while(binval >= temp)
{
atemp++;
binval -= temp;
}
*(asc+1) = atemp;
////////////////////////
////////////////////////
temp = 500;
if( binval >= temp )
{
binval -= temp;
atemp = '5';
}/*if*/
else
{
atemp = '0';
}/*else*/
temp = 100;
while(binval >= temp)
{
atemp++;
binval -= temp;
}/*while*/
*(asc+2) = atemp;
////////////////////////
////////////////////////
temp = 50;
if( binval >= temp )
{
binval -= temp;
atemp = '5';
}/*if*/
else
{
atemp = '0';
}/*else*/
binc = (unsigned char)binval;
while(binc >= 10)
{
atemp++;
binc -= 10;
}/*while*/
*(asc+3) = atemp;
////////////////////////
binc += '0';
*(asc+4) = binc;
*(asc+5) = '\0';
}/*itoa1*/
//////////////////////////
//////////////////////////
int main( void )
{
itoa1( 59999 );
printf("\n %s ", asc );
}