need help in programming

Discussion in 'Embedded Systems and Microcontrollers' started by santronics, Jun 21, 2010.

  1. santronics

    Thread Starter New Member

    Jul 2, 2008
    4
    0
    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
     
  2. Vaughanabe13

    Active Member

    May 4, 2009
    102
    5
    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.
     
    santronics likes this.
  3. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,741
    759
    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.
     
    santronics likes this.
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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.
     
  5. santronics

    Thread Starter New Member

    Jul 2, 2008
    4
    0
    actually i have the code for timer only and for rest i dont know from where to begin so plz help
     
  6. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,741
    759
    then post it
     
  7. santronics

    Thread Starter New Member

    Jul 2, 2008
    4
    0
    actually i have the code for timer program but have no idea how to attach with the other function that i wanted to
     
Loading...