Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Display values to a 7 segments display.(howto?)

Status
Not open for further replies.

jccsantos

Junior Member level 2
Joined
May 10, 2004
Messages
22
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
159
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 2 7 seg´s the number 23 and to the second two seg´s another value .


Thank´s in advance.
 

I could not get your problem.
You need to send the address and data to be written thru' the I2C logic.
Madhukar
 

Also post the ds1820_read routine. The easiest would be to modify it to return the four digits, instead of computing them from a float value.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top