tepelne cidlo - zmena teploty po zapnuti
Moderátor: Moderátoři
Idle Mode: When the SM1..0 bits are written to 00, the SLEEP instruction makes the MCU enter Idle mode,stopping the CPU but allowing the UART, Analog Comparator, ADC, USI, Timer/Counters,Watchdog, and the interrupt system to continue operating. This sleep mode basically halts clk-CPU and clkFLASH, while allowing the other clocks to run.Idle mode enables the MCU to wake up from external triggered interrupts as well as internalones like the Timer Overflow and UART Transmit Complete interrupts. If wake-up from the Ana-log Comparator interrupt is not required, the Analog Comparator can be powered down bysetting the ACD bit in the Analog Comparator Control and Status Register – ACSR. This willreduce power consumption in Idle mode.
int main(void)
{
sign = 0;
temperature = 0;
temperature_decimal_part = 0;
uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) ); //uart needs to enable interupts - it will be done in next function (init_interrupts)
i2c_init_sw();
sleep_disable();
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
_delay_us(200);
getTemperature();
while ( !( UCSRA & (1<<UDRE)) );
UDR = 't';
while ( !( UCSRA & (1<<UDRE)) );
UDR = sign;
while ( !( UCSRA & (1<<UDRE)) );
UDR = temperature;
while ( !( UCSRA & (1<<UDRE)) );
UDR = temperature_decimal_part;
while ( !( UCSRA & (1<<UDRE)) );
wdt_disable();
wdt_enable(WDTO_4S);
wdt_reset();
sei();
_delay_us(560);
sleep_enable();
sleep_cpu();
sleep_disable();
while(1);
return 1;
}
https://electrosome.com/solving-max232- ... g-problem/
Kondik C3 som predratoval na Vcc a to uz ide vpoho... (nestretol som sa stym este)