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 support@ccsinfo.com

PYD1998 read

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



Joined: 12 Sep 2003
Posts: 37
Location: istanbul

View user's profile Send private message

PYD1998 read
PostPosted: Sat Jun 16, 2012 4:26 am     Reply with quote

Code:

#define IRSENSE_IO PIN_C4 //
int8    i,j;
int16   data=0,dat;

void PYD1998(void){
data=0;

input(IRSENSE_IO);

while(!input(IRSENSE_IO)){
   for (j=0; j < 60; j++); // wait appr. 30 :sec (tS)
   
  for (i=0; i < 15; i++){ // 15 Bits, MSB is low
      //output(IRSENSE_IO);     //configure Pin as output;
      output_low(IRSENSE_IO); //set dl low for >200 ns;
      delay_cycles(25);
      output_low(IRSENSE_IO);//set dl high for >200 ns;
      delay_cycles(25);
      output_high(IRSENSE_IO);

      input(IRSENSE_IO);      //configure Pin as input;
      Data <=1; // shift Bits left
      if(input(IRSENSE_IO)){data ++ ;} // read Hi
     }
   output_low(IRSENSE_IO);
   delay_cycles(200);
   input(IRSENSE_IO);
   delay_cycles(200);
   dat=data;
  }
}

Where is my wrong ?
http://www.excelitas.com/downloads/app_digipyropyq2898_0208.pdf
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jun 16, 2012 10:22 pm     Reply with quote

That appnote has a flowchart and sample code. Why don't you translate
it to CCS, instead of inventing your own code ?
sabobey



Joined: 19 Oct 2008
Posts: 6

View user's profile Send private message

How do I need to write Pyd1998 pic12f675.
PostPosted: Sun Jul 29, 2012 2:05 pm     Reply with quote

PCM programmer wrote:
That appnote has a flowchart and sample code. Why don't you translate
it to CCS, instead of inventing your own code ?



How do I need to write Pyd1998 pic12f675
Crying or Very sad
temtronic



Joined: 01 Jul 2010
Posts: 9169
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jul 29, 2012 5:10 pm     Reply with quote

Seems no one wants to cut code anymore....and the example is done in C nonetheless so it's very easy to 'port' over to CCS C unlike 'translating' it from say BASIC, assembler, etc.
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