Renesas H8S/2635 Handbuch Seite 63

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 92
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 62
62
snd=strchr(snd,':')+1;
int whichIDX=atoi(snd);
if(whichIDX<0)
{
pwm1 = (((unsigned long)pwm1*(unsigned int)ene) >> (15+5));
pwm2 = (((unsigned long)pwm2*(unsigned int)ene) >> (15+5));
pwm3 = (((unsigned long)pwm3*(unsigned int)ene) >> (15+5));
}
else
{
whichIDX%=mcs->pxms_ptirc;
pwm1 = (((unsigned long)mcs->pxms_ptptr1[whichIDX]*(unsigned
int)ene) >> (15+5));
pwm2 = (((unsigned long)mcs->pxms_ptptr2[whichIDX]*(unsigned
int)ene) >> (15+5));
pwm3 = (((unsigned long)mcs->pxms_ptptr3[whichIDX]*(unsigned
int)ene) >> (15+5));
}
*PWM_PWBFR1A = pwm1;
*PWM_PWBFR1C = pwm2;
*PWM_PWBFR1E = pwm3;
hal=(*DIO_PORTJ>>3)&0x07;
printf("PHA:%2d HAL:%2d\n",index_marking,hal);
return 0;
}
The global variable index_marking is used by interrupt routine during index mark detection. The
interrupt just increases the value of this variable. The function cmd_do_detection requires four
parameters and it can work in two different ways. If the last parameter is lower than 0, the
function takes three first arguments and uses them as values taken from phase tables. In this
case, these phase tables are generated by the HalDetector program. Of course we need to
remember that these values will be later multiplied by power (pxms_ene), in this case arbitrary
chosen as 1024. Secondly, if the fourth parameter is greater or equal to zero it means that it is
an index of the phase tables which are already included in the driver. In this case first three
arguments are ignored. resentation of the function:
detection PWM1:PWM2:PWM3:INDEX
And here is some small example how to call cmd_do_detection:
detection 10:20:0:-1
Seitenansicht 62
1 2 ... 58 59 60 61 62 63 64 65 66 67 68 ... 91 92

Kommentare zu diesen Handbüchern

Keine Kommentare