X10 RF Receiver

If these were X-10 RF codes the bytes would be two data bytes as detailed in the CM17A ... variations of 30-35% from nominal. So much for the ... separated by 40. PDF created with FinePrint pdfFactory trial version http://www.fineprint.com ...
65KB taille 30 téléchargements 311 vues
X10 RF Receiver Please review the "X10 RF Transmission Theory.htm" document for a complete discussion of the X10 RF Transmission Theory. The X-10 RF frequency can be one of three possible frequencies: 1. 310 MHz - "A" - North America 2. 418 MHz - "U" - Britain and Europe 3. 433.92 MHz - "E" - Europe Except for the difference in carrier frequencies, the RF protocol that X-10 uses for standard (i.e. non-security) X-10 RF devices is identical to the original NEC IR protocol which is widely used for IR remote controls. The data envelope for a typical NEC code is pictured below.

Figure 1: NEC IR Each code starts with a 9 msec burst of carrier followed by a 4.5 msec silence. This leader is necessary to set the ACG in the RF receivers which dynamically adapt to signal strength. After the leader, there are 32 bits with binary 1 represented by 2.25 msec between rising edges and binary 0 represented by 1.125 msec between rising edges. The rising edge of the 33rd and final pulse marks the end of the last bit and is followed by a silence of approximately 40 msec. Most X-10 RF transmitters send a minimum of five copies of the code separated by 40 msec silences although some can send single bursts. Instead of address and data bytes, X-10 sends two bytes of data with each byte followed immediately by its bitwise complement for error checking. Within each byte, bit7 is received first and bit0 last. In the pictured code above, in the order received, the first byte is 0110-0000, the second is 1001-1111, the third is 0000-0000, and the fourth is 1111-1111. After testing for bitwise complementarity, the two data bytes are 0110-0000 and 0000-0000 or 0x60 and 0x00. Since the illustration was taken from an explanation of IR codes, these represent a device and button for an IR code. If these were X-10 RF codes the bytes would be two data bytes as detailed in the CM17A protocol (see below) and would represent "A1 ON". The overall time to send one code, including the approximate 40 msec silence, is about 108 msec. Timings will vary from one transmitter to another but are repeatable for a specific transmitter. It appears, from articles on the 'net, that other people have seen a range from 95 msec to 116 msec for various transmitters and that standard X-10 transceivers can tolerate timing variations of 30-35% from nominal. So much for the specification. It's now time to start verifying the data. Figure 2 below shows that the X-10 RF Transmitter HR12A transmits six groups of the command code separated by 40 X10 RF Receiver.doc

Page 1 of 12

msec of silence. I'm not sure what the last 'burst' represents and I haven't been able to find out any thing about it.

Figure 2: A1ON 6 Copies

X10 RF Receiver.doc

Page 2 of 12

Figure 3 shows a single X-10 command code. This is the same command code shown in Figure 2. The length of the command code is approximately 68 msec which correlates with the specification value of 9.0 + 4.5 + 27 + 27 = 67.5 msec.

Figure 3: A1ON Total Time

X10 RF Receiver.doc

Page 3 of 12

Expanding the X-10 command code even further to see the leader, Figure 4, again confirms that the leader consists of a 9 msec carrier followed by 4.5 msec of silence before the first data bit appears.

Figure 4: A1ON Leader

X10 RF Receiver.doc

Page 4 of 12

Continuing on, Figures 5 and 6 show that the time values for a 0 bit (1.16 msec) and 1 bit (2.24 msec) also match the specification.

Figure 5: A1ON First Bit

Figure 6: A1ON Second Bit X10 RF Receiver.doc

Page 5 of 12

