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.

PIC I/O Pins have problem on RESET....

Status
Not open for further replies.
I have PIC 18f452 with PICC ide and compiler. I have strange behavior of pins that is on master reset if i set their TRIS=0 and put the PIN on Low status. on startup it turns ON one time then behaves like i programmed.
pin output is attached with an external counter(for example) it deforms the results.
Is there any program/code setting that it should'nt turn ON on first startup.
Best Regards,
Joe.
 
Are you setting the port to 0 before setting tris to 0?

If for example your code is like:
TRISA = 0;
PORTA = 0;

Then, when you start your pic, you'll have an unknown output, however if you change the order to:
PORTA = 0;
TRISA = 0;

Then it should start up properly.
 
Hi MP,

Check the data sheet page 91, it shows the PORT values on POR.

When you turn the micro on and set the PORT as an output, it is configured as an output with the stated output i-e -1111111. Where as if you will read them on power up than you will get all -x0x0000.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top