CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

sending to pc from pic for analog data problem?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
capella



Joined: 07 Feb 2009
Posts: 38

View user's profile Send private message

sending to pc from pic for analog data problem?
PostPosted: Wed Mar 31, 2010 6:47 am     Reply with quote

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?
capella



Joined: 07 Feb 2009
Posts: 38

View user's profile Send private message

PostPosted: Wed Mar 31, 2010 12:29 pm     Reply with quote

has anyone got an idea?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 31, 2010 12:38 pm     Reply with quote

You need to start thinking like a programmer, instead of asking us to
write code for you.

This sample program may help you. See if you can change it to create
your desired program:
http://www.ccsinfo.com/forum/viewtopic.php?t=41229
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group