用了C18的编译器,中断为什么会出错
void interrupt USART(void){
unsigned char data,tmphead,tmptail;
/*
if((TMR1IF) && (TMR1IE))
{
TMR1H = 0x80;
TMR1IF = 0;
if(60 == ++secs)
{
secs = 0;
++mins;
}
if(60 == mins)
{
mins = 0;
++hours;
}
if(24 == hours)
{
hours = 0;
}
}
*/
if((TMR2IF) && (TMR2IE))
{
TMR2IF = 0;
++msecs_timer;
}
if(RC1IF)
{
LATD0 = 1;
data = RCREG1; // read the received data
// calculate buffer index
tmphead = ( USART_RxHead + 1 ) & USART_RX_BUFFER_MASK;
USART_RxHead = tmphead; // store new index
if ( tmphead == USART_RxTail )
{
// ERROR! Receive buffer overflow
}
USART_RxBuf = data; // store received data in buffer
}
if(TRMT)
{
// check if all data is transmitted
if ( USART_TxHead != USART_TxTail )
{
// calculate buffer index
tmptail = ( USART_TxTail + 1 ) & USART_TX_BUFFER_MASK;
USART_TxTail = tmptail; // store new index
TXREG1 = USART_TxBuf;// start transmition
}
else
{
TX1IE = 0; // disable TX interrupt
}
}
}
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\mcc18\bin\mcc18.exe" -p=18F4520/i"C:\mcc18\h" "enc_driver.c" -fo="enc_driver.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.02 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited:39
E:\myprogram\28dr\enc_driver.c:1399:Error: syntax error
Halting build on first failure as requested.
BUILD FAILED: Sun Sep 10 22:40:54 2006 C18里不能直接写TMR1IF的,看看.h文件,写成PIR1bits.TMR1IF
页:
[1]