|
|
View previous topic :: View next topic |
Author |
Message |
peters Guest
|
X10 dimming with PIC |
Posted: Tue May 21, 2002 6:21 am |
|
|
Hi all.
<p>
I'm currently trying to get some X10 stuff working with a PIC project I'm doing.
<p>
I'm controlling a standard lamp module (LM12, 220v in UK) with an XM10U (apparently the same as the TW523), connected to a 16F877, using the standard X10 library supplied with CCS C.
<p>
I can do most things, turning modules on and off etc, but I can't get a quick dim. I can dim and bright one step at a time (all 200 odd of them, and this takes ages).
<p>
When we've tried this in the past with the PC version (CM11 or 12), the dimming is as fast or slow as we like. I've not actually done this, so I'm not sure if the lamp module is the same.
<p>
I've done a lot of searching, and as far as I can tell, I <em>should</em> be able to dim using extended codes. I've got the extended code document from the X10 website, and it certainly seems to have some dimming functionality in there.
<p>
My questions are :
<p>
Does anyone know if this lamp module (LM12) is cabable of receiving extended codes. I know it's capable of dimming quickly, because we've found an RF receiver, and it's capable of dimming on to off over 5 seconds or so.
<p>
If it <em>is</em> capable of receiving extended codes, can someone tell me which ones? (As far as I can tell, it's extended code, with command 3/1, and data 01-3F to set brightness (sort of ;-)
<p>
If it's <em>not</em> capable of receiving extended codes, does someone know how to dim it quickly?
<p>
Many thanks,
<p>
Pete.
___________________________
This message was ported from CCS's old forum
Original Post ID: 4485 |
|
|
peters Guest
|
Re: X10 dimming with PIC |
Posted: Tue May 21, 2002 7:29 am |
|
|
Following up to myself...
I've made a new routine, the core of which is
x10_write_extended(byte house_code, byte key_code, byte data, byte command)
x10_write_bits(7,4,1);
x10_write_bits(house_code,4,0);
x10_write_bits(X10_EXTENDED_CODE,5,0);
x10_write_bits(key_code,4,0);
x10_write_bits(data,8,0);
x10_write_bits(command,8,0);
(X10_EXTENDED_CODE is 0b11110). There is no end of message transmission. I've tried with and without, no change.
It's called by
x10_write_extended(house_code, key_code,0b11111100, 0b10001100);
x10_write_extended(house_code, key_code,0b10000000, 0b10001100);
and
x10_write_extended(house_code, key_code,0x3f, 0x31);
x10_write_extended(house_code, key_code,0x01, 0x31);
Neither of these actually work. The light on the OEM module flashes, but the lamp module doesn't actually do anything. The same devices respond to a standard light on/light off command, same code, same hardware.
Can anyone help?
Many thanks,
Pete.
___________________________
This message was ported from CCS's old forum
Original Post ID: 4486 |
|
|
peters Guest
|
Re: X10 dimming with PIC |
Posted: Wed May 22, 2002 3:07 am |
|
|
Replying to myself <strong>again</strong>!
Problem solved. The reason the standard DIM didn't work, was because the CCS X10 implementation _always_ enforced the 3 cycle delay between transmissions.
I also didn't know how to dim properly. (Even now I know how, I still can't find any docs to tell me this is how it's done!). I was sending lots of DIMs, when I only needed to send 2!
Pete.
___________________________
This message was ported from CCS's old forum
Original Post ID: 4503 |
|
|
Onur
Joined: 11 Apr 2004 Posts: 11
|
Tw523 |
Posted: Fri Apr 22, 2005 5:00 am |
|
|
I have 2 tw523 module.. I want to send some of data using these devices
if I use this device like rs232 it will be great..
(I have 220V 50Hz version)
how can I do? Thank you.. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 22, 2005 12:52 pm |
|
|
Quote: |
I have 2 tw523 module.. I want to send some of data using these devices
if I use this device like rs232 it will be great.. |
Do you have the CCS compiler ? The compiler comes with a X10
example file for the TW523. Here is part of the file description:
Quote: | //// EX_X10.C
//// This program interfaces a X10 TW523 unit to RS-232. |
The example file uses the CCS driver file for the TW523, called X10.C
Look in these folders to find those two files:
c:\Program Files\Picc\Examples
c:\Program Files\Picc\Drivers |
|
|
Onur
Joined: 11 Apr 2004 Posts: 11
|
tw |
Posted: Fri Apr 22, 2005 4:11 pm |
|
|
I Tryed These codes but I failed.(maybe I had a mistake.) I want to know
can I use 2 tw523 device for sendind and receiving data
I know tw523 two way interface.. if somebody test it I can learn to him.. |
|
|
Onur
Joined: 11 Apr 2004 Posts: 11
|
|
Posted: Sun Apr 24, 2005 5:50 am |
|
|
sender pic code
Code: |
#include <16F84A.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#include <x10.c>
void main() {
output_low(pin_b5);
while(1){
x10_write('A',5);
delay_ms(100);
}
}
|
receiver pic code
Code: |
#include <16F84A.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#include <x10.c>
char house_code;
BYTE key_code;
void main() {
output_low(pin_b5);
while(x10_data_ready()){
x10_read(&house_code, &key_code);
if (house_code=='A'){
output_high(pin_b5);
delay_ms(500);
}
}
}
|
if something is wrong please say to me.. Thank you.. |
|
|
Onur
Joined: 11 Apr 2004 Posts: 11
|
|
Posted: Sun Apr 24, 2005 4:27 pm |
|
|
I added B0 to 2K2 ohm pull up.. now I can send x10 data.. sender tw523 led flashing and receiver tw523 flashing but I cant take data using receiver code.. now I'm working about..
sender
Code: |
#include <16F84A.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#include <x10.c>
#USE Fast_IO(B)
void main() {
SET_TRIS_B( 0b00000011 );
while(1){
output_low(pin_b5);
delay_ms(500);
x10_write('A',5);
output_high(pin_b5);
delay_ms(500);
}
}
|
receiver
Code: |
#include <16F84A.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#USE Fast_IO(B)
#include <x10.c>
char house_code;
BYTE key_code;
void main() {
SET_TRIS_B( 0b00000011 );
output_low(pin_b5);
while(x10_data_ready()){
output_low(pin_b5);
x10_read(&house_code, &key_code);
if (key_code==5){
output_high(pin_b5);
delay_ms(500);
}
}
}
|
|
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sun Apr 24, 2005 5:32 pm |
|
|
If my memory serves me correctly the TW523 DOES NOT support extended codes. The TW523 has a PIC programmed only to recognize the standard codes.
SMARTHOME has one that will though..
www.smarthomeusa.com |
|
|
Onur
Joined: 11 Apr 2004 Posts: 11
|
|
Posted: Sun Apr 24, 2005 5:55 pm |
|
|
maybe you are right .. I'm beginner of x10..
but If I remove code detect ic at receiving ciruit. I think we can receive any msj using this device... I saw sometihing on the web. |
|
|
picprogrammer
Joined: 10 Sep 2003 Posts: 35
|
|
Posted: Tue Dec 05, 2006 8:24 am |
|
|
Hello, i see peters has a lot of experiance with: X10 dimming with PIC
Can someone post an example how to dim and switch using the X10 interface.
thx. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|