+ Reply to Thread
Page 4 of 5
First 1 2 3 4 5 Last
Results 46 to 60 of 71

Thread: Calling all programming heads

  1. #46
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    That would be a start even if it don't work it will help to see what you want to do pressing “2” Increasing brightness pressing 8 decreasing brightness
    Last edited by be80be; 11th March 2009 at 03:42 AM.
    Burt


  2. #47
    Mr.K Newbie
    Join Date
    Feb 2009
    Posts
    47

    Default

    Also do I need this part of the code since the telephone keypad has no letter buttons
    Code:
    RETLW   0x43 ;C
    RETLW   0x44 ;D
    RETLW   0x45 ;E
    RETLW   0x46 ;F
    
    Can I remove that?
    Last edited by Mr.K; 11th March 2009 at 03:47 AM.

  3. #48
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    You can don't need it if your going to use a telephone keypad
    Burt

  4. #49
    colin55 Bad colin55 Bad
    Join Date
    Feb 2009
    Location
    Melbourne Australia
    Posts
    1,501

    Default

    Firstly you have create a sub-routine called Keyscan that looks at all the keys and if it finds a ket, the key value is placed in a file such as 22h and a flag is set that says a key has been pressed. This flag is looked at the beginning of the scan routine. The next time the scan routine is run (only a few milliseconds later) it is looking for NO KEY pressed.
    This is called debounce.
    No resistors are needed on the keypad, just turn on the internal 47k pull-up resistors.

    Then create an answer for the keyboard. You can simply increment a register (50 bytes of program at least) while you are scanning or do some fancy Boolean work (about 11 bytes of program).
    I prefer to do simple things as I am a teacher and students will get completely lost unless it is absolutely understandable. Output a register that has been incremented and this will identify each key.
    That's the KeyScan finished. More needed later.
    Last edited by colin55; 11th March 2009 at 06:25 AM.

  5. #50
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    Wouldn't that be this part
    Code:
    ;Keypad subroutines
    Chk_Keys movlw 0x00   ;wait until no key pressed
      movwf KEY_PORT  ;set all output pins low
      movf KEY_PORT, W
      andlw 0x0F   ;mask off high byte
      sublw 0x0F
      btfsc STATUS, Z  ;test if any key pressed
      goto Keys   ;if none, read keys
      call Delay20
      goto Chk_Keys  ;else try again
    Keys    call    Scan_Keys
                 movlw   0x10   ;check for no key pressed
                 subwf   key, w
                 btfss   STATUS, Z
                 goto    Key_Found
      call Delay20
      goto Keys
    
    Burt

  6. #51
    colin55 Bad colin55 Bad
    Join Date
    Feb 2009
    Location
    Melbourne Australia
    Posts
    1,501

    Default

    Producing vague code like that above is all "very well". But you need to have the cirucit diagram with the pins identified and the registers allocated, to be able to produce real instructions. You don't really need any delays as the "flags" create the debounce.
    The sub-routine must be called on a regular basis and take up no time. You must also work out how you are going to generate a key value. Obviously input a byte and check three of four bits for a value. After each bit is checked, a register is incremented.

    I can't do any more until the circuit is generated.
    Last edited by colin55; 11th March 2009 at 06:05 PM.

  7. #52
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    colin55
    I can't do any more until the circuit is generated.
    I think you missed this part http://www.electro-tech-online.com/a...ads-dimmer.png
    Last edited by be80be; 11th March 2009 at 09:13 PM.
    Burt

  8. #53
    colin55 Bad colin55 Bad
    Join Date
    Feb 2009
    Location
    Melbourne Australia
    Posts
    1,501

    Default

    Identify the switches. Add a 10th sw. Remove the resistors. Allocate files.

  9. #54
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    colins55 You have a good website I liked all the circuit's you have on it
    Burt

  10. #55
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    Put some pullups on a keyboard row. Keeps you from shorting outputs when you're scanning and someone presses more than one button at a time.
    __________________
    Bill
    Smart Kits build Smart People
    blueroomelectronics - Smart Kits Build Smart People
    Now I know Bill and and I know you can short the output when scanning more them 1 button at a time . It is to easy to turn off a pullups. So she will stay as is.
    Burt

  11. #56
    colin55 Bad colin55 Bad
    Join Date
    Feb 2009
    Location
    Melbourne Australia
    Posts
    1,501

    Default

    How does a short occur when you are scanning? You must be scanning incorrectly.
    All that happens when 2 keys are pressed is this: The program picks up the first key in the sequence.

  12. #57
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    Are you having a bad day or what. You just said don't use pullups. Set the pins to use
    internal 47k pull-up resistors
    Then you say
    I am a teacher and students will get completely lost unless it is absolutely understandable
    now it is a lot easier to use a pullups then to turn it on internally.
    Burt

  13. #58
    colin55 Bad colin55 Bad
    Join Date
    Feb 2009
    Location
    Melbourne Australia
    Posts
    1,501

    Default

    I meant external pull-ups.

  14. #59
    Mr.K Newbie
    Join Date
    Feb 2009
    Posts
    47

    Default

    now im even more confused than before

  15. #60
    be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent be80be Excellent
    Join Date
    Aug 2008
    Location
    morristown,tn
    Posts
    2,000

    Default

    I posted the wrong 1 here the right 1 I didn't put pullups in it at first and when I posted it here what you need to go with but I still need to added 1 more row of keys.
    Attached Images
    Last edited by be80be; 11th March 2009 at 09:50 PM.
    Burt

+ Reply to Thread
Page 4 of 5
First 1 2 3 4 5 Last

Similar Threads

  1. A heads-up on part suppliers
    By btcg in forum Datasheet/Parts Requests
    Replies: 20
    Latest: 23rd February 2009, 07:38 PM
  2. Heads Up... Elektor Offer
    By Shax in forum Micro Controllers
    Replies: 3
    Latest: 20th February 2007, 01:09 AM
  3. Robot heads
    By William At MyBlueRoom in forum Chit-Chat
    Replies: 4
    Latest: 1st November 2006, 10:20 PM
  4. please help me with my ramdom heads and tails generator
    By mattyeovil in forum Electronic Projects Design/Ideas/Reviews
    Replies: 6
    Latest: 12th February 2004, 09:44 PM
  5. Heads up, bulk LED Reels, very cheap
    By Nostrafus in forum General Electronics Chat
    Replies: 0
    Latest: 25th July 2003, 06:22 AM

Tags for this Thread