Single button function


Closed Thread
Results 1 to 40 of 41

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    AMPMFlag=AMPMFlag^1 '>>>>>>>>>>>>>>>>>>>what does this do?

    AMPMFlag is a BIT variable.
    All this does is toggle the BIT variable, if it was zero it will be set to 1, if it was 1 it will be set to 0. It is the equivallent of...

    IF AMPMFlag=0 then
    AMPMFlag=1
    else
    AMPMFlag=0
    endif



    Lc var byte [15]
    For i = 0 to 15 : read i, b0:if b0 = 0 then
    lookup i,[1,2,3,11,4,5,6,11,7,8,9,10,11,12,13,14], b0
    Lc(i)=b0 '>>>>>>>>>>>>>>>>>>>>>>>>>>>what does this do?

    Lc is a BYTE array 15 elements deep in the range Lc(0) to Lc(14)
    You are loading Lc at array location i with the contents of variable b0

  2. #2
    Join Date
    Mar 2006
    Posts
    41


    Did you find this post helpful? Yes | No

    Default thanks so much

    Thank you Mel,
    I am incorporating your olympic timer in my medicine scheduler project I used some code snippets from les Johnson's book "experimenting with picbasic" I also read your thread with bits,byte, and arrray handling and found it intuitive!!!
    I am still fixing my keypad routine to scan and output to LCD like a mobile fone does(",) I am trying to find a lcd menu routine for my display I will post it later on a new thread

    thanks again
    ryan

  3. #3


    Did you find this post helpful? Yes | No

    Default

    here is a chip that will give you 2 button's on one i/o
    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4588

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You seriously want to pay $1 for a 2 I/O expander?

    If you need two buttons on one I/O, then you can achieve that with a different value of Capacitor on each of two Buttons and measure the time period for charge. Cost about 5 cents and a bit of magic in software...

  5. #5
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    You could also use the pot command and tie each button to a different value resistor.

    This gives you the added ability of determining when both buttons are being pressed.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Well if I had been trying to solve this problem since March I think a $1 part would be cheap,sorry you didn't like my feable attempt at helping out
    I'll go to my room now and keep quiet.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Don't get the hump over my comment... I'm NOT criticising your contribution which is perfectly valid, but think about a $1....

    For $1 you can get a PIC with a heap of I/O's...

    For an extra $1 added to whatever PIC you are currently using would probably give you a dozen I/O's more

    For 75 cents you can get an I2C 8 channel I/O expander...

    For 45 cents you can get a PIC10F to give you your extra I/O's...

    Adding I/O's at the rate of 50 cents per I/O is nonsensical... there's just so many options available for less money - but...

    you've brought it to everyone's attention, and that just might be exactly the product someone is looking for, so thank you for that.

Similar Threads

  1. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  2. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 22:43
  4. Pushbutton code routine suggestions?
    By jessey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd September 2005, 01:02
  5. Button subfunction 16F628
    By Jųan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2005, 16:44

Members who have read this thread : 1

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