need help in programming

Thread Starter

santronics

Joined Jul 2, 2008
4
i am doing a project based on 16f84a,and it is a timer project
and i have some difficulties which i am trying to overcome problems are
*i want to use a single switch (input)
*mcu should be at rest before switch is pressed and start as switch is pressed
*and while mcu is working if the same switch is pressed it should be paused and should run if the switch is repressed
i am trying to do the project in mikrobasic pls help me
 

Vaughanabe13

Joined May 4, 2009
102
Attach a switch to the INT0 pin of the MCU (one side goes to the pin and the other side goes to ground) and enable the pullup resistors (or use an external resistor) to keep the pin normally high. This way the pin will remain high until you press the switch, which will make it go low. If you need to actually make the PIC go to sleep while you do this (or be able to trigger on a button press at any point in the code), the best way is to configure a high-priority interrupt that will trigger on a negative edge. Then you can use the interrupt service routine to direct code after the button has been pressed. I don't know how much you know about interrupts so if none of this makes sense to you let us know.
 

R!f@@

Joined Apr 2, 2009
9,918
i am doing a project based on 16f84a,and it is a timer project
and i have some difficulties which i am trying to overcome problems are
*i want to use a single switch (input)
*mcu should be at rest before switch is pressed and start as switch is pressed
*and while mcu is working if the same switch is pressed it should be paused and should run if the switch is repressed
i am trying to do the project in mikrobasic pls help me
Post ur code and we can rectify it.
If you do not have a code, then try to make one and post it, that way more will respond to ur needs.
 

t06afre

Joined May 11, 2009
5,934
By the way. Do have to use the 16f84a. You can get newer Microchip variants that cost less and have more functions. The 16f628 is a good replacement for the old 16f84a chip.
 
Top