Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 22nd March 2004, 10:04 AM   (permalink)
Default Output going high on power up?!?!

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 is offline   Reply With Quote
Old 22nd March 2004, 10:17 AM   (permalink)
Default Re: Output going high on power up?!?!

Quote:
Originally Posted by 2camjohn
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 22nd March 2004, 07:14 PM   (permalink)
Default

Thanks again Nigel that will be it. :lol:
2camjohn is offline   Reply With Quote
Old 22nd March 2004, 07:53 PM   (permalink)
Default

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.....
kentken is offline   Reply With Quote
Old 23rd March 2004, 05:58 PM   (permalink)
Default

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?


Thanks again.
2camjohn is offline   Reply With Quote
Old 23rd March 2004, 06:49 PM   (permalink)
Default

Quote:
Originally Posted by 2camjohn
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 11:07 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.