PDA

View Full Version : Outputs high to power



volcane
- 2nd February 2008, 15:51
Hi!

I have a boards with a pic16f628a how can we ensure that the outputs go high for some fraction of a second when the power circuit?

example configuration:

@ device pic16f628A,xt_osc,wdt_on,pwrt_on,protect_off,mclr_ on,bod_Off

define osc 4

DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 9600 '
DEFINE HSER_CLROERR 1

SYMBOL s2 =PORTA.0
SYMBOL s1 =PORTA.1
SYMBOL canc_2 =PORTA.2
SYMBOL stop_1 =PORTA.3
SYMBOL power =PORTA.4


SYMBOL ferma =PORTB.0
' =PORTB.1 'RX
' =PORTB.2 'TX
SYMBOL led =PORTB.3
SYMBOL canc_1 =PORTB.4
SYMBOL canale2 =PORTB.5
SYMBOL canale1 =PORTB.6
SYMBOL stop_2 =PORTB.7

cmcon=7
OPTION_REG.7=1

low canc_1
low stop_1
low canc_2
low stop_2
low led

input s1
input s2
input canale1
input canale2
input ferma

output canc_2
output stop_1
output power
output led
output canc_1
output stop_2

I can resolve this problem?

dragons_fire
- 2nd February 2008, 16:28
Put an LED on your output and to ground, if it lights up, then its High!!

Acetronics2
- 2nd February 2008, 18:29
Hi, Volcane

There are two things to consider :

1) at power up ... Pic acts just like if you had forgotten to place it !!! ( all ports are INPUTS )
... so, you must design your power section according to that.

2) you can program the outputs to be High, as soon as processor execute the TRIS command ( after some µsecs, then ....) :

Write :

PORTa = %11110101 ' for example
TRISA = % 00001010 ' "

Here you FIRST set the output latches in the correct state
THEN choose your I/Os.

This is THE classical "bug" for electronic ignitions ... coil is powered at poweron ... then the port is set to de-energize the coil ... results a nice "bang" or crankshaft back kick !!!

Alain