hi !
i got some problems with my project, and I need some help
my project is about making a MPPT board which command the converter as just in this following image:
montage de principe.jpg
and I have the circuit of the board but I have to use Proteus ISIS for simulation and so i got some problems with some components on the circuit , let me just put the picture and then explaine my problems:
mppt circuit_001.jpg
so the 1st problem is how to get the Voltage and the curnent values into the tow pins of the PIC µcontroller , am I going to use sensors or what ?? because that's what I think ; I thought that I need a curent sensor and an other one for voltage , can you please tell me if I'm right??! and then i want to know how to make the PIC read those values and then I can use the mikroC program inwhich I have to do some calculations just as the following:
-configure the PIC registers to do these operations( by the way I'm using PIC18F1220 due to it's performences that have been showen in a report that I've got)
-read the values of the curent and voltage that comes out of the solar panel as the first image shows.
-calculate the power (P=Vpv*Ipv) (pv=photovoltaïque)
-do the previous operation 8 times and then calculate the average of these points of power for more precesion ( otherwise we can just use the first calculated power)
-compare the first calculated power with the next one so we can get a derivative which could be >0 or <0 and basing on that and also on the status of alpha which is the PIC output signal that can take the value 1 or 0
-this signal is going to be compared with another signal coming from the NE555 on the circuit via an Ampli LM311 which generate another signal tha goes to command the converter DC/DC shown on the first image
the program that i got also from the same report is just as follows (after some little modifications ):
the rest of the program , .. i guess I understanded it so if you can help me with this ( by the way I'm using MikroC and ISIS 8 for simulation)Code:int i,H; unsigned int tension_haute,tension_conv,tension_haute_totale; unsigned char tension_faible,intensite_faible; unsigned int intensite_haute,intensite_conv; unsigned int intensite_haute_totale,tension_panneau; unsigned long puissance,ancienne_puissance,puissance_totale; unsigned int m; // /* I didn't get it from this part till... !!! void traiteIT(void); #pragma code it=0x08 void saut_sur_spIT(void) { _asm goto traiteIT _endasm } #pragma code #pragma interrupt traiteIT */ //////////////////////////////////////// debut void interrupt(void) { if(INTCON.TMR0IF) { INTCON.TMR0IF=0; H=1; T0CON.TMR0ON=0; } } //....till this line///////////////// fin && still didn't get it !! / //////////////// debut de fonction qui configure les registres void configurer_registres(void) { i=0; m=0; H=1; puissance=0; ancienne_puissance=0; ADRESH=0x00; ADRESL=0x00; WDTCON=0; INTCON.TMR0IE=1; INTCON.GIEH=1; INTCON.TMR0IF=0; INTCON2=0x00; INTCON3=0x00; PIR1=0x00; PIE1=0x00; IPR1=0x00; PIR2=0x00; PIE2=0x00; IPR2=0x00; RCON=0x00; T0CON=0x46; ADCON1=0x7C; ADCON2=0x92; PORTA=0x00; TRISA=0x03; PORTB=0x00; TRISB=0x00; } /////////// ///////Fin de fonction qui configure les registres ///////////////////debut de la fonction de conversion d'intensite. unsigned int intensite(void) { intensite_haute=0; intensite_haute_totale=0; intensite_faible=0; for(i=0;i<1;i++) {} //////un peu de retard. ADCON0=0x05; for(i=0;i<10;i++) ///un autre retard !! i don't know why the hell is that for! {} ADCON0=0x07; while(ADCON0 !=0x05) {} intensite_haute=ADRESH; intensite_haute_totale=intensite_haute<<8; intensite_faible=ADRESL; intensite_conv=intensite_haute_totale+intensite_faible; return(intensite_conv); } //////////////////Fin de la fonction de conversion d'intensite. /////////////////////debut ...convesion de tension unsigned int tension (void) { tension_haute=0; tension_haute_totale=0; tension_faible=0; for(i=0;i<1;i++){} ADCON0=0x01; for(i=0;i<10;i++){} ADCON0=0x03; while(ADCON0 !=0x01) {} tension_haute=ADRESH; tension_haute_totale=tension_haute<<8; tension_faible=ADRESL; tension_conv=tension_haute_totale+tension_faible; return (tension_conv); } ////////////////////////fin ...convesion de tension ///////////////////debut de la fonction de calcul de Puissance unsigned long calcul_de_puissance(void) { unsigned long x,y; x=tension(void); y=intensite(void); puissance_totale=x*y; return(puissance_totale); } //////////////// Fin de la fonction de calcul de Puissance ///////////////////debut de la fonction de calcul de Puissance_moyenne unsigned long puissance_moyenne(void) { unsigned long puissance_moyenne_totale,calc_puissance,somme8point_P; puissance_moyenne_totale=0; calc_puissance=0; somme8point_P=0; for(m=0;m<8;m++) { calc_puissance=calcul_de_puissance(void); somme8point_P+=calc_puissance; } puissance_moyenne_totale=somme8point_P>>3; return(puissance_moyenne_totale); } ///////////////////Fin de la fonction de calcul de Puissance_moyenne ////////////////////debut de la fonction de calcul de la derivee de Puissance unsigned char derivee_de_puissance(void) { unsigned char derivee; unsigned long puissance=0,ancienne_puissance=0; puissance=puissance_moyenne(void); if(puissance> ancienne_puissance) { derivee=1; PORTB.RB0=1; } else { derivee=0; PORTB.RB0=0; } ancienne_puissance=puissance; return(derivee); } ////////////////////Fin de la fonction de calcul de la derivee de Puissance //////////////////////debut de programme principal: void main() { unsigned char derivee_de_P; int v; configurer_registres(); tension_panneau=tension(); if(tension_panneau<0x2B9) { PORTB.RB1=1; } else { PORTB.RB1=0; } while(1) { derivee_de_P=derivee_de_puissance(); if((derivee_de_P==1)&&(PORTB.RB1==1)) { PORTB.RB1=1; } else if((derivee_de_P==0)&&(PORTB.RB1==1)) { if(H==0) { PORTB.RB1=1; } else { PORTB.RB1=0; H=0; T0CON.TMR0ON=1; } } else if((derivee_de_P==1)&&(PORTB.RB1==0)) { PORTB.RB1=0; } else if((derivee_de_P==0)&&(PORTB.RB1==0)) { if(H==0) { PORTB.RB1=0; } else { PORTB.RB1=1; H=0; T0CON.TMR0ON=1; } } else{} } v=PORTB.RB1; Lcd_Init(); Lcd_out_cp(v); } //////////////////////////////fin de programme principale.
i don't have much time left so please help me with this , I do apriciate your help and thanks
-----