Problem accessing keypad on PortB (LabX1, PIC 18F452)


Closed Thread
Results 1 to 3 of 3
  1. #1

    Unhappy Problem accessing keypad on PortB (LabX1, PIC 18F452)

    Hey there. I'm trying to use the PIC 18F452 to access a keypad on a LAB X1 board. This is the code that I'm using:

    <LCD Configurations>
    TRISB = %11110000
    PORTB = %11111110
    OPTION_REG.7 = 0

    If PORTB.4=1 THEN
    //The port is low.
    ELSE
    //The port is high
    END IF

    END

    However, I always get a syntax error for the line:
    OPTION_REG.7=0

    I looked in the data sheet for this chip, and it does indeed support this register. I'm not exactly sure what is going on. The pins on PORTB are oscillating back and forth between 1 and 0 a little uncontrollably, and I don't think that the rest of the program and its features and interferring at all.

    Anybody care to offer some help?
    Thank you very much!

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    There are a couple error's in the 452 datasheet. They are just in the notes of the diagrams, so nobody's probably even noticed it.

    There really isn't an OPTION_REG in that chip.

    The RBPU bit is located at INTCON2.7

    hth,
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    There are a couple error's in the 452 datasheet. They are just in the notes of the diagrams, so nobody's probably even noticed it.

    There really isn't an OPTION_REG in that chip.

    The RBPU bit is located at INTCON2.7

    hth,
    Thanks You've saved my life....

Similar Threads

  1. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  2. Pic 18f452
    By mamr_r in forum Serial
    Replies: 2
    Last Post: - 7th April 2009, 04:31
  3. PIC problem, ways to do reset
    By lab310 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th May 2005, 14:31
  4. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14
  5. Sleepy Keypad
    By Melanie in forum Schematics
    Replies: 0
    Last Post: - 25th October 2003, 09:40

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

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