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 + BUTTON + INTERRUPTS ?

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








LED + BUTTON + INTERRUPTS ?
PostPosted: Fri Mar 25, 2005 8:33 am     Reply with quote

Hi !

I would like to use a PIC18F458 that has a button (on RB4) to switch on a led (on A0, for example) if the button is pressed for 4 seconds and not if not. =)

Do i better have to use interrupts ? Or something else ?
Do you have a program to help me ?

Thanks a lot.
Best regards.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Fri Mar 25, 2005 9:47 am     Reply with quote

You will see that this forum is plenty of proposal like yours, the idea is
that you must do the first movement posting a small but complete
C source code
to enable us to know what and how are you
trying to do it.
If you tried starting with the examples provided with the CCS compiler
package I�m sure you are ready for this. Once you post your code we will
correct, criticize and propose some tips to guide you.

Best wishes,

Humberto
Guest








PostPosted: Tue Mar 29, 2005 9:26 am     Reply with quote

ok thanks, i found this which works quite well :



Code:
       
If (!input(BUTTON)){      // Wait for Enter Button to be pressed
while (!input(BUTTON));   // Wait for Enter Button to be released
delay_ms(3000);           // Delay 3 s
output_high(LED_1);}      // LED_1 ON
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