jccsantos
Joined: 01 Nov 2005 Posts: 6
|
Display value to a 7 segments display.(howto?) |
Posted: Fri Jun 15, 2007 9:56 am |
|
|
Hi, i have this code.
Code: | void main()
{ float temperature;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
printf("inicio.\r\n");
init_max();
delay_ms(100);
Set_device();
Power_mode(true);
Decode_mode(0x0F);
Scan_Limit(0x03);
Set_intensity(0x3f);
Input_Config(0x4f);
test(true);
delay_ms(1000);
test(false);
Print_display(0,0,0,0);
while(1){
temperature = ds1820_read();
printf("TEMP: %3.2f \r\n", temperature);
//delay_ms(2000);
}
}
|
this work fine, in a terminal i have the temperature displayed.
But now my problem:
I want to display in a mx5969 the value of temperature.
I start to make this for sending to max the number for the 4 display´s.
Code: | Void print_display(int digit1, int digit2, int digit3, int digit4) { //Display segments
i2c_start();
i2c_write((device<<1) & 0xFE);
i2c_write(0x20);
i2c_write(digit1);
i2c_write(digit2);
i2c_write(digit3);
i2c_write(digit4);
i2c_stop();
} |
make a print_display(1,2,3,4); for example it work fine.
My question is how to pass the "temperature = ds1820_read();" for the max6959
in 2 cases:
Temperature example: 23.65ºC
1º display in max the 4 number´s 23 65
2º send to first two 7 seg´s the number 23 and to the second two seg´s another value(another sensor for example).
Thank´s in advance. |
|