pnjbtr
Full Member level 5
I see 50% duty cycle of pwm pulse in inverter mode at 2.4v at RA0.
RA0 is for feed back(output volt control).
PWM frequency in inverter mode is 3.2khz at each channel.
And 6.2khz at charging.
---------- Post added at 15:37 ---------- Previous post was at 15:07 ----------
for example asm code,
And in c
RA0 is for feed back(output volt control).
PWM frequency in inverter mode is 3.2khz at each channel.
And 6.2khz at charging.
---------- Post added at 15:37 ---------- Previous post was at 15:07 ----------
"sublw" in asm is equal ADC_VALUE in c.I simulated the code ,the purse width is too small.and feedback is not working.How does the adc readings interact with the purse width to adjust the output voltage can any body explain this aspect of the code.
for example asm code,
Code:
LEVEL_49 bcf PORTB,5
movf BATTV,w
btfsc STATUS,Z
goto LEVEL_50
bcf 0x2D,3
sublw .154
btfss STATUS,C
goto LEVEL_50
bsf 0x2D,3
movf BATTV,w
sublw .148 ;here we set adc value 148=2.90v
btfss STATUS,C
goto LEVEL_50
call LEVEL_29
bsf 0x2D,3
goto LEVEL_46
Code:
void main()
{
TRISA=0xFF; //SET PORT A AS INPUT
TRISC = 0X00; //SET PORT C AS OUTPUT
while(1)
{
Read_Adc(); // Read Analog input
if (Adc<148) // if adc less then 148=2.90v
{
PortC.F0 = 0; //bit RC0 = low
}
if (Adc>165) //or adc is more then 165=3.23v
{
PortC.F=1; //RC0= high
}
}
}