Created
December 16, 2015 01:30
-
-
Save JHeld07/07c1166c26415e3a10d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Receive usart | |
#include <18f4520.h> | |
#use delay(clock=20000000) | |
#fuses HS, NOWDT, NOLVP | |
#include "../Library/18f4520ptr.h" | |
#include "../Library/modifiedlcd.h" | |
#INT_RDA | |
void int_rda_isr(){ | |
//output_high(PIN_A0); | |
//delay_ms(400); | |
output_high(PIN_C0); | |
printf(lcd_putc, "\f %c", *RCREG); | |
*TXREG = *RCREG +1; | |
} | |
main(){ | |
lcd_init(); | |
ADCON1->PCFGx=0xF; // All Digital | |
*TRISC=0x80; | |
*TRISA=0x00; | |
TXSTA->TXEN=1; // Tx On | |
TXSTA->SYNC=0; // Asynch | |
TXSTA->BRGH=0; // Low Speed | |
RCSTA->SPEN=1; // Rx On RCSTA is setting up two interupts. | |
RCSTA->CREN=1; // Rx Cont. on | |
BAUDCON->BRG16=1; // Setting baud rate based off of table. | |
*SPBRG=129; // setting the interupt | |
PIE1->RCIE=1; // Rx Interupt Enable | |
// If Tx Enable is ON it wont work. | |
INTCON->GIE=1; | |
INTCON->PEIE=1; | |
while(1){ | |
//printf(lcd_putc, "\f hello"); | |
//delay_ms(300); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment