16F689 PORTB.7 Problem


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

    Default 16F689 PORTB.7 Problem

    I am using this pin as an input. I had "TRISB = %1000" at the front of my program, and this pin would always come up as an output, in the low state. This is a 4 bit port, and the data sheet says the lower 4 bits of TRISB are ignored. It appears that this is not the case, for when I change to "TRISB = %10000000", it works! Can someone confirm this for me, so I'll know I'm not crazy?

    Thank you.

  2. #2
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    You're right. Trisb=%1000 is setting the lower four bits, which are ignored. This command would set portb.3 as an input, but your particular PIC doesn't have a portb.3 port, so it doesn't work, and is ignored. Trisb=%10000000 will indeed set portb.7 as an input.

    Jerry
    If your oscilloscope costs more than your car...

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Does this mean the data sheet is wrong, or am I just misinterpreting it?

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jderson View Post
    Does this mean the data sheet is wrong, or am I just misinterpreting it?
    The datasheet is right. It specifically states that the lower four bits are unimplemented, which in the Legends for the various pages it states that unimplemented bits are read as '0'. And to that end, I remember reading a long time ago in one of those PIC XXxxxx Family Reference manuals that writes to unimplemented bits are discouraged, most like just because they are exactly that...unimplemented. (Remember the Z-80 back in the day, there were a bunch of bit codes that were 'unimplemented' and turned out to be extended instructions that didn't quite work out the way they'd planned)

Similar Threads

  1. Problem with 16Ff648a
    By aerostar in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 12th November 2009, 18:15
  2. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  3. PicBasic Pro Math Problem??
    By Glen65 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th March 2006, 04:36
  4. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59
  5. Problem with saving to EEPROM...
    By Tear in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st July 2005, 00:10

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