Skip to content
/ hx2262 Public

This small lib emulates the behavior of the hx2262 (pt2262) encoder chip which is often used in R/C Power Outlets

License

Notifications You must be signed in to change notification settings

flo90/hx2262

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HX2262 LIB

This is just a very small lib to emulate the HX2262 (PT2262) remote encoder chip
which is often used in R/C power outlets.

The HX2262 serialize a 12 bit codeword. Remember that every bit has 3 states.
The first 2 states are the classic binary states 1 and 0.
The third state is 'floating', this means the address pin of the chip is just not connected.

For example some power outlets use a DIP switch which connects the address pins to ground (0) or lets them
unconnected (f).

How to use?

Copy the files or the whole folder to your project and execute the hx2262_init(...);
As parameter assign 3 function pointers. The first two are enabletx and disabletx.

These functions should just enable and disable the transmitter.

The third function pointer refers to a clk_periode function.

OLD (dont use this):

In clk_periode you have to implement a delay which is i * clockperiode long.
By default in many R/C power outlets the clock periode takes 100us.

NEW:
To reduce clk_periode() call overhead i decide to divide the signal by 4.
Now you have to implement i * clockperiode but one clock period takes 
4*100us=400us now.

After you have implemented the 3 functions you can use the lib.

Until now you have two options to use the lib:

Firstly you use hx2262_send(...). With this function you have full control of the signal generation.
You can set all 12 bits as you like.

Secondly you can use the more specialized function hx2262_elroab440_send(...). This function generate the 12 bits
specially for the elroab440 series power outlets. This function expect a 10 digit long code which only have 1 and 0.
To determine the code just open the backplate of one power outlet and look how the positions of the switches are.
If a switch is up then you write a 1 if the switch is down you write a zero.
A valid code looks like this: "1010010100"

About

This small lib emulates the behavior of the hx2262 (pt2262) encoder chip which is often used in R/C Power Outlets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published