A memnória utilizada tah alta e no proteus roda por menos de um minuto e o pc reinicia.
- Código: Selecionar todos
void interrupt() { // INTERRUPÇÕES
unsigned char uart_ch;
if ( PIR1.RCIF == 1 ){ // RX UART
uart_ch = RCREG ; // Read usart RX reg
serial( uart_ch );
PIR1.RCIF = 0 ; // Clear flag
}
}
void main() {
UART1_Init(9600); // Baldrate
// Set comms and Interrupt Enable bits
RCSTA.SPEN = 1; //CONFIGURE SER PORT rx/tx pins
PIE1.RCIE = 1; // bit 5 USART Receive Interrupt Enable
TXSTA.SYNC = 0;
RCSTA.CREN = 1; //Enable ser coms
TXSTA.TXEN = 1; //Enable usart transmission
//Set global Interrupt Enable bits
INTCON.GIE = 1; // global interrput enable
INTCON.PEIE = 1; // Peripheral Interrupt Enable bit...1 = Enables all unmasked peripheral interrupts
PIE1.TXIE = 0; //enable transmit interrupt
while (1){
}
}