CCW CW Control BLDC

Dependencies:   mbed mbed-rtos

cos.h

Committer:
oguro
Date:
2020-11-17
Revision:
2:f23351f7af0b
Parent:
0:faa58403944a

File content as of revision 2:f23351f7af0b:


void cosU(){  
     ut1c=uTc.read_us();  
     f1c=1-(cos(2*3.14159*(1/(usic*1E-6))*zint)*16384); 
     a1c=(2*cos(2*3.14159*(1/(usic*1E-6))*zint)*16384);        
     uc[0]=a1;uc[1]=0xC000;uc[2]=0; uc[3]=f1c; uc[4]=0;
}

void cosUN(){
    ut2c=uTc.read_us();
    uTc.reset();
    }
/******************z transfer******************************/
void ztrc(){
    
            uc[2] = ((uc[1]*uc[4])>>14) + ((uc[0]*uc[3])>>14);
            uc[4] = uc[3]; 
            uc[3] = uc[2];          
    
    }
/*********************************************************/