Código Acelerómetro para Codewarrior 10.6

De Wikitronica
Saltar a: navegación, buscar

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
*/
}

SCI

void InitSCI(word baud) {

  SCI1BD = baud;  // set baud
} //end InitSCI