View Full Version : X-10
Travin77
- 11th March 2006, 09:28
Does anyone know how to properly connect the PL-513 to a pic. The PBP manual says 4 connections are required but only 2 pins are used which I assume are zero crossing output wire 1 and x-10 transmit input wire 4. I have tried hooking a 4.7k resistor to 5 volts on all wires, and it didn't work. thanks for all the support. Hopefully I will be able to provide it at some time in the distant future.
muddy0409
- 11th March 2006, 11:13
You only really need 3 wires. 0v, ZeroCrossing & Data.
The diagram in the manual is correct. Just make sure if you are using a ready made 4 core phone lead that has 2 RJ12 plugs, that the wiring is " Straight Thru'". You can confirm this by holding both flugs side by side, both the same way up and look at the colour of the wires from left to right. They should be in the same order.
Oh yeah, you should also have a 4k7 or 10k pull-up on the zero crossing pin on the PIC.
Travin77
- 12th March 2006, 19:32
Alright. I swear I tried everything. Maybe I don't understand what you are saying to do. Here is my setup:
PBP with melabs usb programer
16f876a pic w/20 mhz resonator
X-10 data pin is Portc.6 (yellow phone wire #4)
Zero crosing pin output from pl513 to pin porta.3 (black phone wire #1) I also connect a 4.7k resistor from this pin to +5v
wires 2 and 3 are tied to ground (this is the part I am not sure about)
I have two buttons as an input to tell the pic to turn unit on and off.
I have the X-10 plug set at D for the house code and 5 for the unit code.
Here is the program used:
include "MODEDEFS.BAS"
define LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_BITS 8
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 1
DEFINE LCD_lines 4
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
define OSC 20
define PULSIN_MAX 500
trisa = 0
trisb = 0
adcon1=7
input portc.3
input portC.4
'--------------------------------------------
CHNG VAR portc.3 ' Increment button
SETIN VAR portC.4 ' Set button
pause 2000
LCDout $fe,1
Main:
if Chng = 0 then
XOUT PORTc.6,PORTa.3,[5\5,5\uniton]
LCDOUT $FE,1,$fe,$D4,"UNIT IS ON"
endif
if setin = 0 then
xout portc.6,porta.3,[5\5,5\unitoff]
LCDOUT $FE,1,$fe,$D4,"UNIT IS OFF"
endif
goto main
end
When I push either button, the little light on the pl513 goes out for a second or two and then comes back on. I am just not sure what else to try. Thanks for the help.
mister_e
- 12th March 2006, 20:05
i can't really help 'cause i've never ever messed with any x-10 stuff but maybe the following Microchip's appnote may help
http://ww1.microchip.com/downloads/en/appnotes/00236a.pdf
muddy0409
- 13th March 2006, 00:58
Hello again.
It's a bit difficult for me to help ATM as all my gear and books are packed away ready to move house, so I gotta go by memory.
The way I see it, if the red led is blinking on the transmitter module then it is seeing some data. So far so good.
The trouble I had was making sure the house code was right. Codes A to P are equal to 0 to 15 and not 1 to 16 which was where I mucked myself up for a while. Your house code is "D" so that is equal to "3" and I think you are sending as "5". The easiest thing to check is to set the house code on the receiving module at A and send it something, without changing your program, and if nothing switches, set the module to B and go through the settings right thru to P and see if that makes a difference.
I've just had a look at my program, but without the manual to look at I can't remember what the variables are or the correct setup of the X
OUT command so that's not much help huh?
Anyway, it seems to me that the transmitter is getting data from your PIC so I would make a little bet that the house code is part (if not all) of the problem. PS have you told your program that you are running at 20MHz? Try running at 4 and see what happens.
I'm gunna be off the air for a couple of weeks at least, so I can only wish you all the best and I'll check the forum out as soon as I am back on.
My send line is XOUT datapin,zeropin,[house\index\2,house\%11010] and yours is xout portc.6,porta.3,[5\5,5\unitoff] so muck around with the syntax of yours and compare them. (Mine does work perfectly BTW).
[house\index\2,house\%11010] translates to [housecode\unitcode\2,housecode\unit off] from memory the 2, represents number of send each command, or similar.
Anyway, all the best, and I'll catch up with you in a cuppla weeks or so.
Travin77
- 13th March 2006, 23:04
It didn't work. I have no idea what I am doing wrong. The led doesn't blink it only goes out and then comes back on.
ardhuru
- 14th March 2006, 06:45
Hi,
For the XOUT lines you have shown in the code, I think your module would respond if set to F6, and not D5. So, either change the module address to F6, or change the XOUT command to XOUT PORTc.6,PORTa.3,[3\4,3\uniton] keeping the module at D5
Hope this works!
Regards,
Anand
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.