16F88 - CCPMX strange fuse setting for HWPM


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938

    Default 16F88 - CCPMX strange fuse setting for HWPM

    Hello,

    I can be wrong, but I think there could be a mistake in my PIC16F88's data-sheet.

    To activate the PWM function on RB0, according to the data-sheet, I need (at least I assume it is so) to set CCPMX_ON.

    Doing so, it will activate PORTB.3!!!

    This is what I can read in the data-sheet:
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1521&stc=1&d=117580494 3">

    This is what I have to do to make it work on RB0:
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1522&stc=1&d=117580515 2">

    Question: am I missunderstanding something or is this an error in the documentation?
    Attached Images Attached Images   
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    You would think that "ON" means a 1 in that bit position.
    But not in this case.

    If you look in the M16f88.inc file in the INC folder under PBP, you'll see these two lines for the CCPMX config bit.
    Code:
    CCPMX_ON        equ     2FFF0000h       ; X0 XXXX XXXX XXXX
    CCPMX_OFF       equ     2FFF1000h       ; X1 XXXX XXXX XXXX
    There you can see that 1 is OFF, and 0 is ON.

    Therefore CCPMX_OFF = RB0, and CCPMX_ON = RB3.

    Added: The default is 1, so you shouldn't need to do anything to have the CCP on RB0.
    But you will need to set the CCP DEFINES, since PBP's default is PORTB.3 for the HPWM command on a 18F88.
    Code:
    DEFINE CCP1_REG PORTB
    DEFINE CCP1_BIT 0
    HTH,
    Last edited by Darrel Taylor; - 5th April 2007 at 22:12. Reason: default
    DT

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Question

    Thanks Darrel,

    I thought the data-sheets where already the most difficult documents to understand... In fact, it's the whole PIC logic

    How would anyone think that "1" doesn't mean "ON"? One can just not verify every and each bit setting any time he uses it, no?

    BTW, I don't set any DEFINE and it works perfectly... on RB0 when the fuse is set to "OFF".

    NB: just wondering how many PIC-freaks do know what you just explained...
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    More than likely, you have manualy set the TRIS registers so that RB0 is an OUTPUT.

    That's the only thing that the DEFINE's will affect.

    Normally, the HPWM command will set the pin to OUTPUT on it's own, but in that case it needs the proper defines.

    "PIC-freaks", you calling me a Freak?
    Dang I hate when people know what I really am.
    <br>
    DT

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    Thanks Darrel,

    I thought the data-sheets where already the most difficult documents to understand... In fact, it's the whole PIC logic

    How would anyone think that "1" doesn't mean "ON"? One can just not verify every and each bit setting any time he uses it, no?

    BTW, I don't set any DEFINE and it works perfectly... on RB0 when the fuse is set to "OFF".

    NB: just wondering how many PIC-freaks do know what you just explained...
    Actually, there's a lot of place where a '0' means on. Look at MCLR*. You are only doing a 'Master Clear' when the pin is at logic 0, or OFF. A lot of control signals are negative logic. On a static ram chip for instance, RD*, WR*, CS*, etc.etc. In this respect, the PIC is not as isolated a case as you might think. It's been this way for a long time. I remember when I was starting out in electronics, the whole negative logic thing was one of the more difficult things to grasp, or should I say 'accept'. But there it is...and there they'll stay...

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


    Did you find this post helpful? Yes | No

    Default

    Oh shoot, here's a big problem I forgot about.

    If you don't set the DEFINE's, when you use the HPWM command, it will set RB3 to OUTPUT since it's the default.

    If you have something providing a signal as an INPUT to RB3, it can cause a short and really screw things up.
    <br>
    DT

Similar Threads

  1. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  2. RA6 & RA7 I/O setting on the 16F88
    By PICante in forum mel PIC BASIC Pro
    Replies: 35
    Last Post: - 23rd August 2008, 19:32

Members who have read this thread : 0

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