![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
vector
Joined: 07 Mar 2004 Posts: 7
|
DS2450 conversion delay error |
Posted: Mon Mar 19, 2007 11:47 pm |
|
|
Hi all
I have a DS2450 working well except for a little bug I cant resolve.
Code: | onewire_write_byte(ds2450_W_CNV);
onewire_write_byte(0x0f); // All channels
onewire_write_byte(0x00); // No presets
crc16lo = onewire_read_byte();
crc16hi = onewire_read_byte();
//delay_ms(5); //why is this delay needed?????
onewire_reset(); |
Its when I send the convert command. The device is powered by Vcc so there is no power supply or parasitic supply problems.
As with many owb routines i terminate/exit with the owb_reset. However in this instance I need to have a 5ms delay. WHY?
Reading the literature It mentions .
Quote: | If the device is powered entirely from the 1-Wire bus, the bus master must instead provide a strong pullup to 5V for the estimated duration of the conversion in order to provide sufficient energy. |
The estimated duration being 4ms. (very close to my 5ms delay which I created by trial and error, This could be a red herring). But Im not using owb power!! and thus I should be able to exit right away.
Ok so what dosent work.
It very strangely ignores? does not produce a valid, conversion of ch B and D when the delay is not there. IF delay then all channels read as expected.
Any ideas? what have i missed? |
|
![](templates/subSilver/images/spacer.gif) |
RogerB Guest
|
|
Posted: Tue Mar 20, 2007 4:59 am |
|
|
Hi,
The first thing that comes to mind is the conversion time that the device needs from when it receives the command i.e. from the datasheet p10
Quote: | The conversion takes between 60 and 80 us per bit plus an offset time of maximum 160 us every time the convert command is issued. For four channels with 12-bit resolution each, as an example, the convert command will not take more than 4x12x80 us plus 160 us offset, which totals 4 ms. |
Maybe this accounts for your trial and error delay of 5ms which works! This time is required no matter if the 1-Wire power is derived from VCC or parasitic.
Roger B |
|
![](templates/subSilver/images/spacer.gif) |
vector
Joined: 07 Mar 2004 Posts: 7
|
|
Posted: Tue Mar 20, 2007 4:35 pm |
|
|
Hi Roger
thanks for replying, maybe I need to be clearer and at the expense of a longer post, dig a deeper ditch. I also think I have narrowed it down to one question.
But first clarification.
I said "The estimated duration being 4ms." this was a reference to that text you quoted from the data sheet. ie I new or had a pretty good hunch that the 5ms I was putting in was the 4ms it needed. (The delay was left over from my initial PoC testing "sequential code")
The sentence , between our two quotes is the important one.
Quote: | If the DS2450 gets its power through the VCC pin, the
bus master may communicate with other devices on the 1-Wire bus while the DS2450 is busy with A/D conversions. |
I referred to that text when I said "I should be able to exit right away. "
I should have been more specific in my references.
I need to have, "fire n forget" modus operandi. Start the conversion, go away and do things then come back(a good second later BTW) to read the result. Long after a 4ms conversion is complete. Im not trying to read the device as fast as possible but I dont want to hang around for 4ms in a dead loop waiting for it to convert, only to send a reset so I can exit the convert command and then go and do my other chores.
I would have assumed that "not sending the reset" would be the answer.
And it is. Lets comment out the dealy_ms(5) and the onewire_reset().
With no reset aborting the convert command (b4 its finished) all is rosey. I can read all channels on the next read scan.
But this didnt work b4, why? because I was communicating with other owb devices. As soon as I left the convert command(unreset with no delay) I was communicating with an IO owb device and in so doing was sending its normal onewire_reset() This is being picked up by the A/D and its reponse is to abort the conversion. Bingo!
So we need to wait the delay so "other" owb comms dont interfere.
ie
Dont communicate to other owb devices in that 4ms.
BUT
Quote: | the bus master may communicate with other devices on the 1-Wire bus while the DS2450 is busy with A/D conversions |
HOW?? If communications with other owb devices require a owb reset we are snookerd?
Thats what it comes down to.
I tend to owb_reset after each task to keep it all clean, this is my undoing. |
|
![](templates/subSilver/images/spacer.gif) |
vector
Joined: 07 Mar 2004 Posts: 7
|
|
Posted: Tue Mar 20, 2007 6:48 pm |
|
|
Just noticed that my DS1820 routines dont require the delay b4 the reset. They have a much larger delay, 750ms, requirement too.
Quote: | if (Send_MatchRom(dev_adr))
{
onewire_write_byte(owb1820_Convert); // Temperature convert command
ds2482status= onewire_reset(); //tidy exit
}
|
Again I dont read the temperature for another second so the conversion time is taken into account.
The point here is that I can exit the conversion command with no effect on the conversion.
Where as I do the same thing on the A/D and it goes belly up with only converting chA,C leaving D,B as invalid readings. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|