Just check your settings stopbits hardware and buad rates.
and then not working go to low baudrate
Piyush Manavar
Hi,
Please i am doing a similar project only i am using PIC16f877A to connect to a bluetooth-enabled system over an RN 41 bluetooth module.i have three LM 35 sensors connected to the PIC and the PIC is meant to transmit the values it is receiving over the bluetooth to the PC.the problem is i have connected an LED to the TX pin of the PIC to indicate if it is ON but it doesn't seem to be transmitting because my LED is OFF.i have checked my connections.please i wont mind help.thanks.
this is the code i used in the PIC:
unsigned long int temp_res,vc;
unsigned int vdec, vrem;
unsigned char op[6];
unsigned char txt[7];
void Text_To_Usart(unsigned char *c)
{
int i;
i = 0;
while(c != 0)
{ // Send TEXT to serial port
Usart_Write(c);
i++;
}
}
void first_ana()
{
int i,j;
temp_res = Adc_Read(1); // Get results of AD conversion
PORTD = temp_res; // Send lower 8 bits to PORTD
PORTB = temp_res >> 2; //
temp_res=4888*temp_res;
vdec=temp_res/10000;
WordToStr(vdec,op);
j=0 ;
for(i=0;i<=5;i++)
{
if(op!=' ') // If a blank
{
txt[j]=op;
j++;
}
}
Text_To_Usart(txt);
usart_write(0x0a);
usart_write(0x0d);
}
void sec_input()
{
int i,j;
temp_res = Adc_Read(2); // Get results of AD conversion
PORTD = temp_res; // Send lower 8 bits to PORTD
PORTB = temp_res >> 2; // Send 2 most significant bits to RB7, RB6
temp_res=4888*temp_res;
vdec=temp_res/10000;
WordToStr(vdec,op);
j=0 ;
for(i=0;i<=5;i++)
{
if(op!=' ') // If a blank
{
txt[j]=op;
j++;
}
}
Text_To_Usart(txt);
usart_write(0x0a);
usart_write(0x0d);
}
void third_input()
{
int i,j;
temp_res = Adc_Read(3); // Get results of AD conversion
PORTD = temp_res; // Send lower 8 bits to PORTD
PORTB = temp_res >> 2; // Send 2 most significant bits to RB7, RB6
temp_res=4888*temp_res;
vdec=temp_res/10000;
WordToStr(vdec,op);
j=0 ;
for(i=0;i<=5;i++)
{
if(op!=' ') // If a blank
{
txt[j]=op;
j++;
}
}
Text_To_Usart(txt);
usart_write(0x0a);
usart_write(0x0d);
}
void main() {
ADCON1 = 0x80; // Configure analog inputs and Vref
TRISA = 0xFF; // PORTA is input
TRISB = 0x3F; // Pins RB7, RB6 are outputs
TRISD = 0; // PORTD is output
usart_init(9600);
do
{
first_ana();
delay_us(1000);
sec_input();
delay_us(1000);
third_input();
delay_us(1000);
}
while(1);
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?