• PicŪ Basic

  • 4 digit Keypad Number entry converted to a Word variable?

    I am controlling a door latch with a 16F870 and MOSFET. (I am fully documenting this and will look to post when all together)
    I currently have a static variable LatchTime hardcoded.
    I am in the process of converting this code to allow the LatchTime to be a user variable entered via the keypad. I have thought about the process and wanted to see if anybody had come up with a simple and efficient process or is this the way?

    Example code to illustrate the theory (Not tested: as at work - Lunch Hour)

    Dim Key1 as Word
    Dim Key2 as Word
    Dim Key3 as Byte
    Dim Key4 as Byte

    Dim LatchTime as Word

    Key1 = Key1 * 1000
    Key2 = Key2 * 100
    Key3 = Key3 * 10
    Key4 = Key4 * 1 ' Not required, but for illustration

    LatchTime = Key1 + Key2 + Key3 + Key4

    Latch High
    DelayMS LatchTime
    Latch Low

    and also record this in the internal E2Prom.
    This article was originally published in forum thread: 4 digit Keypad Number entry converted to a Word variable? started by Grant34 View original post
  • Recent Activity


    Mysterious PORTB problem

    Thread Starter: xldaedalus

    I'm using Proton+ to develop firmware for a product with switches. The MCU is an 18F26K22. Most of the switches reside on PORTB. I am NOT using a...

    See_Mos Today, 10:05 Go to last post

    Pic16f18877 oread

    Thread Starter: evoortman

    Hi, On a PIC16F18877 the OREAD command doesn't seem to work. The code is working on a PIC16F1939. Both controllers use 32MHz int osc. If i...

    towlerg Today, 13:23 Go to last post