Re: firmware pengisian baterai masalah modus tegangan

  • Thread starter chanchal.chauhan
  • Start date
C

chanchal.chauhan

Guest
Hai,

Saya menggunakan 18F1330 PIC mikrokontroler untuk aplikasi pengisian daya baterai.
Di sini saya mengendalikan Baterai arus dalam modus CC & Battery tegangan dalam modus CV dalam loop tertutup.
Tapi di sini dalam modus CV baterai saya saat ini & Pulse adalah bervariasi.

Berikut adalah rincian dari kode saya.

# include <htc.h>

void osc_init ();
void tunda (unsigned int k);
void adc_init ();
void read_volt ();
void read_current ();
void pwm_init ();
Multiplication16bit panjang (int Mutiplicand, int Multiplier);

const unsigned int ref_voltage = 2867; / / 14.0v
const unsigned int ref_voltage1 = 2847; / / 13.9v
const unsigned int ref_current = 1332; / / 6.5Amps
unsigned int duty_cycle = 9.280, duty_cycle1 = 960;
void main ()
(
memperoleh panjang, gain2;
unsigned int gain1, gain3;
TRISB = 0b00000000;
TRISA = 0b01010011;
osc_init (); / / 16Mhz internal ocillator
adc_init (); / / adc init
while (1)
(
read_volt (); / / Vs
gain = Multiplication16bit (adc_voltage, 666);
gain = memperoleh * 5;
gain1 = mendapatkan>> 10; / / Baterai tegangan
Apakah read_current ();//
gain2 = Multiplication16bit (adc_current, 360);
gain2 = gain2 * 5;
gain3 = gain2>> 10; / / Baterai saat
if (gain1> = ref_voltage) / /
(
flag = 1;
if (gain1 == ref_voltage)
(
duty_cycle;
duty_cycle1;
)
lain
(
duty_cycle; / / pengurangan
- duty_cycle1;
)
)
lain / / CC Mode
(
if (gain3> = ref_current)
(
flag = 0;
if (gain3 == ref_current)
(
duty_cycle;
duty_cycle1;
)
lain
(
duty_cycle; / / pengurangan
- duty_cycle1;
)
)
lain
(
if (flag == 1)
(
duty_cycle;
duty_cycle1;
if (gain1 <ref_voltage1) / / ref_voltage1
(
- duty_cycle;
duty_cycle1;
)
)
lain
(
- duty_cycle;
duty_cycle1;
)
)
)

if (duty_cycle> = 9728)
(
duty_cycle = 9.728;
duty_cycle1 = 512; / / 480
)
if (duty_cycle <= 6400)
(
duty_cycle = 6.400; / / 6.399
duty_cycle1 = 3.840;
)
pwm_init (); / / PWM initilisation
)
)

