Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

18F4431 - setting pins as plain IO

Status
Not open for further replies.

atferrari

Well-Known Member
Most Helpful Member
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.
 
I guess you are referring to the pic manual showing PWMEN0,1,2, as =1 on POR?
Max.

Yes Max. From there I became aware of PWMPIN what led me to dive into the PWM module.
 
That's what I did Ian. It is in the OP.
 
You need to override the pins.. OVDOND and OVDCONS Its in the datasheet! 17.10.3

Hola Ian,

I understood "override" as changing the settings of those pins to get them as common IO instead of PWM_dedicated. In my case, I made ALL of them as IO.

No hands on experience with those OVDOND / OVDCONS register but I think they alter what each pin outputs but they do no change to common IO ones.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top