Google

7 Ağustos 2007 Salı

Initialization


• PORTC<0:5> are initialized to output PWMs.

• Timer1 is initialized with 8-bit operation and 1:4 prescale.

• A/D channels are initialized to read frequency reference (AN0), motor current (AN1) and heatsink temperature (AN2).
- Frequency reference is read using a potentiometer connected to A/D Channel 0.
- Motor current is read using a shunt resistor in the DC return path. The voltage corresponding to the motor current is amplified and connected to A/D channel 1.

• Timer0 is used for setting the motor frequency based on the potentiometer setting. On every Timer0 overflow, new PWM duty cycles are advanced by 10 electrical degrees on the Sine table.
• The Sine table is loaded into RAM

• Timer0 overflow, Timer1 overflow and INT interrupts are enabled.

Hiç yorum yok: