DallasTemperature and interrputs seem to interfere

Hi,
One wire reading seem to use interrupts. and conflicts with a scheduled interrupt i am using (currently using timer 2 for timed interrupt and timer 0 for millis() value).

one wire reading seem to interfere with timer0. as i have a routine that execute many times without the millis() (from timer 0) value changing. My routine on timer 2 does not execute properly either.

i can't find wich timer is used, and how to make the one wire sensor work with the timed interrupt i am using.

I am currently working with nano Board.
i can have :

  • readings of one wire correctly if i am not using interrupts
  • timed interrupt working properly if no reading is done on the one wire sensors.

can someone help me about using theses 3 items together

You need to read the guidance section for the forum!!

Basically we need to see your code and a wiring diagram , also useful to know what the project is trying to do.

Please, write in text the sequence of events that take place in your project. This is to identify the true cause of problem by comparing with your codes.

It does not, so the problem is with your code.
Need to see your code.

Looking at the OneWire library, there are multiple places in the code where interrupts are temporarily disabled, that may be causing your problems.

Unrelated to interrupts, reading the temperature from the sensor is by default a blocking function in the DallasTemperature library. This can cause a delay of up to 750mS. The library contains methods to avoid this.

It seem to be the case, i noticed 750ms delay in some cases, not always this long.

I have tried to find this documentation, but could not.

I am Pretty green in c++ an arduino. more used to industrial plc's!! this is pretty different way to achieve similar tasks.

can you please guide where this doc could be found?

The data sheet for the temperature sensor has documentation on the delay, it varies with the number of bits of precision in the temperature reading.

As far as the code, the library has a couple of example sketches confusingly named WaitForConversion showing how to initiate the temperature sampling, then read the value after the appropriate time interval.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.