| Electronic Components Datasheet Search |
|
AN1467 Datasheet(PDF) 5 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
AN1467 Datasheet(HTML) 5 Page - Microchip Technology |
|
5 / 16 page ![]() 2012 Microchip Technology Inc. DS01467A-page 5 AN1467 THE SOFTWARE CONTROL LOOP EXAMPLE 1: THE VOLTAGE/CURRENT CONTROL LOOP PIC16F1503 is one of the enhanced core devices, which benefit from the recent line of peripherals, such as the NCO (Numerically Controlled Oscillator), CWG (Complementary Wave Generator) or CLC (Configu- rable Logic Cell). To implement a software-controlled regulation loop, the user needs: - 2 ADC inputs (10-bit or better recommended) for monitoring output voltage and current. - 1 NCO output for the converter control signal - 1 Timer for the main timer tick - (optional) LED signaling, serial interface for logging and button The main control loop is based on TIMER0, which is configured to overflow 4MHz/256/16 = 976.56 times per second, using the 1:16 prescaler. This is the timer tick used for the PI loop. Every timer period, output voltage (VOUT) and current (IOUT) is read (4 samples each) and stored. Since there is only one regulation loop, the firmware must decide if it needs to regulate the current or voltage at a certain time. The decision is simple enough: if the read voltage is over the set voltage reference, the converter will limit the voltage; if the read current is over the set current reference, then the converter will limit the current. The function cc_cv_mode() takes care of the transi- tions between the two working modes, and the variable cmode shows whether the current or voltage is currently regulated. This variable is also important for the topping stage of the battery charging algorithms. The function also uses a fast debouncing counter, that prevents erratic jumping between the constant voltage and Constant Current mode in boundary conditions. Regulating the voltage or current is very simple. Depending on the value of cmode, the PI function is called with different parameters: - pid(vout, vref) for voltage or - pid(iout, iref) for current The variables vref and iref are the output voltage and current limits. The special macros SET_VOLTAGE(x) and SET_CURRENT(x), which modify these variables, allow the state machine to change the charging parameters transparently. The PI function operates on the NCO increment, practically varying the duty cycle by varying the frequency. The NCO operates in Pulse Frequency mode configured for a 2 µsec pulse. This means the converter operates using a fixed on-time, the duty cycle raises proportionally with the frequency, and the on-time value allows 15 bits of frequency resolution. At 500 kHz, we have 100% duty cycle, so the maximum increment value is clamped to 29500 (out of 32768), which gives 450 kHz or 90% duty. void main() { Initialize_Hardware(); while(1) { if(T0IF) { T0IF = 0; if(second) second--; read_ADC(); cc_cv_mode(); if(!cmode) pid(vout, vref); else pid(iout, iref); } if(!second) { second = SECOND_COUNT; Battery_State_Machine(); } } } |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |