button help


Results 1 to 16 of 16

Thread: button help

Threaded View

  1. #11
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kalind View Post
    gee, that example is confusing. all i want to use is 5 buttons on port c of my 16f873.

    button A = High Setpoint
    buttonB = Low Setpoint
    buttonC= Increment
    buttonD= Decrement
    buttonE= Return to main display

    At power up of my device, I want my program to prompt the user to enter a high and low setpoint then continue to display the main program afterwards. If the user decides to change setpoint, then the buttons above can be used.
    Yes, it can be so why bother with all that keypad code then?
    Code:
    'simple if then loop
    BUTTONA VAR PORTC.0
    BUTTONB VAR PORTC.1
    BUTTONC VAR PORTC.2 ' and so on . . . 
    MAIN:
    IF BUTTONA = 0 THEN gosub High_Setpoint
    IF BUTTONB = 0 THEN GOSUB Low_Setpoint
    IF BUTTONC = 0 THEN GOSUB Increment
    ' More code goes in here
    
    GOTO MAIN
    high_setpoint:
    'do something in here
    return
    Low_Setpoint:
    'do something in here
    return
    Increment:
    'do something in here
    return
    
    'more sub directories here
    
    
    end
    To address your original question, you may wish to store the value in the eeprom of your chip. Use WRITE command to store and READ to retrieve the values.
    Last edited by Archangel; - 9th October 2008 at 11:08.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 09:10
  2. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 03:43
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 23:43
  4. Button Push within 3 second Window
    By Tissy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd December 2005, 11:06
  5. Button subfunction 16F628
    By Jųan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2005, 17:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts