![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CCW CW Control BLDC
cos.h@2:f23351f7af0b, 2020-11-17 (annotated)
- Committer:
- oguro
- Date:
- Tue Nov 17 01:31:35 2020 +0000
- Revision:
- 2:f23351f7af0b
- Parent:
- 0:faa58403944a
New forward Revers sine Wave 2020 11 17
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
oguro | 0:faa58403944a | 1 | |
oguro | 0:faa58403944a | 2 | void cosU(){ |
oguro | 0:faa58403944a | 3 | ut1c=uTc.read_us(); |
oguro | 0:faa58403944a | 4 | f1c=1-(cos(2*3.14159*(1/(usic*1E-6))*zint)*16384); |
oguro | 0:faa58403944a | 5 | a1c=(2*cos(2*3.14159*(1/(usic*1E-6))*zint)*16384); |
oguro | 0:faa58403944a | 6 | uc[0]=a1;uc[1]=0xC000;uc[2]=0; uc[3]=f1c; uc[4]=0; |
oguro | 0:faa58403944a | 7 | } |
oguro | 0:faa58403944a | 8 | |
oguro | 0:faa58403944a | 9 | void cosUN(){ |
oguro | 0:faa58403944a | 10 | ut2c=uTc.read_us(); |
oguro | 0:faa58403944a | 11 | uTc.reset(); |
oguro | 0:faa58403944a | 12 | } |
oguro | 0:faa58403944a | 13 | /******************z transfer******************************/ |
oguro | 0:faa58403944a | 14 | void ztrc(){ |
oguro | 0:faa58403944a | 15 | |
oguro | 0:faa58403944a | 16 | uc[2] = ((uc[1]*uc[4])>>14) + ((uc[0]*uc[3])>>14); |
oguro | 0:faa58403944a | 17 | uc[4] = uc[3]; |
oguro | 0:faa58403944a | 18 | uc[3] = uc[2]; |
oguro | 0:faa58403944a | 19 | |
oguro | 0:faa58403944a | 20 | } |
oguro | 0:faa58403944a | 21 | /*********************************************************/ |