CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

output always with weak pull down?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ipq



Joined: 20 Aug 2015
Posts: 17

View user's profile Send private message

output always with weak pull down?
PostPosted: Fri Oct 23, 2015 9:21 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

Re: output always with weak pull down?
PostPosted: Fri Oct 23, 2015 10:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Oct 23, 2015 10:12 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Oct 23, 2015 2:15 pm     Reply with quote

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

View user's profile Send private message

fast_io does not work
PostPosted: Mon Oct 26, 2015 8:53 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 26, 2015 9:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 26, 2015 9:31 am     Reply with quote

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

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Mon Oct 26, 2015 5:42 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group