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

digital inputs pic16f877a

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 04, 2009 2:47 pm     Reply with quote

I suggest that you start with a simple program that doesn't use the RTOS.
Make that program work first. Here's an example:
Code:
#include <16F877A.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=2400,xmit=PIN_E0,rcv=PIN_E1)

//===================================
void main()
{

while(1)
  {
   if(input(PIN_C0))    // Read the switch pin.
      putc('1');        // Display the state of the pin.           
   else
      putc('0');

   delay_ms(100);
  }

}

Make sure that pin C0 has a pull-up resistor on it. You can use 4.7K or
10K.
Sydney



Joined: 13 Feb 2009
Posts: 71

View user's profile Send private message

PostPosted: Wed Mar 04, 2009 3:22 pm     Reply with quote

Agree with PCM, and you seem to be overlooking the fact that input(PIN_C0); is only ever going to return 0 or 1, what sensor is it?
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