working with buttons in microcontroller

Discussion in 'Homework Help' started by sk8ergirl, Jan 22, 2014.

  1. sk8ergirl

    Thread Starter New Member

    Jan 22, 2014
    8
    0
    Hi,
    I'm new to c language for PIC microcontroller using mplab. I have this assignment for embedded system and part of the assignment is that in the circuit there are two buttons (switch) when the user press the click once the action start and when the user click the second button once the action stop I'm getting confusesd with all there terms in microcontroller and c :confused: :confused: I've looked for books in the library but they are all theoretical no explaining for codes or anything I also looked at some sites in google but there weren't much of help

    could you help me please
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    Pro Tip: One of your future assignments will be 9-12 button keypad. If you can not figure out 2 buttons now, what are you going to do in the future?
     
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,534
    2,369
    This is a basic simple latch/unlatch circuit or action.
    Go from there.
    Max.
     
  4. sk8ergirl

    Thread Starter New Member

    Jan 22, 2014
    8
    0
    how can I know the name of the button
    for eg in java when you want to program a button if the button name is btnDoThis then you would do something like this btnDoThis(java.awt.event.MouseEvent evt)

    what about c how do you call button
     
  5. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    i never used books for my microcontroller circuits. But it tooks me some years to get to know them.

    With books it takes you only some months
     
  6. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    Did the instructor provide you with the schematic of the circuit?
     
  7. sk8ergirl

    Thread Starter New Member

    Jan 22, 2014
    8
    0
    yes she provided the circuit schematic
     
  8. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    The schematic should have a picture of the PIC (usually a rectangle). On that picture there will be labels of the individual pins. The buttons will be connected to these pins. That is how you know the names of the buttons.

    Furthermore. Your program should have header files in the very beginning of the program. One of these header files contains the detailed "description" of the pins. You don't really need to dig that deep, but you need to know why you are including these header files.


    Post the picture of the schematic. Otherwise this is going to turn into Game of 101 Questions and I am not interested in playing this game.
     
    sk8ergirl likes this.
  9. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    To read a button in the microcontroller world is the same as checking the status of a single bit in a port register is it High or Low. The header file for the PIC you are using will give the correct naming. It differs some from the 16F and 18F series PICs. Let us start in that end. Then you can add debouncing later if needed
     
    sk8ergirl likes this.
  10. sk8ergirl

    Thread Starter New Member

    Jan 22, 2014
    8
    0
    Thank you for your help I will post pic of the circuit tomorrow cuz I can't access the lab now :(
    thank u again for ur help
     
  11. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    No problem. When I was taking microcontroller class, we had our circuits simulated in Proteus, just take a screen shot of the simulated circuit, maybe zoom in on the section where microcontroller and the buttons both shown. So we would have two pictures, the circuit overall and the more specific part of it.
     
Loading...