void adc_init ()
(
ADCON1 = 0b00001100;
ADCON2 = 0b10001010; / / Tacq = 1.2usec
ADCON0 = 0b00000000;

)
void read_volt ()
(
i = 0;
for (i = 0; i <16; i ) / / Averaging 16 kali
(
ADCON1 = 0b00001100;
ADCON2 = 0b10001010; / / Tacq = 1.2usec
ADCON0 = 0b00000000; / / AN0 tegangan
Adon = 1;
GODONE = 1;
while (GODONE) terus;
/ / GODONE = 0;
ADIF = 0;
adc_voltage = 0;
adc_voltage = (ADRESH <<

<img src="http://www.edaboard.com/images/smiles/icon_cool.gif" alt="Dingin" border="0" />

ADRESL;
result_temp = adc_voltage result_temp;
)
adc_voltage = result_temp/16;
result_temp = 0;

)
void read_current ()
(
i = 0;
for (i = 0; i <16; i ) / / Averaging 16 kali
(
ADCON1 = 0b00001100;
ADCON2 = 0b10001010; / / Tacq = 1.2usec
ADCON0 = 0b00000100; / / AN1 saat
Adon = 1;
GODONE = 1;
while (GODONE) terus;
ADIF = 0;
adc_current = 0;
adc_current = (ADRESH <<

<img src="http://www.edaboard.com/images/smiles/icon_cool.gif" alt="Dingin" border="0" />

ADRESL;
result_temp1 = adc_current result_temp1;
)
adc_current = result_temp1/16;
result_temp1 = 0;
/ / Flag = 1;
)Any help is sangat menghargai.

Salam
ChanchalDitambahkan setelah 2 menit:chanchal.chauhan wrote:

Hai,Saya menggunakan 18F1330 PIC mikrokontroler untuk aplikasi pengisian daya baterai.

Di sini saya mengendalikan Baterai arus dalam modus CC & Battery tegangan dalam modus CV dalam loop tertutup.

Tapi di sini dalam modus CV baterai saya saat ini & Pulse adalah bervariasi.Berikut adalah rincian dari kode saya.# include <htc.h>void osc_init ();

void tunda (unsigned int k);

void adc_init ();

void read_volt ();

void read_current ();

void pwm_init ();

Multiplication16bit panjang (int Mutiplicand, int Multiplier);const unsigned int ref_voltage = 2867; / / 14.0v

const unsigned int ref_voltage1 = 2847; / / 13.9v

const unsigned int ref_current = 1332; / / 6.5Amps

unsigned int duty_cycle = 9.280, duty_cycle1 = 960;

void main ()

(

memperoleh panjang, gain2;

unsigned int gain1, gain3;

TRISB = 0b00000000;

TRISA = 0b01010011;

osc_init (); / / 16Mhz internal ocillator

adc_init (); / / adc init

while (1)

(

read_volt (); / / Vs

gain = Multiplication16bit (adc_voltage, 666);

gain = memperoleh * 5;

gain1 = mendapatkan>> 10; / / Baterai tegangan

Apakah read_current ();//

gain2 = Multiplication16bit (adc_current, 360);

gain2 = gain2 * 5;

gain3 = gain2>> 10; / / Baterai saat

if (gain1> = ref_voltage) / /

(

flag = 1;

if (gain1 == ref_voltage)

(

duty_cycle;

duty_cycle1;

)

lain

(

duty_cycle; / / pengurangan

- duty_cycle1;

)

)

lain / / CC Mode

(

if (gain3> = ref_current)

(

flag = 0;

if (gain3 == ref_current)

(

duty_cycle;

duty_cycle1;

)

lain

(

duty_cycle; / / pengurangan

- duty_cycle1;

)

)

lain

(

if (flag == 1)

(

duty_cycle;

duty_cycle1;

if (gain1 <ref_voltage1) / / ref_voltage1

(

- duty_cycle;

duty_cycle1;

)

)

lain

(

- duty_cycle;

duty_cycle1;

)

)

)if (duty_cycle> = 9728)

(

duty_cycle = 9.728;

duty_cycle1 = 512; / / 480

)

if (duty_cycle <= 6400)

(

duty_cycle = 6.400; / / 6.399

duty_cycle1 = 3.840;

)

pwm_init (); / / PWM initilisation

)

)void adc_init ()

(

ADCON1 = 0b00001100;

ADCON2 = 0b10001010; / / Tacq = 1.2usec

ADCON0 = 0b00000000;)

void read_volt ()

(

i = 0;

for (i = 0; i <16; i ) / / Averaging 16 kali

(

ADCON1 = 0b00001100;

ADCON2 = 0b10001010; / / Tacq = 1.2usec

ADCON0 = 0b00000000; / / AN0 tegangan

Adon = 1;

GODONE = 1;

while (GODONE) terus;

/ / GODONE = 0;

ADIF = 0;

adc_voltage = 0;

adc_voltage = (ADRESH <<
<img src="http://www.edaboard.com/images/smiles/icon_cool.gif" alt="Dingin" border="0" /> ADRESL;

result_temp = adc_voltage result_temp;

)

adc_voltage = result_temp/16;

result_temp = 0;)

void read_current ()

(

i = 0;

for (i = 0; i <16; i ) / / Averaging 16 kali

(

ADCON1 = 0b00001100;

ADCON2 = 0b10001010; / / Tacq = 1.2usec

ADCON0 = 0b00000100; / / AN1 saat

Adon = 1;

GODONE = 1;

while (GODONE) terus;

ADIF = 0;

adc_current = 0;

adc_current = (ADRESH <<
<img src="http://www.edaboard.com/images/smiles/icon_cool.gif" alt="Dingin" border="0" /> ADRESL;

result_temp1 = adc_current result_temp1;

)

adc_current = result_temp1/16;

result_temp1 = 0;

/ / Flag = 1;

)Any help is sangat menghargai.Salam

Chanchal
 

Welcome to EDABoard.com

Sponsor

Back
Top