View previous topic :: View next topic |
Author |
Message |
ipq
Joined: 20 Aug 2015 Posts: 17
|
output always with weak pull down? |
Posted: Fri Oct 23, 2015 9:21 am |
|
|
Hello,
My mcu is driving an optotriac with a pin set up as an output. The problem arises when the mcu is restarted, then the output is undetermined and it is activating the opto.
Is there any way to avoid the use of weak pull down resistors to avoid this?
The point is...Is there anyway to avoid that "output dance" when the mcu is restarted (I mean by code)?
Thx |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
Re: output always with weak pull down? |
Posted: Fri Oct 23, 2015 10:04 am |
|
|
ipq wrote: | Hello,
My mcu is driving an optotriac with a pin set up as an output. The problem arises when the mcu is restarted, then the output is undetermined and it is activating the opto.
Is there any way to avoid the use of weak pull down resistors to avoid this?
The point is...Is there anyway to avoid that "output dance" when the mcu is restarted (I mean by code)?
Thx |
No. And if you think about it, how could there be, the processor is not yet running. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Fri Oct 23, 2015 10:12 am |
|
|
Actually there may be.
Problem is that CCS by default sets the TRIS, before they output the value. This can give one cycle of the signal being driven high, when you want it to go low. This may well be the 'dance' being referred to.
In all honesty this is one place where using FAST_IO is definitely called for. The sequence then becomes:
Set the output register to the level you want.
Now set the TRIS.
Alternatively, if using standard_io, simply use getenv, to get the lat register for the port, and set this to the level you require, before calling the output instruction. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Fri Oct 23, 2015 2:15 pm |
|
|
Another possible way is to design using 'active low logic' and have a real pullup in parallel with the opto device input.
This would ensure the opto is always off until a solid low or '0' is sent to it.
Jay |
|
|
ipq
Joined: 20 Aug 2015 Posts: 17
|
fast_io does not work |
Posted: Mon Oct 26, 2015 8:53 am |
|
|
hello everybody,
Ttelmah: We have been trying to use fast_io, but with no success.
temtronic: You mean an AND gate?
Thx |
|
|
drolleman
Joined: 03 Feb 2011 Posts: 116
|
|
Posted: Mon Oct 26, 2015 9:14 am |
|
|
no what he means is put the resistor to 5v to opto then to mcu so when you want it activate it you send a output low. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Mon Oct 26, 2015 9:31 am |
|
|
and what is your problem with fast_io?.
What port are you on?.
What peripherals are you using on the port?.
What pins are you using?.
What TRIS setting are you using?.
etc.. |
|
|
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
|
Posted: Mon Oct 26, 2015 5:42 pm |
|
|
Put brownout reset on your fuse, anode of opto on PIN_x0 and cathode on PIN_X1, should avoid that "output dance", any random state on port, high or low can't trigger the opto. |
|
|
|