capella
Joined: 07 Feb 2009 Posts: 38
|
sending to pc from pic for analog data problem? |
Posted: Wed Mar 31, 2010 6:47 am |
|
|
hello
I try to send potentiometer data from pic to data. I performed. But pic send data continuously.
Code: |
#include <16f877.h>
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay(clock=4000000)
#include <stdio.h>
#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)
int32 n;
char a;
main()
{
a = getch();
setup_adc(ADC_CLOCK_DIV_2);
setup_adc_ports(all_analog);
set_adc_channel(0);
while(1)
{
n=read_adc();
if (a=='c')
{
printf("deger=%lu",n);
delay_ms(100);
}
}
}
|
So when I tested on Proteus program, the virtual display shows deger=255 or deger=20, etc. (when I changed the potentiometer value).
So I want to do that when I changed the potentiometer values once the datas come from pic to pc at once no continuously. is it possible to do? |
|