To decode the RF input, I'll use an interrupt and a 16-bit timer. One of the requirements that I'm hoping for is to read the timer value on each interrupt and then restart the timer. The timer increments every instruction cycle (Fosc / 4). Assume a clock frequency of 4 MHz. When divided by 4, this gives a working frequency of 1 MHz. Each bit of a 16-bit timer represents 1 usec. This gives a maximum count of 65356 usec or 65.356 msec. Since the largest time I need to detect is >= 40 msec this should work OK. There are four times that need to be detected: 1. 40 msec gap between commands. 40,000 ticks 2. 13.5 msec header. 13,500 ticks 3. 1.125 msec for a 'zero' bit. 1,125 ticks 4. 2.25 msec for a 'one' bit. 2,250 ticks When you add in a fudge factor or +/- 30% to the timing, the values become: 1. 40,000 +/- 30% 28,000 to 52,000 ticks 2. 13,500 +/- 30% 9,450 to 17,550 ticks 3. 1,125 +/- 30% 787 to 1,463 ticks 4. 2,250 +/- 30% 1,575 to 2,925 ticks As a note, for the 40 msec time I only need to compare to the bottom limit (28,000) or to see if a rollover occurred.

X10 RF Receiver.doc

Page 6 of 12

CM17A Protocol Bright and Dim transmissions. To brighten or dim a lamp, it is necessary to send consecutive signals (each equivalent to a 5% dim or brighten) until the desired level is attained. Data Table X-10 Command A1 ON A1 OFF A2 ON A2 OFF A3 ON A3 OFF A4 ON A4 OFF A5 ON A5 OFF A6 ON A6 OFF A7 ON A7 OFF A8 ON A8 OFF A9 ON A9 OFF A10 ON A10 OFF A11 ON A11 OFF A12 ON A12 OFF A13 ON A13 OFF A14 ON A14 OFF A15 ON A15 OFF A16 ON A16 OFF A BRIGHT 005 A DIM 005 C1 ON C1 OFF C2 ON C2 OFF C3 ON C3 OFF C4 ON C4 OFF X10 RF Receiver.doc

Bit 76543210 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100000 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100100 01100000 01100000 01000000 01000000 01000000 01000000 01000000 01000000 01000000 01000000

Bit 76543210 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000

X-10 Command B1 ON B1 OFF B2 ON B2 OFF B3 ON B3 OFF B4 ON B4 OFF B5 ON B5 OFF B6 ON B6 OFF B7 ON B7 OFF B8 ON B8 OFF B9 ON B9 OFF B10 ON B10 OFF B11 ON B11 OFF B12 ON B12 OFF B13 ON B13 OFF B14 ON B14 OFF B15 ON B15 OFF B16 ON B16 OFF B BRIGHT 005 B DIM 005 D1 ON D1 OFF D2 ON D2 OFF D3 ON D3 OFF D4 ON D4 OFF

Bit 76543210 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110000 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110100 01110000 01110000 01010000 01010000 01010000 01010000 01010000 01010000 01010000 01010000

Bit 76543210 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 Page 7 of 12

X-10 Command C5 ON C5 OFF C6 ON C6 OFF C7 ON C7 OFF C8 ON C8 OFF C9 ON C9 OFF C10 ON C10 OFF C11 ON C11 OFF C12 ON C12 OFF C13 ON C13 OFF C14 ON C14 OFF C15 ON C15 OFF C16 ON C16 OFF C BRIGHT 005 C DIM 005 E1 ON E1 OFF E2 ON E2 OFF E3 ON E3 OFF E4 ON E4 OFF E5 ON E5 OFF E6 ON E6 OFF E7 ON E7 OFF E8 ON E8 OFF E9 ON E9 OFF E10 ON E10 OFF E11 ON E11 OFF E12 ON E12 OFF E13 ON E13 OFF E14 ON X10 RF Receiver.doc

Bit 76543210 01000000 01000000 01000000 01000000 01000000 01000000 01000000 01000000 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000100 01000000 01000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000100 10000100 10000100 10000100 10000100 10000100 10000100 10000100 10000100 10000100 10000100

Bit 76543210 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000

