LCDOUT -> Count Value


Closed Thread
Results 1 to 5 of 5
  1. #1
    eoasap's Avatar
    eoasap Guest

    Default LCDOUT -> Count Value

    I'm having a hard time trying to do this. this is my configuration and code so far if anyone can help:

    hardware: PIC16F84
    PORTB.2 has a pullup resistor to VCC
    pushbutton switch connected to PORTB.2 to gnd.


    I inserted 'high pushbutton' because once i press the button, the output port did not automatically go back to VCC afterwards (right?, wrong?)

    CounterA var Byte 'for counter
    PushButton var PORTB.2

    If PushButton=0 then
    CounterA=CounterA+1
    pause 10
    high pushbutton
    Pause 10
    While Pushbutton=0:Wend
    Lcdout $fe, 1, "Button Presses =" ' Clear LCD screen
    Lcdout $FE, $c0, Countera
    Pause 2000
    endif

  2. #2
    tegel2's Avatar
    tegel2 Guest


    Did you find this post helpful? Yes | No

    Default

    By making the pin High, you have made the port an output !!!

    You are then shorting the output to ground and may have damaged your Pic.

  3. #3
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    ahh!!! so remove the pullup resistor then and hope the chip isn't fried? does the rest of the code look ok?

  4. #4
    tegel2's Avatar
    tegel2 Guest


    Did you find this post helpful? Yes | No

    Default

    Keep the resistor - a good value is 10k

    CounterA var Byte 'for counter
    PushButton var PORTB.2

    CounterA=0 ' will be an undefined value on startup

    Start:

    If PushButton=0 then
    CounterA=CounterA+1

    Lcdout $fe, 1, "Button Presses =" ' Clear LCD screen
    Lcdout $FE, $c0, Countera
    While Pushbutton=0:Wend
    Pause 2000
    endif

    goto start ' must tell the program where to go otherwise it will crash

  5. #5
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    hmm, still not working. i think i need to try to setup an interrupt. this way regardless of what the program is doing it'll record the button press. i'll poke around the forums and see what i can learn

    Thanks alot for your help!

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  2. need help in coding..
    By daphne8888 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 19th March 2008, 07:31
  3. Help GPS read with serin
    By leinske in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th September 2007, 02:33
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

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