This article details the PWM application of the 16-bit timer of the ATMage16.
//ICC-AVR applicaTIon builder : 2007-5-6 21:30:57
// Target : M16
// Crystal: 8.0000Mhz
//TIMER1 iniTIalize - prescale:64
// WGM: 10) PWM phz correct, TOP= ICRn
// desired value: 1Hz
// actual value: 1.000Hz (0.0%)
#include
#include
#define PWM1A PORTD5 //OC1A PD5
#define PWM1B PORTD4 //OC1B PD4
Unsigned char OCAH;
Unsigned char OCAL;
Unsigned char OCBH;
Unsigned char OCBL;
Void TImer1_init(void)
{
TCCR1B = 0x00; //stop
TCNT1H = 0x00; //setup
TCNT1L = 0x01;
OCR1AH ​​= OCAH;
OCR1AL = OCAL;
OCR1BH = OCBH;
OCR1BL = OCBL;
ICR1H = 0xff; // the top value of pwm
ICR1L = 0xFF;
TCCR1A = 0xA3; // Match clear bit set
TCCR1B = 0x0B; // start Timer
}
Void init_devices(unsigned char valueah,unsigned char valueal,unsigned char valuebh,unsigned char valuebl)
{
OCAH=valueah;
OCAL=valueal;
OCBH=valuebh;
OCBL=valuebl;
CLI();
//disable all interrupts
Timer1_init();
MCUCR = 0x00;
GICR = 0x00;
TIMSK = 0x04; //timer interrupt sources
SEI(); //re-enable interrupts
}
Void main(void)
{
PORTD&=(0"DDRD|=(1"init_devices(0x0f,0x45,0x0f,0xf0); //Modify the real-time parameter to change the duty cycle, the maximum value is 0X0FFF;
While(1);
}
[Copy to clipboard]
Wine Cooler
Copper Evaporator is made of copper tube and aluminum fin, also can be copper fin. Copper tube evaporator widely use in various refrigeration unit. Like refrigerator , showcase, cooler, air conditioner, cold room , water dispenser...The function of the copper evaporator is evaporating the heating of the refrigeration unit. With auto welding machine, can assure fast delivery and 0 percent leakage.
Wine Cooler,Cold Room Condenser Unit,Freezer Room Condensing Unit,Refrigerator Condenser Coils
FOSHAN SHUNDE JUNSHENG ELECTRICAL APPLIANCES CO.,LTD. , https://www.junshengcondenser.com