X-10 Command D5 ON D5 OFF D6 ON D6 OFF D7 ON D7 OFF D8 ON D8 OFF D9 ON D9 OFF D10 ON D10 OFF D11 ON D11 OFF D12 ON D12 OFF D13 ON D13 OFF D14 ON D14 OFF D15 ON D15 OFF D16 ON D16 OFF D BRIGHT 005 D DIM 005 F1 ON F1 OFF F2 ON F2 OFF F3 ON F3 OFF F4 ON F4 OFF F5 ON F5 OFF F6 ON F6 OFF F7 ON F7 OFF F8 ON F8 OFF F9 ON F9 OFF F10 ON F10 OFF F11 ON F11 OFF F12 ON F12 OFF F13 ON F13 OFF F14 ON

Bit 76543210 01010000 01010000 01010000 01010000 01010000 01010000 01010000 01010000 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010100 01010000 01010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010000 10010100 10010100 10010100 10010100 10010100 10010100 10010100 10010100 10010100 10010100 10010100

Bit 76543210 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 Page 8 of 12

X-10 Command E14 OFF E15 ON E15 OFF E16 ON E16 OFF E BRIGHT 005 E DIM 005 G1 ON G1 OFF G2 ON G2 OFF G3 ON G3 OFF G4 ON G4 OFF G5 ON G5 OFF G6 ON G6 OFF G7 ON G7 OFF G8 ON G8 OFF G9 ON G9 OFF G10 ON G10 OFF G11 ON G11 OFF G12 ON G12 OFF G13 ON G13 OFF G14 ON G14 OFF G15 ON G15 OFF G16 ON G16 OFF G BRIGHT 005 G DIM 005 I1 ON I1 OFF I2 ON I2 OFF I3 ON I3 OFF I4 ON I4 OFF I5 ON I5 OFF I6 ON I6 OFF X10 RF Receiver.doc

Bit 76543210 10000100 10000100 10000100 10000100 10000100 10000000 10000000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100000 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100100 10100000 10100000 11100000 11100000 11100000 11100000 11100000 11100000 11100000 11100000 11100000 11100000 11100000 11100000

Bit 76543210 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000

X-10 Command F14 OFF F15 ON F15 OFF F16 ON F16 OFF F BRIGHT 005 F DIM 005 H1 ON H1 OFF H2 ON H2 OFF H3 ON H3 OFF H4 ON H4 OFF H5 ON H5 OFF H6 ON H6 OFF H7 ON H7 OFF H8 ON H8 OFF H9 ON H9 OFF H10 ON H10 OFF H11 ON H11 OFF H12 ON H12 OFF H13 ON H13 OFF H14 ON H14 OFF H15 ON H15 OFF H16 ON H16 OFF H BRIGHT 005 H DIM 005 J1 ON J1 OFF J2 ON J2 OFF J3 ON J3 OFF J4 ON J4 OFF J5 ON J5 OFF J6 ON J6 OFF

Bit 76543210 10010100 10010100 10010100 10010100 10010100 10010000 10010000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110000 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110100 10110000 10110000 11110000 11110000 11110000 11110000 11110000 11110000 11110000 11110000 11110000 11110000 11110000 11110000

Bit 76543210 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 Page 9 of 12

X-10 Command I7 ON I7 OFF I8 ON I8 OFF I9 ON I9 OFF I10 ON I10 OFF I11 ON I11 OFF I12 ON I12 OFF I13 ON I13 OFF I14 ON I14 OFF I15 ON I15 OFF I16 ON I16 OFF I BRIGHT 005 I DIM 005 K1 ON K1 OFF K2 ON K2 OFF K3 ON K3 OFF K4 ON K4 OFF K5 ON K5 OFF K6 ON K6 OFF K7 ON K7 OFF K8 ON K8 OFF K9 ON K9 OFF K10 ON K10 OFF K11 ON K11 OFF K12 ON K12 OFF K13 ON K13 OFF K14 ON K14 OFF K15 ON K15 OFF K16 ON X10 RF Receiver.doc

