How can i control pic input pins order?


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Do you want to store the number of buttons pressed while the program is still running? For example you press 1 and then press 2 and 3 while 1 is running.
    Last edited by CocaColaKid; - 17th August 2005 at 19:06.

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    tanero,

    your code works as designed.

    IF RA.0 only is LOW it will read 254 (%11111110)
    IF RA.1 only is LOW it will read 253 (%11111101)

    IF both RA.0 and RA.1 are LOW it will read 252 (%11111100)

    so none of the IF... conditions is TRUE, that's why it is just LOOPing

    You may want to check the port bits individually:

    If PortA.0=0 THEN...
    If PortA.1=0 THEN...

    etc.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    tanero's Avatar
    tanero Guest


    Did you find this post helpful? Yes | No

    Default

    Answer for CocaColaKid ;

    yes i want to store the number of buttons while 1 is working. After release 1 , then stored record will be worked.

  4. #4
    tanero's Avatar
    tanero Guest


    Did you find this post helpful? Yes | No

    Default

    Answer for ralph;

    your right for guess . after read your post i changed my code as you offer it worked what i expected nearly.

    But some other things i want to do .

    Example ;
    As PORT Bit loop = one of "if" condition is true , its doing its job. while first if working if second condition is true , second wont work and wait for the first one to be released .

    I want ; while the first "if" is true and working ; second "if" true cond happened , it will store request and will do after first if released.

    Any idea ?

    İ thought to use internal eeprom area to store these requests .

    is it usefull to use a like query ?

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I would say they easist way would be to monitor the buttons when your in the if routines and record the button states. Then once you return to the main loop process what ever value is stored in the variable. This will only work for sequencing one button though.

Similar Threads

  1. Replies: 9
    Last Post: - 26th October 2009, 19:38
  2. The best way to control a servo with a PIC
    By The Master in forum Off Topic
    Replies: 41
    Last Post: - 19th October 2008, 02:44
  3. using all pins of pwm in pic 18f2431
    By jorgequesada in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th May 2007, 21:43
  4. how to control 555 resisters with PIC
    By KB3BYT in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 7th December 2006, 14:27
  5. Analog pins for digital input
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th September 2005, 00:32

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