Seven Segments


Homepage
What is S2
Contacts
Propose a project

Battery Chargers >>
Low cost charger »
Basic charger »
Advanced Charger
Advanced Charger HV »
Universal Charger »
DC DC converter »
Basic equalizer »
LiPo Balancer »
Model Trains >>
Miscellaneous >>
Tech Beans >>

Site Map
Useful links
Site stats
Visits753138
Users502
Categories4
Projects21
Articles66
Files148


© Seven-Segments



All website content
unless otherwise noted
is licensed under a
Creative Commons
License






PIC firmware description
PIC program for Advanced charger guidelines.


The PIC microcontroller program is written in assembler using the Parallax-like macro (included in the package). The program structure is quite simple because it is based on a periodic interrupt with 5msec period. This basic tic allow the processor to sample the two analog inputs (voltage and current) that are read in a 16-bit format at each tic.

Interrupt routine

Charge section: The charge section of the interrupt program controls at 200Hz the charge current (via pwm signal) with a reference feedback of the signal coming from the current to voltage converter. The program passes to the routine only the target current and the zero current reading.
Discharge section: The discharge section of the interrupt program controls at 200Hz the discharge current (via pwm signal) with a reference feedback of the signal coming from the current to voltage converter. The program passes to the routine only the target current and the zero current reading.
Power supply: The power supply section of the interrupt program controls at 200Hz the source current (via pwm signal, in practice is a cherge current) with a reference feedback of the voltage reading on the load. The pwm signal is also decreased if the maximum current (5A) threshold has been reached. The program passes to the routine the target load voltage and the zero current reading .

The processor, with substantial difference with respect to the basic charge, works on a asynchronous cycle for charge/discharge processes: the actions performed in the single routine are below detailed:

Charge routine

The charge routine starts sampling the zero current reading and initializing all the charge-related parameters recalling the correct profile from eeprom. During the charge process the PIC display the charge current, the battery pack voltage, the mAh charged, the time and the delta peak. The charge end is checked at each iteration and when the delta peak is reached or the timeout has expired or the user remove the battery, the charge ends.

Discharge routine

The charge routine starts sampling the zero current reading and initializing all the discharge-related parameters recalling the correct profile from eeprom. During the discharge process the PIC display the discharge current, the battery pack voltage, the mAh discharged, the time and the cut off. The discharge end is checked at each iteration and when the cut off is reached or the user remove the battery, the discharge ends.

Power supply routine

The power supply routine performs the checks on pressed keys for voltage adjust. The loop stabilization is checked in the interrupt routine.

Parameters setting

The parameters settings allows the user to enter, change and re-store all the parameters for a battery pack usage.

PC management

The PC serial management is useful to get the data coming from the charger in real time (archiving, waveform displaying) or to change easily all the parameters.

Power supply fail

If the power supply fail or the user press the break key, the charger restarts with the hello message and waits 10 seconds or a key strike. If the 10 seconds expires and the user has pressed no key the charger will restart the interrupted action, if one.

Profiles management

The choice of battery profile is very simple and is performed via two keys.

Battery cycle

The battery cycle is a simple discharge-then-charge cycle for battery safe and easy charging.



Comments ::


© 2004 Seven-Segments
All content on this website (including text, photographs, resource files, and any other original works), unless otherwise noted, is licensed under a Creative Commons License

LOGIN


PARTNER SITES
Seven Segments Site Map