pic16f877
Newbie level 6
- Joined
- Feb 16, 2012
- Messages
- 12
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- tezpur university
- Activity points
- 1,388
hii friend, i am a b.tech final year student... i need some help in the pic16f877a uart programing.
actually i am doing research on real time ECG prototype...so i need to transfer the collected ECG data from my body through pic16f877a to the uart continuously through rs232 cable ... i used to write a program by my own..lets get me ensure that is it will work or not....(m using MikroC)
#include "built_in.h"
unsigned int temp_res;
void main() {
UART1_Init(57600); // Initalize USART (9600 baud rate, 1 stop bit, ...
//Delay_ms(100); // wait uart module to set
//TXSTA=0X20;
//RCSTA=0X90;
ADCON1 = 0; // All porta pins as analog, VDD as Vref
TRISA = 0xFF; // PORTA is input
TRISB=0;
//TRISC = 0x3F;
do {
temp_res = ADC_Read(0); // Read ADC results and send via UART
UART1_Write(Lo(temp_res)); // Send lower 8 bits to UART
UART1_Write(Hi(temp_res)); // Send upper 8 bits to UART
PORTB = temp_res;
Delay_ms(2000);
} while (1); // endless loop
}
actually i am doing research on real time ECG prototype...so i need to transfer the collected ECG data from my body through pic16f877a to the uart continuously through rs232 cable ... i used to write a program by my own..lets get me ensure that is it will work or not....(m using MikroC)
#include "built_in.h"
unsigned int temp_res;
void main() {
UART1_Init(57600); // Initalize USART (9600 baud rate, 1 stop bit, ...
//Delay_ms(100); // wait uart module to set
//TXSTA=0X20;
//RCSTA=0X90;
ADCON1 = 0; // All porta pins as analog, VDD as Vref
TRISA = 0xFF; // PORTA is input
TRISB=0;
//TRISC = 0x3F;
do {
temp_res = ADC_Read(0); // Read ADC results and send via UART
UART1_Write(Lo(temp_res)); // Send lower 8 bits to UART
UART1_Write(Hi(temp_res)); // Send upper 8 bits to UART
PORTB = temp_res;
Delay_ms(2000);
} while (1); // endless loop
}