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

led on-off help me

 
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 Jul 18, 2007 12:39 pm     Reply with quote

Use the routines in the 2nd link. Do something like this:
Code:

void main()
{
int8 led_state;

led_state = 0;
output_low(LED_PIN);

while(1)
  {
   wait_for_keypress();
   
   led_state = !led_state;
   output_bit(LED_PIN, led_state);
  }

}


Port A doesn't have any internal pullups on it for your PIC.
That's why that function gives an error message.
tony
Guest







PostPosted: Wed Jul 18, 2007 2:13 pm     Reply with quote

You do realize RA4 has an open collector output. If you do not have a pullup on the pin the button may never look high.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 18, 2007 2:30 pm     Reply with quote

He's using pin A4 as an input.
Quote:

used a RA4 as button

#define P1 PIN_A4

value = input(P1);

However, he does need a pull-up on that pin, to use it with a push-button
switch. If he is using a PicDem2-Plus board, it already has one on pin A4.
Guest








PostPosted: Thu Jul 19, 2007 5:24 am     Reply with quote

mmmm always the same problem...
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