hello forum , this time i need an advice regarding the dh11 humidity / temperature sensor using 1 wire protocol .
using atmega128 i have a SW that is collecting data through some sensors , sending them over UART , also some actuators (servos-dc-light) , the atmega will be sending and receiving packets through interrupt driven UART from/to RPi acting as master .
after some reading i've found 2 libraries for the dh11/22 one using delay , another using external interrupt .each one has advantage and disadvantage in my opinion .
- 1st , the delay library will consume maximum 5.5ms to complete a single conversion but i must make sure that there are no interrupts will get into way because it will miss up the readings , here the problem arise because , what if the UART rx triggers an interrupt ,this would miss up my readings if i left the global interrupt flag set , if use clear the global interrupt and a packet arrives , it will be either corrupted or lost .
-2nd , external interrupt library is a wise more professional option , but again the external interrupt is higher in the priority , the RX comes after the Exteral interrupts ( 7 external . int. )which will leave me trapped in the same situation .
so if maybe there are a way to do this efficiently giving UART max priority , also a way to ensure that i get the data correctly from sensor .
additional notes : i use 4 sensors on the ADC pins using interrupts , a timer start a conversion every 10 seconds ( the ISR continues to start a conversion till it reaches the last channel then it stops till the timer start a new conversion ) , the timer i use comes after the RX interrupt which means that i'm able to make nested interrupts .
i'm open for any suggestions , if any thing is not clear please let me know :)