MM908E624單片機(jī)在汽車電子油門控制系統(tǒng)的應(yīng)用
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
void Reset(void) {
asm JMP $2000; // forces a reset
Illegal Address Reset
}
// --------------------------------------------------------
void EnterLowPowerMode(void) { // Initialize
Sleep/Stop Mode
(void)l_ifc_disconnect_sci08(); // disconnect
SCI (port E)
sei();
TimerDisable();
TimerBDisable();
ADC_PowerOff();
// ---------------------
// all unused pins to output
// all outputs to output
// all inputs to input
//
// EY16 / KOBI interface
//
// PTA5/SPSCK (EY16 -> KOBI) PULL DOWN
// PTA6/SSB (EY16 -> KOBI) PULL UP
// PTB1/OUT (EY16 - KOBI)
// PTC0/MISO (EY16 - KOBI)
// PTC1/MOSI (EY16 -> KOBI) PULL DOWN
// PTD0/PWMIN (EY16 -> KOBI) PULL ?
// PTE0/TXD (EY16 -> KOBI) PULL UP
// PTE1/RXD (EY16 - KOBI)
rDDRA = bDDRA6|bDDRA5|bDDRA4|bDDRA3|bDDRA2|bDDRA1|bDDRA0; // all
out
rDDRB = bDDRB7|bDDRB6|bDDRB5|bDDRB4|bDDRB3|bDDRB2|!bDDRB1|bDDRB0; // B1 in
rDDRC = bMCLKEN|bDDRC4|bDDRC3|bDDRC2|bDDRC1|!bDDRC0; // C0 in
rDDRD = bDDRD1|bDDRD0; // all out
rDDRE = !bDDRE1|bDDRE0; // E1 in
rPORTA = !bPTA5|bPTA6; // A5 down, A6 up
rPORTB = 0;
rPORTC = !bPTC1; // C1 down
rPORTD = !bPTD0; // D0 down
rPORTE = bPTE0; // E0 up
/*
(void)SPI_ReadWrite(bwLINSL2|bwLINSL1|bwMODE1);// Stop Command (MCU supplied)
(void)SPI_ReadWrite(bwLINSL2|bwLINSL1|bwMODE1);// needs to be send twice*/
(void)SPI_ReadWrite(bwLINSL2|bwLINSL1); // Sleep Command (MCU off)
(void)SPI_ReadWrite(bwLINSL2|bwLINSL1); // needs to be send twice
SPI_Disable(); // Disable SPI
// Sleep=1; // Sleep
stop(); // enter ULPM
}
// --------------------------------------------------------
// Interrupt Service Routines
// --------------------------------------------------------
#pragma TRAP_PROC
void isrESCIReceive(void) { // SCI Rx
interrupt handler
l_ifc_rx_sci08();
}
// --------------------------------------------------------
#pragma TRAP_PROC
void isrESCIError(void) { // SCI Error
interrupt handler
l_ifc_rx_sci08();
}
// -------------------------------------------------------
l_irqmask l_sys_irq_disable(void){ //Disable
interrupts
sei();
return 0;
}
// -------------------------------------------------------
void l_sys_irq_restore(l_irqmask previous){ //Restore
interrupts
cli();
}
// -------------------------------------------------------
#pragma TRAP_PROC
void ISR_DUMMY(void){ //Dummy ISR
// while(1);
}
// -------------------------------------------------------
#pragma TRAP_PROC
void isrKeyBoard(void) {
swi();
}
// -------------------------------------------------------
// -------------------------------------------------------
#pragma TRAP_PROC
void isrHWIRQ(void) {
UINT8 res;
//swi();
nop();
SPIout = bwMODE2|bwMODE1;
res = SPI_ReadWrite(SPIout);
/*
if(resbrINTSRC) {
}
*/
TimerEnable();
TimerBEnable();
}
4.功能展示 5.參考文獻(xiàn):
I.〈〈傳感器與接口技術(shù)〉〉中國石化化出版社 蘇鐵力 關(guān)振海 孫繼紅 編著
II.
III.908E624 DATA SHEET>> MOTOROLA REV1.0,09/2003
IV.
陀螺儀相關(guān)文章:陀螺儀原理
評論