Go Down

Topic: LCD's just showing "27:85:85" (Read 375 times) previous topic - next topic

Brit0

I am making a program to monitore datas like voltage, current, temperature etc. The project will use 4 displays, in the moment I am just using two displays with i2c. I am using the arduino MEGA 2560. When I compile the program I can see just "27:85:85" in both displays.... What is the problem with my code?


I sent the code.





   

MAS3

Hi.

You are using a function (called ConverteParaBCD), to do some conversion.
It takes a value, divides it by 160, and then takes part of that same value and adds it to the first result, correct ?
Is that really what you mean to do ?

If not, it's easy to google for that task.

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

bperrybap

Hi.

You are using a function (called ConverteParaBCD), to do some conversion.
It takes a value, divides it by 160, and then takes part of that same value and adds it to the first result, correct ?
Is that really what you mean to do ?
I don't see that.
I see:
Code: [Select]
byte ConverteparaDecimal(byte val)  
{
  //Converte de BCD para decimal
  return ( (val/16*10) + (val%16) );
}


That function looks ok to me to convert BCD to decimal.

val/16*10 is not the same as val/160
It is the same as (val/16) * 10 which is the same as (val >> 4) * 10



--- bill


Go Up