Diferencia entre revisiones de «Código Acelerómetro para Codewarrior 10.6»

De Wikitronica
Saltar a: navegación, buscar
Línea 21: Línea 21:
 
ICSSC = ICSSC_FEI;
 
ICSSC = ICSSC_FEI;
 
while (ICSC1_CLKS != ICSSC_CLKST) {}
 
while (ICSC1_CLKS != ICSSC_CLKST) {}
} //end InitICG
+
} //end
 +
 
 +
</syntaxhighlight>
 +
 
 +
 
 +
'''KBI'''
 +
<syntaxhighlight lang="c">
 +
void InitKBI(void) {
 +
// Enable KBI1P[3:2] as interrupt
 +
  KBI1PE = KBI_SW;
 +
  KBI1SC = 0b00000110;
 +
/*              ||||
 +
                |||+---- KBIMOD = KBI detection mode: 0=edge only
 +
                ||+----- KBIE  = KBI int enable: 1=enabled
 +
                |+------ KBACK  = KBI int acknowledge: 1=clr IRQF
 +
                +------- KBF    = KBI flag
 +
*/
 +
}
  
 
</syntaxhighlight>
 
</syntaxhighlight>

Revisión del 15:32 22 jun 2016

Código del Acelerómetro en CodeWarrior 10.6

Descripción de funciones

Inicialización de periféricos


ICS

void ICS_FEI(void) {

if (NVICSTRM != 0xFF)
ICSTRM = NVICSTRM;
else
ICSTRM = 0xAD;
ICSC1 = ICSC1_FEI;
ICSC2 = ICSC2_FEI;
ICSSC = ICSSC_FEI;
while (ICSC1_CLKS != ICSSC_CLKST) {}
} //end


KBI

void InitKBI(void) {
// Enable KBI1P[3:2] as interrupt
  KBI1PE = KBI_SW;
  KBI1SC = 0b00000110;
/*               ||||
                 |||+---- KBIMOD = KBI detection mode: 0=edge only
                 ||+----- KBIE   = KBI int enable: 1=enabled
                 |+------ KBACK  = KBI int acknowledge: 1=clr IRQF
                 +------- KBF    = KBI flag
*/
}