Search found 6 matches

by xiran
Sun Oct 26, 2025 7:08 pm
Forum: General
Topic: Analog value with I2C display ssd1306
Replies: 14
Views: 6621

Re: Analog value with I2C display ssd1306

Finally, at the end, this was be the answer:
"
volt=(ADRESH << 8) | ADRESL;
// Calcular la resistencia desconocida usando solo aritmética de enteros, float no, long no en 12f675
r_x = (unsigned int)((unsigned int)100 * volt) / (1023 - volt);
"
It give it to me, the same result as multimeter ...
by xiran
Sat Oct 25, 2025 1:37 am
Forum: General
Topic: Analog value with I2C display ssd1306
Replies: 14
Views: 6621

Re: Analog value with I2C display ssd1306

Changed R fixed from 330 to 100 ohms, and measure values to max 100 ohms:

volt=((unsigned int)ADRESH*256 + ADRESL)*5;
res= ((100 * volt) /(5000 - volt));

I´ve upload some values:
Real v Oled R Oled V Calc
21 10 1095 29
33 13 1300 35
82 19 2280 83
100 24 2550 104

Where:
Real v:
are the color code ...
by xiran
Thu Oct 23, 2025 6:57 pm
Forum: General
Topic: Analog value with I2C display ssd1306
Replies: 14
Views: 6621

Re: Analog value with I2C display ssd1306

Thx for answer steve.

If i put a know value (res=9876), it shows fine. So maybe the calculation is the bad thing

Edit:

If i made the real calculation, "res" calculation, is a negative answer, because volt it´s a 4 digits value (not less 5v value), so, if i have 4v, volt is equal to 4000, not only ...
by xiran
Thu Oct 23, 2025 1:07 am
Forum: General
Topic: Analog value with I2C display ssd1306
Replies: 14
Views: 6621

Re: Analog value with I2C display ssd1306

The variables are declared:

unsigned char d[4], i;
unsigned int volt, res ;

And used:
A) Not working:

for(i=0;i<4;++i){
d =res %10;
res=res/10;
}
drawChar4(d[3], 0, 0);
drawChar4(d[2], 0, 2);
drawChar4(d[1], 0, 3);
drawChar4(d[0], 0, 4);

B) Working:

for(i=0;i<4;++i){
d =volt %10 ...
by xiran
Tue Oct 21, 2025 6:44 pm
Forum: General
Topic: Analog value with I2C display ssd1306
Replies: 14
Views: 6621

Re: Analog value with I2C display ssd1306

Thx for answer Martin!

I´m using C code, and a pic12f675, founded how to run with ssd1306, the example that i´ve found, it´s a volmeter, but i want to made a Resistometer, =).

The mats are:

volt=((unsigned int)ADRESH*256 + ADRESL)*5;

And i´ve add:

res= ((330 * volt) /(5 - volt));

But the ...
by xiran
Fri Oct 17, 2025 5:55 pm
Forum: General
Topic: Analog value with I2C display ssd1306
Replies: 14
Views: 6621

Re: Analog value with I2C display ssd1306

Hi!

I´m new in FC, i´ve come from niple soft, stm32 and pi pico.

I´ve download the file that mnfisher upload, when i´ve try to compile, it says error:

Unknown or missing component: Potentiometer1::GetByte()

Do you know why?


Thx!