C code for digitized signal through rs 232

Status
Not open for further replies.

beum

Newbie level 3
Joined
Aug 20, 2008
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,325
how to send signal for rs232

hello everyone,

I plan to design a device to transmit analog signal ( from strain gauges) through PIC16f877 to computer by wireless means, which i choose Bluetooth as mean to communicate.

Analog signal (strain gauge-> PIC(UART)->bluetooth module--->

Bluetooth dongle->Computer (eg. hyperterminal, LabVIEW)

my bluetooth module communicate with PIC well in sending character through UART port, with the following code

#include <16f877.h>
#use delay(clock=20000000)
#fuses hs, noprotect, nowdt, nolvp
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7, parity=N)

#byte portc=7

void main()
{
set_tris_c(0x80);
do{
printf("hello\n");
delay_ms(1000);

}while(1);
}

the test above involved no input to PIC
----------------------------------------------------------------------------------
Now i want to proceed to send analog signal, to show on computer.
i know bluetooth cant send analog signal.

so, i try to use ADC conversion in PIC:
#include <16f876.h>

#device adc=8
#use delay (clock=20000000)
#use rs232 (baud=115200, xmit=PIN_C6, rcv=PIN_C7, parity=N)
#fuses hs, noprotect, nowdt, put, brownout, nolvp

#byte PORTA=5
#byte PORTB=6
#byte PORTc=7
char value;
void main()
{

set_tris_c(0x00);

setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(RA0_RA1_RA3_ANALOG);

while(1)
{
set_adc_channel(0);
value=read_adc();

printf("%2b\n\r",value);

delay_ms(1000);

}

printf("%2b\n\r",value);


the code above is my source of sorrow,

i want it to be digital, but i cant compile it...so how?

HELP me~~:

Added after 3 minutes:

thanks for any suggestion, advice in advance..

greatly appreciate any help
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…