Chris Wells’ Technical Expression Page

May 12, 2006

The LogoChip and the DVD players

Filed under: Final Project — michaelangelo3 @ 9:10 pm

Note: If you need a refresher or orientation on transistors, spend a few minutes getting to know transistors and learning how to use transistors as a switch and you will be more than qualified to follow along.

Parts referenced: NPN transistor – 2N3904. PNP transistor – 2N3906. Microrelay – 275-232.

Now we're ready to interface the DVD players with the LogoChip. First things first, we assembled the basic LogoChip circuit as defined in the Getting Started with LogoChip document. After familiarizing ourselves with it, we found that ports B0-B7 can be used as outputs. In other words, we can tell the LogoChip to send a positive signal (approx. +5V) to a specified output specific within our code, like this:

to powerup
write portb-ddr 0
end This preceeding code is necessary to set ports B0-B7 as outputs upon powering up the logochip.

to powerdvdparent
setbit 0 portb
mwait 1000
clearbit 0 portb
end

This tells the logochip to make a new command called "powerdvdparent." It then sets port B0 to a 1, which sends +5V out of it to anything connected to it. It then waits 1 second before moving to the next line of code. The next line tells the logochip to clear port B0 to a 0, which is 0V. End tells the logochip it is at the end of the new command.Our plan is to use ports B0-B3 for the four functions of the parent DVD player and ports B4-B7 for the children's DVD player. So we will connect port B0 to a resistor (an obstacle of its own) which will be connected to the base of our NPN transistor which has wires from contacts C and Z from the DVD player circuit board connected to the emitter and collector respectively. We will do likewise for the play command. The stop command needs to be longer so instead of waiting only one second, we wait three, so that we get that long, hard stop that will reset the DVD player to the beginning of the DVD. Specifically:

to playdvdparent
setbit 1 portb
mwait 1000
clearbit 1 portb
end

to stopdvdparent
setbit 2 portb
mwait 3000
clearbit 2 portb
end

We had problems with the forward function. We thought we could connect contact H to the collector and E to the emitter, thinking ground should be the contact to which the current flows. But that didn't work. We thought maybe the switch doesn't like have current pushed across it, so we switched the NPN out for a PNP, thinking the transistor would pull the current through the transistor to ground. So we connected H to the emitter and E to the collector and altered the code, because PNP's require a low (or a zero) on the base to activate, opposite of the NPN's. It looked like this:

to powerup
write portb-ddr 0
setbit 3 portb ;we need to add this to the powerup script so that port B3 is set high
end

to forwarddvdparent
clearbit 3 portb
mwait 150 ;we want a short signal so that it will go to the next chapter, not fast forward
setbit 3 portb
end

Yeah, that didn't work, either. I knew all along what we would have to do if we couldn't get the transistor to activate the fwd function; we would have to go buy a couple micro-relays. The reason is relays don't push or pull extra current across the contacts; it's simply a remote- controlled switch. So even though I didn't know what exactly was going on across the contacts of the fwd switch, I could still replicate it. I went to RadioShack, got a couple and wired them up and changed our code back to be more similar to the other functions. Yep, they worked. Here's the code for the fwd function:

to forwarddvdparent
setbit 3 portb
mwait 150
clearbit 3 portb
end

And here's our wiring diagram (to be added to a complete basic LogoChip circuit):

Photobucket - Video and Image Hosting

You'll notice a diode connected to the coil of each relay. This keeps current from entering the circuit through the "back door" after the relay is no longer activated.

Our code for the children's DVD player, like the schematic, is pretty much symmetric:

to powerdvdchild
setbit 7 portb
mwait 1000
clearbit 7 portb
end

to playdvdchild
setbit 5 portb
mwait 1000
clearbit 5 portb
end

to stopdvdchild
setbit 6 portb
mwait 3000
clearbit 6 portb
end

to forwarddvdchild
setbit 4 portb
mwait 150
clearbit 4 portb
end

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.