Bit 76543210 11100000 11100000 11100000 11100000 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100100 11100000 11100000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000000 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100 11000100

Bit 76543210 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000

X-10 Command J7 ON J7 OFF J8 ON J8 OFF J9 ON J9 OFF J10 ON J10 OFF J11 ON J11 OFF J12 ON J12 OFF J13 ON J13 OFF J14 ON J14 OFF J15 ON J15 OFF J16 ON J16 OFF J BRIGHT 005 J DIM 005 L1 ON L1 OFF L2 ON L2 OFF L3 ON L3 OFF L4 ON L4 OFF L5 ON L5 OFF L6 ON L6 OFF L7 ON L7 OFF L8 ON L8 OFF L9 ON L9 OFF L10 ON L10 OFF L11 ON L11 OFF L12 ON L12 OFF L13 ON L13 OFF L14 ON L14 OFF L15 ON L15 OFF L16 ON

Bit 76543210 11110000 11110000 11110000 11110000 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110100 11110000 11110000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010000 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100 11010100

Bit 76543210 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 Page 10 of 12

X-10 Command K16 OFF K BRIGHT 005 K DIM 005 M1 ON M1 OFF M2 ON M2 OFF M3 ON M3 OFF M4 ON M4 OFF M5 ON M5 OFF M6 ON M6 OFF M7 ON M7 OFF M8 ON M8 OFF M9 ON M9 OFF M10 ON M10 OFF M11 ON M11 OFF M12 ON M12 OFF M13 ON M13 OFF M14 ON M14 OFF M15 ON M15 OFF M16 ON M16 OFF M BRIGHT 005 M DIM 005 O1 ON O1 OFF O2 ON O2 OFF O3 ON O3 OFF O4 ON O4 OFF O5 ON O5 OFF O6 ON O6 OFF O7 ON O7 OFF O8 ON O8 OFF X10 RF Receiver.doc

Bit 76543210 11000100 11000000 11000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000100 00000000 00000000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000

Bit 76543210 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000

X-10 Command L16 OFF L BRIGHT 005 L DIM 005 N1 ON N1 OFF N2 ON N2 OFF N3 ON N3 OFF N4 ON N4 OFF N5 ON N5 OFF N6 ON N6 OFF N7 ON N7 OFF N8 ON N8 OFF N9 ON N9 OFF N10 ON N10 OFF N11 ON N11 OFF N12 ON N12 OFF N13 ON N13 OFF N14 ON N14 OFF N15 ON N15 OFF N16 ON N16 OFF N BRIGHT 005 N DIM 005 P1 ON P1 OFF P2 ON P2 OFF P3 ON P3 OFF P4 ON P4 OFF P5 ON P5 OFF P6 ON P6 OFF P7 ON P7 OFF P8 ON P8 OFF

Bit 76543210 11010100 11010000 11010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010000 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010100 00010000 00010000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000 00110000

Bit 76543210 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 Page 11 of 12

X-10 Command O9 ON O9 OFF O10 ON O10 OFF O11 ON O11 OFF O12 ON O12 OFF O13 ON O13 OFF O14 ON O14 OFF O15 ON O15 OFF O16 ON O16 OFF O BRIGHT 005 O DIM 005

X10 RF Receiver.doc

Bit 76543210 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100100 00100000 00100000

Bit 76543210 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000

X-10 Command P9 ON P9 OFF P10 ON P10 OFF P11 ON P11 OFF P12 ON P12 OFF P13 ON P13 OFF P14 ON P14 OFF P15 ON P15 OFF P16 ON P16 OFF P BRIGHT 005 P DIM 005

Bit 76543210 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110100 00110000 00110000

Bit 76543210 00000000 00100000 00010000 00110000 00001000 00101000 00011000 00111000 01000000 01100000 01010000 01110000 01001000 01101000 01011000 01111000 10001000 10011000

Page 12 of 12