galera vou atualizar o relogio pela serial via programa em delphi
entao o programa vai me enviar '1'+'2'+'3'+'0' para 12:30 certo como o ds1307 tem que receber de uma varialvel inteira assim
hr=12
min=30
estou usando ccs e biblioteca dele ja tem
BYTE bin2bcd(BYTE binary_value)
{
BYTE temp;
BYTE retval;
temp = binary_value;
retval = 0;
while(1)
{
// Get the tens digit by doing multiple subtraction
// of 10 from the binary value.
if(temp >= 10)
{
temp -= 10;
retval += 0x10;
}
else // Get the ones digit by adding the remainder.
{
retval += temp;
break;
}
}
return(retval);
}
entao o que preciso como juntar o '1'+'2' para formar 12????