18F4431 - setting pins as plain IO

Discussion in 'Embedded Systems and Microcontrollers' started by atferrari, Jan 31, 2016.

  1. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    2,648
    762
    Micro 18F4431 - Assembly

    In spite of having used the above, several times in the past with no issues, today, after replacing in a working design, the 18F452 in charge with a 18F4431, I found the keyboard and LCD, not responding. After much RTFM, I noted that pins

    RB0 / PWM0
    RB1 / PWM1
    RB2 / PWM2
    RB3 / PWM3
    RB4 / PWM5
    RB5 / PWM4
    RD5 / PWM4
    RD6 / PWM6
    RD7 / PWM7

    may be assigned in various ways to the Power Control PWM Module. In my case I wanted all of them to behave as common IO pins. Basically, by doing CONFIG PWMPIN =OFF, they will start as such since power up.

    But, if for any reason, I did CONFIG PWMPIN =ON, later, to get ALL of them released from the PWM peripheral after power up, I should do:

    BCF PWMCON0,PWMEN0
    BCF PWMCON0,PWMEN1
    BCF PWMCON0,PWMEN2

    The above allows several possible combinations (which I do not need by now).

    I am not trying to teach anything to anyone! Just an expression of relief; duly noted in my data sheet, it is one ghost less to chase in the future.
     
Loading...