Button/led code question

General discussion on mikroC.
Post Reply
Author
Message
jman 31
Posts: 2
Joined: 27 Mar 2010 00:37

Button/led code question

#1 Post by jman 31 » 04 Apr 2010 20:19

Hi,

I am very new to programming and I am trying to learn as I go. I have a simple schematic that I designed around a PIC16F628a that will be a speedometer/odometer for my bicycle. I am starting very simple though and taking baby steps with it. I have initiated the LCD and I can make it print what I want, and I have made the LED blink. Now I want to get the reset button working and the other button to simply turn on the led when pressed and turn off when released. I can't find any simple programming (that I can understand) that works with mikroC for this.

Can someone please point me in the right direction? Maybe some sample code that would do this? debounced would be even better, but is not necessary at this point of my learning.

EDIT: I got the reset button to work, but I still need some direction for making the led button work.


Thanks for any advice,
Jeremy

Image

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: Button/led code question

#2 Post by Dany » 05 Apr 2010 12:50

Perhaps this article can be of some help: http://users.edpnet.be/rosseel01/DRO/PI ... relays.htm.

By the way, I think the circuit around the magnetic reed switch is wrong. It should be the same as for a normal button I think (after all it is just a contact, or not?).
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

jman 31
Posts: 2
Joined: 27 Mar 2010 00:37

Re: Button/led code question

#3 Post by jman 31 » 05 Apr 2010 21:50

Dany wrote:Perhaps this article can be of some help: http://users.edpnet.be/rosseel01/DRO/PI ... relays.htm.

By the way, I think the circuit around the magnetic reed switch is wrong. It should be the same as for a normal button I think (after all it is just a contact, or not?).
Thanks Dany, for the website (article) and the circuit issue. you are right! I overlooked the connection to ground. :oops: The reed switch should definitely be treated the same as the other switches.

balazs
Posts: 37
Joined: 20 Mar 2010 14:53

Re: Button/led code question

#4 Post by balazs » 08 Apr 2010 16:50

I don't understand why you want to do it by programming the simple led blink.... when you can put all in without programming and not consuming your i/o ports... but still if you what to learn how to do that could you attach your program your made so far.

Post Reply

Return to “mikroC General”