ones tens hundreds counter to eliminate and up/down counter[ASM]


+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007
    Posts
    12

    Default ones tens hundreds counter to eliminate and up/down counter[ASM]

    I have a speed alert code which i need to modify with 3 extra push buttons (Used on a PIC16F886) - A ones, tens and hundreds placeholder to input the speed limit

    Would you think it would be viable to have both a three button input and an up down input? If not how would i replace the up down counter with these three buttons.

    If i keep the up down buttons - How could I add the ones, tens and hundreds placeholder buttons ontop of this? I will be using PORTC - (excluding PIN17 and PIN18 NEEDED FOR EUARTS (RC6 and RC7))

    so I'm thinking i'll do the following

    Code:
                STATUS          equ 03h
                TRISA             equ 87h
                PORTC            equ 07h
    
                                      bsf                    STATUS,5
                                      movlw                03h          ; RC0,RC1, RC2 = inputs
                                                                             ; (Hundreds,Tens,Ones)
                                      movwf               TRISC
                                      bcf                    STATUS,5
    Register map is included here


    (i'll play with RC6 and RC7 once i read up on EUSARTS )


    I was planning on having a temp variable - templimit such that I can store the actual speed limit in it as follows:

    templimit = (hundreds*100)+(tens*10) + ones.
    This would set the speed limit then I'd use the serial EUSART to overwrite this if it needs to be automatically updated.

    the locations for the up/down counter is:
    *Polling for
    - down button: Line 863
    - up button: Line 869
    * incrementing the speed
    - line 925
    * decrementing the speed
    - line 936


    Any help - whether theory or advice would be highly appreciated.
    Attached Files Attached Files

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

    Default

    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. UP/down counter & shiftout interupt problem
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd July 2007, 15:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts