CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

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

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jccsantos



Joined: 01 Nov 2005
Posts: 6

View user's profile Send private message

Display value to a 7 segments display.(howto?)
PostPosted: Fri Jun 15, 2007 9:56 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group