ccs c ile sıcaklık olcmek ?

Başlatan berkay_yalan, 09 Şubat 2009, 16:41:02

berkay_yalan

ccs ıle lcd ekranda dogru degerı olcemıyorum :cry:

while (true) {
sicaklik=ds1820_read();
lcd_send_byte(0,0x80);
lcd_putc3_2f(sicaklik);  // lcd_putc3_2f bunun tanımlaması var 
}


ds1820.c

float ds1820_read()
{
 int8 busy=0, temp1, temp2;
 signed int16 temp3;
 float result;

 onewire_reset();
 onewire_write(0xCC);
 onewire_write(0x44);

 while (busy == 0)
 busy = onewire_read();

 onewire_reset();
 onewire_write(0xCC);
 onewire_write(0xBE);
 temp1 = onewire_read();
 temp2 = onewire_read();
 temp3 = make16(temp2, temp1);
 
 //result = (float) temp3 / 2.0;   //Calculation for DS18S20 with 0.5 deg C resolution
 result = (float) temp3 / 16.0;  //Calculation for DS18B20 with 0.1 deg C resolution
 
 delay_ms(200);
 return(result);


wire.c

#define ONE_WIRE_PIN PIN_B0

void onewire_reset()  // OK if just using a single permanently connected device
{
 output_low(ONE_WIRE_PIN);
 delay_us( 500 ); // pull 1-wire low for reset pulse
 output_float(ONE_WIRE_PIN); // float 1-wire high
 delay_us( 500 ); // wait-out remaining initialisation window.
 output_float(ONE_WIRE_PIN);
}


void onewire_write(int data)
{
 int count;

 for (count=0; count<8; ++count)
 {
  output_low(ONE_WIRE_PIN);
  delay_us( 2 ); // pull 1-wire low to initiate write time-slot.
  output_bit(ONE_WIRE_PIN, shift_right(&data,1,0)); // set output bit on 1-wire
  delay_us( 60 ); // wait until end of write slot.
  output_float(ONE_WIRE_PIN); // set 1-wire high again,
  delay_us( 2 ); // for more than 1us minimum.
 }
}


int onewire_read()
{
 int count, data;

 for (count=0; count<8; ++count)
 {
  output_low(ONE_WIRE_PIN);
  delay_us( 2 ); // pull 1-wire low to initiate read time-slot.
  output_float(ONE_WIRE_PIN); // now let 1-wire float high,
  delay_us( 8 ); // let device state stabilise,
  shift_right(&data,1,input(ONE_WIRE_PIN)); // and load result.
  delay_us( 120 ); // wait until end of read slot.
 }

 return( data );
}

koordinat


berkay_yalan

sagolun gozumden kacmıs gercekten ccs baslıgı altında 12 sayfa var ve ıyı kotu baktım

kolay gelsın

berkay_yalan

bırde bu derece sımgesını nasıl cıkartıyoruz?

edit :  lcd_putc(223);

:oops:

koordinat

printf(lcd_putc,"TEMP: %3.1f ", temperature);