AnsweredAssumed Answered

DS1822

Question asked by Matthew Grenke on Jul 17, 2011
Latest reply on Aug 12, 2011 by Jim Donelson

Hi there,

 

I am using a 13192-EVB board from Freescale. It has a MC9S08GT60 MCU. I am trying to get the DS1822 temp. sensor to communicate with the MC9S08GT60. I keep getting a temperature value of -255 all the time. Was wondering if someone can help me troubleshoot the issues I'm having. I'm using a 4.7 k pullup resistor and I am providing approx. 5V to power the DS1822. I am connecting a wire from pin 2 of the DS1822 to one of the IO pins (J107) on the 13192-EVB boards. I have pasted the code below to see if someone can help me. I am not sure if I have the bus speed configured correctly. I was using the Device Initialization Expert and I enabled the FLL clock to try to manually set the internal bus frequency to approx. 8 Mhz (7.776 Mhz is the closest I could get). I think that is what the code requires according to the delay function that I am using, but I could be wrong. Also in the device initialization expert I enabled PTA0 and PTA1 for input and output respectively with pullup enabled. The problem is when I compile the code and run it - I keep getting a uiTemperature value of -255. I don't know what the problem is. It seems to me like the DS1822 is just not communicating properly with the MCU and that the timing (delays) must be wrong. Would really appreciate all of your thoughts on this. Thanks.

 

 

Here are the definitions:

 

#define TRUE 1
#define FALSE 0


#ifndef PORTS_DQ
#define PORTS_DQ 1
#define DQ_RX     PTAD_PTAD0
#define DQ_TX     PTAD_PTAD1
#define DIR_DQRX  0
#define DIR_DQTX  1
#endif

Outcomes