![]() | ![]() | ![]() |
| | |||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hello, this is my first post, and my first PIC circuit. My experience with electronics is quite small... when I was a child I had an 100-in-1 electric experiments kit which taught me the foundations but not much more. Anyway I've designed a control device using a 16F871 PIC that interfaces to a PC through an EPP printer port. The purpose of the device is to send commands to an LCD controller such as a SED1335 (in my case a Densitron LM6733) or just as easily a KS0107 or HD44780 (by rewriting the PIC software). The PIC also accepts input from in IR receiver which is used to monitor RC5 remotes, and has an input for the PC ATX Power Button, it also has two LED outputs and a reed-relay switch output which will be connected to the motherboards power button connector on the motherboard its self. The PIC will be programmed to monitor the EPP interface, the IR Receiver and the power button. The EPP interface provides two sets of 8bit information, either an address byte or a data byte, both of which can both be sent and received from the PC. When an address byte is received the PIC will store it into a "next address" register, and when it receives a data byte it will perform some task using the data byte and the address byte. For example the address byte may mean PORTD which is the output port connected to the LCD Data lines, details to be worked out. The PIC when monitoring the IR receiver will attempt to process any signal it receives into an RC5 remote control data byte indicating the button pressed and send this information to the PC through the parallel port. It can be programmed to store the code for the powerbutton on your remote and saves that value in its EEPROM memory so that it will not loose it on power off. It will also be programmed to turn the PC on and off using the remote by pulsing the relay that is connected to the motherboard power switch connector. It can draw power from the Wake-on-lan header as well as the standard motherboard 12,G,G,5 connectors. Finally the PIC has an output pin that can be used to enable and disable to backlight inverter on compatible inverters. It has jumpers to control enable this feature (alternative is always on), and for selecting either 12v or 5v for the inverters power. The design is loosly based on the design at http://www.tb-electronic.de/vdr/ir_controller.html . Details of the EPP spec I used for reference are here: http://www.beyondlogic.org/epp/epp.htm#2 I would like for any more experienced experts to have a look at my design, see what is missing or if i've made any fatal assumptions. What you think of the design, whether or not you think it will work, any improvements or additions you can think of would also be greatly appreciated. I have attatched a JPG of the schematic done in Eagle. If anyone wants i'll provide the Eagle file. Here are the details of the signals connected to the PIC: PIN I/O Destination (/ means active low) MCLR I EPP /RESET signal RA0 O LCD /RD Signal RA1 O LCD /WR Signal RA2 O LCD A0 Signal RA3 O LCD /CS Signal RA4 O LCD /RESET Signal RA5 O Backlight enable RB0 I EPP /WRITE signal RB1 O EPP /WAIT signal RB2 O EPP INTERRUPT signal RB3 PULLED DOWN to ensure PGM remains disabled RB4 I EPP /DATASTROBE signal RB5 I EPP /ADDRESSSTOBE signal RB6 I POWER BUTTON IN (connects to power button on pc case) RB7 I IR RECEIVER INPUT (connects to ir receivers signal line) RC0...7 IO EPP DATA LINES RD0...7 IO LCD DATA LINES RE0 O LEDA enable RE1 O LEDB enable RE2 O POWER BUTTON OUT (enables relay that connects to mb power connector) | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| well i never really considered using the serial port although looking at the chip RC6/7 are also TX/RX lines for the chip, it would certainly free up several pins that i could use for other control purposes, maybe add a few push buttons to the design, or attatch a potentiometer to one of the ADC lines and use it as a volume knob which the PIC could send volume control information to the PC. The reason i chose parallel is simply because in my mind it made the software easier to program the PIC, but I am a competant programmer (although never programmed a PIC before) so using the serial port would not be too much more trouble for me. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) | |
| Quote:
With regards to EPP on the PC, sending data to the port as "EPP Data" is simply a matter of doing outbp(LPTBASE + 4, Data), and to send "EPP Address" is simply outbp(LPTBASE + 3, Data). On the PIC side, its simply a matter of waiting for /WRITE to go low, waiting for /DS or /AS to go low, reading the Data port, then pulsing /WAIT high. As an aside, do you think that i could combine the powerbutton in and out signals connecting them to one pin instead of two, using a set of diodes connected in opposite directions to isolate the input and output circuits from the PIC like: PB IN -----|>|-----+----- PIC PIN PB OUT ---|<|-----+ | ||
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Just a note, you don't generally need a relay to pulse the power button pins on a motherboard; on every one I've used, one of the two pins is ground, and you simply need to pull the other pin to ground. something as simple as a cheap NPN transistor (such as 2N3904) and a base resistor is enough to do the job, and much smaller and more convenient than a relay. Also, if you're not too familiar with using PICs, that's an awful lot to get working all at once. at the very least, you should definitely work on the programming in stages; first get it to flash an LED, then try getting the serial interface working, and then move on to things like the LCD, IR interface, or using EEPROM. It would not be a bad idea for you to start off by doing some unrelated, simple example projects to get yourself familiar with all aspects of using PICs.
__________________ EEgeek.net | |
| |
| | (permalink) |
| It might be a good idea to either diode-or the 5V lines from the two power supplies so that the WOL power supply doesn't backfeed into the normal 5V from the molex connector. Might want a pull-up resistor on the button unless you plan on using the internal pull-ups on the PIC. Some LCDs require a contrast adjustment pot, so you might want to have some space on the board to throw one of these on in case you switch to a 14 pin character display. I've never used a Densitron display so I don't know if it's required. Otherwise, I'd concur on the serial port and the NPN for the power switch (after double checking the MB of course). James | |
| |
| | (permalink) | |||
| Quote:
+5V-------|>|---+------ STBY------|>|---+ Quote:
Quote:
So everyone thinks I should use a serial interface instead? Thats ok, in some respects better as I could use the on board internal IR header as a serial port so that the device doesnt have any external cables going out of the case to the lpt port. Are there any porblems with using the IR header instead of a serial port when interfacing the PIC? | ||||
| |
| | (permalink) | ||
| Quote:
Nearly every cheap character LCD needs an adjustment pot, but if the chances of you needing to attach one are rare... Quote:
I've never tried using the IR header - I'd imagine the voltage levels are TTL/CMOS, but you'll have to check it out. Be careful to not enable actual IRDA modes since I'm not sure if the IRDA modulation is done in the chipset or by the external module. (IRDA has a odd "3/16 encoding", and isn't the same as standard RS232. If you are going to bit-bang the communications, you can work around it though.) Otherwise I thought nearly every motherboard nowadays had a serial port header on board(if not two) since they never populate both connectors on the back any more. James | |||
| |
| | (permalink) |
| I agree the relay isn't necessary for a PC power switch. But, if you do plan to use a relay, the way you have it in your schematic won't work and may blow the pin. A pic output pin can only source/sink 25 mA. I'm pretty sure your relay will pull more than that. use a simple npn transistor driven by the pic on the serial vs parallel. do what you feel comfortable with. I, personally, would go for serial over parallel but that does require that you spend more effort on the pic and pc defining and implementing a "command set". with the parallel port, you just have to look for a specific pin being set or cleared. with serial you have to look for specific on or off commands. However, if you are communicating text that will be displayed on the LCD, the the serial interface is going to be easier (since it's a character/byte based interface). | |
| |
| | (permalink) | ||
| Quote:
Quote:
in terms of programming in general i'm a very confident and capable in terms of normal programming languages and concepts, and have had a large amount of experience (by most programmers of my ages standards) in assembly language for various machines so i'm not particularly worried about programming the pic, besides there's plenty of examples on the web that i can use to help me on my way. | |||
| |
| | (permalink) | |
| Quote:
But if you're happy with parallel?, it's your project!. | ||
| |