On 3/2/2011 6:05 AM, Manu Abraham wrote: > On Wed, Mar 2, 2011 at 5:16 PM, Matt Callow wrote: >> On 2 March 2011 20:25, Manu Abraham wrote: >>> Hi, >>> >>> I have been trying to use a DS1820 in conjunction with an 18F452. >>> >>> - I am using the parasite mode of power for the DS1820 >>> (DQ pin connected for Data; VDD connected to GND) >>> - The DS1820 manual states that: >>> >>> "In some situations the bus master may not know whether the DS18B20's >>> on the bus are parasite powered or powered by external supplies. The >>> master needs this information to determine if the strong bus pullup >>> should be used during temperature conversions." >>> >>> Now, I have the DS1820 pin pulled up to VDD (+5V) using a 4.7k >>> resistor and connected to RA0 of the 18F452. >>> >>> My question is: >>> How can I pullup RA0 while TRISA is configured as HiZ mode (input, >>> TRISA.0 =3D 1) ? That line from the datasheet has added a bit of >>> confusion to my mind. >>> >>> Any ideas ? >> Hi, >> >> If you really want to keep RA0 as an input, then you need to use a >> separate output pin on the PIC to drive a FET (or similar) to provide >> the strong pullup. >> But it's much easier to switch RA0 to an output to provide the strong >> pullup when required. >> I've done this in the past and it works fine, as long as you apply the >> strong pullup within the time limits specified in the data sheet. >> The method for determining if parasite power is required is also in >> the data sheet. I haven't implemented this in my application as I know >> what sensors I have on the 1-wire bus, and I know that they need >> parasite power. Therefore no need to check. > > Yeah, sounds similar to what I am doing: > > - I have just 1 sensor and I know that it is parasite powered, hence > no need to check the type of power supply mode. > - I am toggling RA.0 as input and output, rather than having a fixed > RA.0 as input > > But my question is: > > - When RA.0 is input, how will the 1 wire slave be powered ? (ie > according to the DS1820 datasheet, how to enable a strong pullup) > > I will simplify my question a bit more: > > - send Master Tx Command 0x44 > - I know it is Parasite powered > - The master needs to enable Strong pullup on DQ > - 1820 does conversion > - The master disables Strong pullup > > > Strong pullup would imply TRISA.0 =3D 1 ? I see that PORTB can use weak > pullups, but can't see how the same can be achieved with PORTA ? > > Best Regards, > Manu I see now. You must drive enough current into the DS1820 to power it while it=20 calculates. Do thjs by setting the TRIS pin to 0 (drive) then set the PORT pin to HI (5V). Keep=20 the pin at 5V for al least the stated time required by the DS1820 (add a few mS for safety).. I have done this exact thing for several years without the slightest=20 problem. The DS1820 is s fine part. --Bob A --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .