Reply by marcel_duo February 19, 20092009-02-19
Michael, OCY,

Thanks guys is working just fine now
Thanks again.

Best Regards
Marcel D.

Beginning Microcontrollers with the MSP430

Reply by tintronic February 19, 20092009-02-19
Marcel,
You did'n understand the circuit I described. Still, from your results
I see another problem: The current through the optocoupler-LED seems
to be too low. Check your optocouplers datasheet, specifically the
gain (hfe) of the LED current versus transistor current.

The connection I was suggesting was the following:

Vcc - collector
emitter - 220 ohm resistor - LED - GND
emitter - 10k resistor - GND
emitter - MSP input

Make sure about 5mA are passing through the optocouplers LED. A
resistor of about 3.3k 1/2Watt should work fine on the 24Vdc voltage
source.

Your problem seams to be exactly what OCY described. The MSP leakage
current, which passes through the 510k resistor, the 10k resistor and
the LED on it's way to ground, are generating more than the maximum of
0.9V for the schmitt-trigger input to flip to a logical 0.

Michael K.
--- In m..., "old_cow_yellow"
wrote:
>
> According to MSP430F12x2 datasheet, the port pins use Schmitt-trigger
> inputs. At Vcc 3V, they must be either above 1.9V (for high) or below
> 0.9V (for low).
>
> There may be a leakage from the photo-transistor which causes the
> voltage to become marginal. Attach the volt-meter to the pin while you
> try your code.
>
> --- In m..., "marcel_duo" wrote:
> >
> > Hi,
> >
> > I'm using MSP430F1222 and I have a problem with some of the inputs
that
> > won't go back to off mode.
> > I'm using an optocoupler to interface a 24vDC to the MSP430, Vcc 3v -
> > > collector, the emitter -> (LED -> GND) and (510K ->MSP430).
> > The thing is that some of the inputs are working just fine and
turns on
> > and off as anode of the optocoupler goes on and off and some of the
> > inputs just stuck in a "1" after the first time that they have turned
> > on.
> >
> > Can someone please advice me how to solve this problem.
> >
> > Thanks
> > Marcel D
>

Reply by old_cow_yellow February 18, 20092009-02-18
According to MSP430F12x2 datasheet, the port pins use Schmitt-trigger
inputs. At Vcc 3V, they must be either above 1.9V (for high) or below
0.9V (for low).

There may be a leakage from the photo-transistor which causes the
voltage to become marginal. Attach the volt-meter to the pin while you
try your code.

--- In m..., "marcel_duo" wrote:
>
> Hi,
>
> I'm using MSP430F1222 and I have a problem with some of the inputs that
> won't go back to off mode.
> I'm using an optocoupler to interface a 24vDC to the MSP430, Vcc = 3v -
> > collector, the emitter -> (LED -> GND) and (510K ->MSP430).
> The thing is that some of the inputs are working just fine and turns on
> and off as anode of the optocoupler goes on and off and some of the
> inputs just stuck in a "1" after the first time that they have turned
> on.
>
> Can someone please advice me how to solve this problem.
>
> Thanks
> Marcel D
>

Reply by marcel_duo February 18, 20092009-02-18
OCY,

The problem is not with turning the input to a high level but to poll
it down again ones the voltage drops down the MSP still sense
something.
Why several I/O ports turn on and off and some of the just stock in
an on mode?
OK I have connected 10K resistor between the LED and the ground and
the emitter is connected to the MSP. The LED is working very weak,
but the problem is still going on.
Marcel

--- In m..., "old_cow_yellow"
wrote:
>
> Marcel,
>
> The LED lights up when there is enough current going through it. But
> the MSP430 input pin is sensing the voltage. Like Michael said, that
> voltage may not be high enough even when the LED is on.
>
> A resistor in series of the LED will reduce the current and raise
the
> voltage to the MSP430. If that is not bright enough, you can use two
> LEDs in series instead of a resistor and one LED.
>
> --OCY
>
> --- In m..., "tintronic" wrote:
> >
> > Your connection is quite strange (at least what I understood from
what
> > you wrote). Use a tester and measure the voltage on the MSP input
pin.
> > My guess is that it is higher than Vin_low_max.
> >
> > What is the 510k supposed to accomplish and why do you use such a
high
> > value? Take it out and connect the emitter directly to the MSP.
Also
> > put a 10k resistor between emitter and GND. That should work.
> >
> > Do you have a resistor connected between emitter and the LED? You
> > probably need it in order to limit the current through the LED.
> >
> > You could also connect the 24Vdc directly to the MSP throught a
100k
> > resistor if the grounds are the same.
> >
> > Michael K.
> >
> > --- In m..., "marcel_duo" wrote:
> > >
> > > Hi,
> > >
> > > I'm using MSP430F1222 and I have a problem with some of the
inputs
> that
> > > won't go back to off mode.
> > > I'm using an optocoupler to interface a 24vDC to the MSP430,
Vcc =
> 3v -
> > > > collector, the emitter -> (LED -> GND) and (510K ->MSP430).
> > > The thing is that some of the inputs are working just fine and
> turns on
> > > and off as anode of the optocoupler goes on and off and some of
the
> > > inputs just stuck in a "1" after the first time that they have
turned
> > > on.
> > >
> > > Can someone please advice me how to solve this problem.
> > >
> > > Thanks
> > > Marcel D
> > >
>

Reply by old_cow_yellow February 18, 20092009-02-18
Marcel,

The LED lights up when there is enough current going through it. But
the MSP430 input pin is sensing the voltage. Like Michael said, that
voltage may not be high enough even when the LED is on.

A resistor in series of the LED will reduce the current and raise the
voltage to the MSP430. If that is not bright enough, you can use two
LEDs in series instead of a resistor and one LED.

--OCY

--- In m..., "tintronic" wrote:
>
> Your connection is quite strange (at least what I understood from what
> you wrote). Use a tester and measure the voltage on the MSP input pin.
> My guess is that it is higher than Vin_low_max.
>
> What is the 510k supposed to accomplish and why do you use such a high
> value? Take it out and connect the emitter directly to the MSP. Also
> put a 10k resistor between emitter and GND. That should work.
>
> Do you have a resistor connected between emitter and the LED? You
> probably need it in order to limit the current through the LED.
>
> You could also connect the 24Vdc directly to the MSP throught a 100k
> resistor if the grounds are the same.
>
> Michael K.
>
> --- In m..., "marcel_duo" wrote:
> >
> > Hi,
> >
> > I'm using MSP430F1222 and I have a problem with some of the inputs
that
> > won't go back to off mode.
> > I'm using an optocoupler to interface a 24vDC to the MSP430, Vcc 3v -
> > > collector, the emitter -> (LED -> GND) and (510K ->MSP430).
> > The thing is that some of the inputs are working just fine and
turns on
> > and off as anode of the optocoupler goes on and off and some of the
> > inputs just stuck in a "1" after the first time that they have turned
> > on.
> >
> > Can someone please advice me how to solve this problem.
> >
> > Thanks
> > Marcel D
>

Reply by marcel_duo February 18, 20092009-02-18
Every time that the there is 24v on one side of the optocoupler the led
turns on and the MSP gets an ON signal.
The voltage on the MSP pin is 20mV when the input is "OFF" and 1.85v
when the input is "ON".
If not using any resistor on the emitter none of the inputs goes
to "OFF", I have tried to use 10K resistor and it's the same.
The current on the LED is 2mA.

Reply by tintronic February 18, 20092009-02-18
Your connection is quite strange (at least what I understood from what
you wrote). Use a tester and measure the voltage on the MSP input pin.
My guess is that it is higher than Vin_low_max.

What is the 510k supposed to accomplish and why do you use such a high
value? Take it out and connect the emitter directly to the MSP. Also
put a 10k resistor between emitter and GND. That should work.

Do you have a resistor connected between emitter and the LED? You
probably need it in order to limit the current through the LED.

You could also connect the 24Vdc directly to the MSP throught a 100k
resistor if the grounds are the same.

Michael K.

--- In m..., "marcel_duo" wrote:
>
> Hi,
>
> I'm using MSP430F1222 and I have a problem with some of the inputs that
> won't go back to off mode.
> I'm using an optocoupler to interface a 24vDC to the MSP430, Vcc = 3v -
> > collector, the emitter -> (LED -> GND) and (510K ->MSP430).
> The thing is that some of the inputs are working just fine and turns on
> and off as anode of the optocoupler goes on and off and some of the
> inputs just stuck in a "1" after the first time that they have turned
> on.
>
> Can someone please advice me how to solve this problem.
>
> Thanks
> Marcel D
>

Reply by marcel_duo February 18, 20092009-02-18
Hi,

I'm using MSP430F1222 and I have a problem with some of the inputs that
won't go back to off mode.
I'm using an optocoupler to interface a 24vDC to the MSP430, Vcc = 3v -
> collector, the emitter -> (LED -> GND) and (510K ->MSP430).
The thing is that some of the inputs are working just fine and turns on
and off as anode of the optocoupler goes on and off and some of the
inputs just stuck in a "1" after the first time that they have turned
on.

Can someone please advice me how to solve this problem.

Thanks
Marcel D