//void puts(); //void putc(); //void delay(); int main (void) { //configure uart //ler buad printStr("Insira o valor de baud"); int buad=readInt10(); //ler parity printStr("paridade: "); char parity=getChar(); //ler stopbits printStr("Stop bits: "); int stopbits=readInt10(); //configurar com os values pretedendidos configure_UART(buad,parity,stopbits); while(1) return 0; }//end main
void configureAll(void) { unsigned int freq; // Read value of frequency printStr("Frequency value: "); freq = readInt10(); putChar('\n'); // Configure Timer T1 (100 Hz, interrupts disabled) T1CONbits.TCKPS = 2; // 1:8 prescaler (i.e fin = 2.5 MHz) PR1 = 24999; // Fout = 20MHz / (8 * (24999 + 1)) = 100 Hz TMR1 = 0; // Reset timer T1 count register T1CONbits.TON = 1; // Enable timer T1 (must be the last command of the timer configuration sequence) IFS0bits.T1IF = 0; // Reset timer T1 interrupt flag IPC1bits.T1IP = 2; // Interrupt priority (must be in range [1..6]) IEC0bits.T1IE = 1; // Configure Timer T3 (100 Hz, interrupts disabled) T3CONbits.TCKPS = 5; // 1:32 prescaler (i.e fin = 625000 Hz) PR3 = (625000 / freq) - 1; // Fout = 20MHz / (32 * (PR3 + 1)) = freq Hz TMR3 = 0; // Reset timer T3 count register T3CONbits.TON = 1; // Enable timer T3 (must be the last command of the timer configuration sequence) }