two BCD switches


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Location
    Germany: Coal Area
    Posts
    6

    Wink two BCD switches

    Hi you all!
    solved my LCD flashing problem with your help: donīt need to clear the display every second but used the "Dec5" command. has zeros in front instead but works fine for me.

    New problem: Wanna read the status of 2 bcd-rotary switches with digits from 0 to 9 making a variable from 00 to 99 ( 10 to 99 would do ....) for a digital overrev switch in an electronic ignition.

    But I donīt have any clues how to tell my favorite 16F628A to read the two switches ......

    I couldnīt use RB0 because I need this to count the frequency.

    so letīs assume I got 8 Input ports........

    oh yes: and I need the external crystal too, so RA6 & RA7 are in use...


    PLEASE Help!

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


    Did you find this post helpful? Yes | No

    Default Here's one way

    Hi Mugel,
    IF you have enough ports THEN . . .

    MyVar var byte
    If PortA.0 != 0 Then
    my var = 0
    else If portA.1 != 0 then
    myvar = 1 . . . . and so on

    here is another way using analog inputs
    http://www.romanblack.com/keypad.htm
    Last edited by Archangel; - 10th November 2006 at 00:15.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    If i'm right, the following may be something to play 'round of
    Code:
    Switch1 Var Byte ' let's say it's connected on PORTB<7:4>
    Switch2 var Byte ' let's say it's connected on PORTA<4:0>
    Result var byte
    
    start:
        Switch1=PORTB>>4
        Switch2=PORTA & $0F
        Result=(Switch1*10)+Switch2
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Oct 2006
    Location
    Germany: Coal Area
    Posts
    6


    Did you find this post helpful? Yes | No

    Talking Success!

    Hi guys!

    thanks for your help, everything works fine for me Pic related of course, haha.

    got to measure engine speed, rev limit with two BCD switches AND ignition shutoff while engine stands still to save the coil. WOW never thought this goes that easy, meaning: I am able to build that.

    Ok youre right, this is just the lab version on a veroboard with a frequency counter as "test engine". But iīm shure it will work in Reality too because Iīm experienced in spike pested engine electrics

    Iīll tell more!

    Mugel

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


    Did you find this post helpful? Yes | No

    Smile If it's not top seceret, or Que

    Hi Mugel,
    Glad you got it working.
    If it's not top secret I would like to eyeball that code
    JS

Similar Threads

  1. Bcd Fomat Help
    By Santana in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 28th November 2012, 06:00
  2. DS1302 16F628 Woes
    By idtat in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th January 2009, 14:15
  3. scanning BCD switches
    By dsicon in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2008, 17:57
  4. Rotary BCD
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2007, 03:04
  5. switches & LEDs ... my first attempt
    By yankee in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 28th January 2006, 12:51

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