Pic16f877


Closed Thread
Results 1 to 7 of 7

Thread: Pic16f877

  1. #1
    GEORGE VARGHESE's Avatar
    GEORGE VARGHESE Guest

    Question Pic16f877

    I have a LAB77 board from Rentron.Pic Basic pro compiler from
    M.E.Lab. At present when I switch on The display shows "press
    any key".When I press any key this will display key value.
    Now I need to enter a value 1000 to the memory.When I press
    1 the value 1000 should increase by 1.
    when I press 0 the value displays on the LCD should decrease by 1.
    I need a program to do this function.

    George

  2. #2
    lwindridge's Avatar
    lwindridge Guest


    Did you find this post helpful? Yes | No

    Default

    Can you post your code here so we can take a look?

    Sounds like a simple case of loading the variable with a number before it goes through the main code.
    Might be worth you taking a quick look in the PHP manual at the LET statement.

    Hope that helps.

    Leigh

  3. #3
    GEORGE VARGHESE's Avatar
    GEORGE VARGHESE Guest


    Did you find this post helpful? Yes | No

    Default

    Please go to
    http://picbasic.com/resources/samples.htm#x1pbp

    Then select keyx.bas

    Here you can see the program to display key number on LCD.

    When I press 1 and 2 together 1000 should appear on the
    LCD display.

    When I press 1 should increase by 1.
    When I press 0 should decrease

  4. #4
    lwindridge's Avatar
    lwindridge Guest


    Did you find this post helpful? Yes | No

    Default

    OK, so what I need to know is...

    1. Have you modified the code at all yet to try anything?
    2. Are you using a keypad, and if so where is it connected.
    3. If you are using a keypad, do you need access to any of the other buttons at all?

    Based on this I should be able to come up with something for you.

    Leigh

  5. #5
    GEORGE VARGHESE's Avatar
    GEORGE VARGHESE Guest


    Did you find this post helpful? Yes | No

    Default

    Please go to www.rentron.com/serkey16.htm
    I have connected as shown in the diagram.

  6. #6
    GEORGE VARGHESE's Avatar
    GEORGE VARGHESE Guest


    Did you find this post helpful? Yes | No

    Default key connections

    Hello Leigh
    I think we connect extra key as you adviced.
    When it is in key scanning mode pressing any key it will show
    key value.There is one more idea can we program for pressing
    key number 1 and 2 together to go to the mode for displaying
    1000 and should be able to decrease and increase by pressing
    0 and 1.What is your opinion.If you have better idea please tell
    me.
    Regards
    George

  7. #7
    lwindridge's Avatar
    lwindridge Guest


    Did you find this post helpful? Yes | No

    Default

    Looking at the code etc I can figure out the following...

    If portb.0 = 1 then
    cnt=cnt+1
    endif
    If portb.1 = 1 then
    cnt=cnt-1
    endif

    So if the key attached to portb.0 is pressed then the variable cnt would reduce by 1 and would increase by 1 if the portb.1 key is pressed.

    Using the example code you would reference the variable [key] and so could operate the same math based on the reading.

    If you have modified the code already, please post it here and I'll make the modifications for you and place comments in the code so you understand more what it is doing.

    Leigh

Similar Threads

  1. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  2. PIC16F877 I2C programme
    By cooqo in forum mel PIC BASIC
    Replies: 3
    Last Post: - 21st April 2008, 10:02
  3. Replies: 8
    Last Post: - 17th January 2007, 19:18
  4. Ericsson T10 interface with PIC16F877
    By jam547 in forum GSM
    Replies: 0
    Last Post: - 25th March 2006, 22:27
  5. USB interface from PIC16F877 to PC
    By headshouter in forum USB
    Replies: 0
    Last Post: - 26th February 2006, 04:58

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