0

I try to temperature control with close loop control system. I use dımmer circuit for control my AC heater. Dimmer circuit has a psm pin for current based heat control. For use the psm control i set my APB1 timer source 16 MHz. I use DS18B20 sensor for temperature sensing. This sensor work with 1 wire communucation protocol. In this protocol works with special delay function that;

void delay (uint16_t time)
{
    
    __HAL_TIM_SET_COUNTER(&htim6, 0);
    while ((__HAL_TIM_GET_COUNTER(&htim6))<time);
}

As you see in this code, delay function works timer clock source based.

When i use DS18B20 sensor and dimmer circuit in same time , sensor data return incorrect values after 40 celcius degree. When i set my clock source 52 MHz , sensor works correctly but dimmer psm signal is not work. How can i set multiple timer clock source? If i can't, how can i solve this problem?

p.s. I drive dimmer circuit with send PWM signal from my timer to circuit PSM input .

I try to set my timmer clock source the different values and i read sensor's datasheet. This is link of DS18B20 temp. sensors datasheet . https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf

Thanks for help...

  • May be I'm missing something about your question. But I'd prefer to get rid of delay based 1-Wire (delay-based code is pure-evil), google "uart based 1-wire". – Flexz Dec 09 '22 at 16:39

0 Answers0