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.

Output going high on power up?!?!

Status
Not open for further replies.

2camjohn

Member
When I power up my chip sometimes one of my ouputs is high for no reason.

The only place in my code which sets this output high is triggered from an interrupt and then it is only on for a very short delay before It is turned off. When I power on my chip sometimes this output is high and remains on untill I trigger this interrupt and it turns off. This output controls the release of high pressure gas so it is vital that it does not come on unexpectedly or for a long time.

My circuit uses a pic16f84a, 2 inputs and 3 outputs and a 4mhz crystal.
The code is very simple and I am certain nowhere sets the output high except for in the interrupt code.

Thanks
 
2camjohn said:
When I power up my chip sometimes one of my ouputs is high for no reason.

The only place in my code which sets this output high is triggered from an interrupt and then it is only on for a very short delay before It is turned off. When I power on my chip sometimes this output is high and remains on untill I trigger this interrupt and it turns off. This output controls the release of high pressure gas so it is vital that it does not come on unexpectedly or for a long time.

My circuit uses a pic16f84a, 2 inputs and 3 outputs and a 4mhz crystal.
The code is very simple and I am certain nowhere sets the output high except for in the interrupt code.

Thanks

Are you setting it low?, you should do this at the start of the program, before you set the TRIS register as an output - to ensure it doesn't go high briefly.

If you're not setting it low, it's quite possible it will be high - basically a random choice on power up - you need to initialise all registers, including I/O ports.
 
It is a good habit to set all ports, tris, trigger holders, etc at the start of the program. (you know what they are, no gessing)

I have had a triger holder for a Interupt get some odd values at the start and cause a interupt like action, and increase the count number.

These are the little problems that make it so fun..... :)
 
2camjohn said:
Is it also necessary to set my inputs low aswell?

What I mean is I have an interrupt which trigers a critical routine, is it possible for the interrupt pin to be high on power up causing the routine to be triggered unexpectedly?

You can't set an input, if you could it would be an output :lol:

Also, the last thing you should do in your initialisation routine is turn the interrupts on - you then know that everything is (or should be) set correctly.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top