The datasheet for the PT2262 doesn't provide any description of the communication protocol so, for starters, you will need to capture a few (different) codes and analyze them. This page shows how. http://davehouston.net/learn.htm
The datasheet for the PT2262 doesn't provide any description of the communication protocol so, for starters, you will need to capture a few (different) codes and analyze them. This page shows how. http://davehouston.net/learn.htm
I found another datasheet that does describe the protocol used by this chip. While the specifics for a "1", "0", and "F" differ from Holtek, the overall approach is very similar to the HT640. A bit period depends on the encoder oscillator frequency (set by an external resistor) you still need to capture some codes to determine the bit period. And there are some encoder pins that can be used either in the address or in the data so you'll need to determine that, also. Then you should be able to adapt Bruce's HT640 code to work with the PT2260.
Any ideas (Bruce's code for HT640) if this will work if HT640 is used with other RF modules, like the normal el chipo style?
I will give it a go to decode PT2262 soon.
I tried to decode a UM3750/MM53200/HT12 type encoder with this either as subroutine or as Interrupt Driven Routine:
But I got a delay in decoding. It just gets one every 4 transmissions. So for a 4 times check of equall transmitted codes, it takes more than 250ms to give a valid. With the Logic Digital Analyser it is confirmed that it takes 1st transmission, then 4th etc.Code:GET_CODE: PULSIN DIN,0,NUMS IF NUMS > 8200 and NUMS<12000 then 'Detect Header goto get_pulses else RETURN endif get_pulses: FOR X = 0 TO 11 ' read 12 pulses PULSIN DIN,1,NUMS ' if NUMS>220 then if NUMS<300 then code.0[x]=1 endif endif if NUMS>450 then if NUMS<560 then code.0[x]=0 endif endif if NUMS=0 then loops=0:code=0:flag=0 RETURN ' temp=0: endif next x if loops<3 then if prev_code=code then loops=loops+1 else prev_code=code loops=0 endif endif return
The numbers in NUM are PIC and OSC clock dependant.
If anyone can spot why, please reply.
Ioannis
What var size is NUM?
Dave
Always wear safety glasses while programming.
Word sized.
It does work but gets one every 4th. Very strange...
I have not here the Logic. In the afternoon I will post a shot of the pulses to make it more clear.
The posted routine was tested also as part of Darrels DT-INTs on a fast 16F1827 chip at 32MHz clock.
Ioannis
Ioannis, not sure what you mean by gets one every 4th. The way I understand your statement is that you get a valid pulse once in 4 transmissions. If that is correct, the code which does that is the loops part. if loops < 3 then ..... When it finds a code 'repeated' 4 times, it transfers to the Prev_code. Is that what you're looking for??
Bookmarks