PDA

View Full Version : Holtek Encoder HT6P20



picdev
- 25th July 2005, 20:41
Hello for everybody.

My name is Carlos, and I writing from Brazil.
This is my first time in this forum, and I would like to anticipate my excuses for my poor English.

Well, my problem is:
How can I decode the HT6P20B of efficient form with PBP?

Certain time, I used the code below to decode the HT12E, but this code is very slow and not very efficient, and the HT6P20B has more code bits that the HT12E .




'------------
'Variables

IRCONT VAR BYTE
BITVALUE VAR BYTE
DEVICECODE VAR BYTE
DEVICEDATA VAR BYTE
IRIN VAR PORTA.1


'------------------
LEIR:

DEVICECODE = 0
DEVICEDATA = 0

BITVALUE = 0
PULSIN IRIN,0,BITVALUE

IF BITVALUE > 150 THEN

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.7 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.6 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.5 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.4 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.3 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.2 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.1 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICECODE.0 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICEDATA.0 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICEDATA.1 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICEDATA.2 = BITVALUE

BITVALUE = 0
PULSIN IRIN,1,BITVALUE
GOSUB TESTABIT
DEVICEDATA.3 = BITVALUE

ENDIF

RETURN

'-------------
TESTABIT:

IF BITVALUE > 60 THEN
BITVALUE = 0
ELSE
BITVALUE = 1
ENDIF

RETURN
'--------------


Thank you, and again, sorry for my english.

Carlos

picdev
- 8th August 2005, 18:04
Hello....
If someone have interest in HT6P20B decoding, feel free to use the code below.
Is ugly to see, but works fine.
And if someone help me to let this code more short and clean, antecipately thanks.

Carlos W. Rett

________________________________________________
INCLUDE "BS2DEFS.BAS"
DEFINE CHAR_PACING 1000 'Serout character pacing in us
DEFINE PULSIN_MAX 6200
DEFINE OSC 20 'Oscilator Speed

ADCON1 = 7 ' Set PORTA and PORTE to digital

';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
'Define nome de variáveis

BITVALUE VAR WORD
ADDRESS VAR WORD
CODE VAR BYTE
BTRES VAR BIT
IRIN1 VAR PORTA.0
SERPC VAR PORTA.1

pause 100
CLEAR 'Clear All Variables

';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
'Port Adjust

TRISA = %11111101 'PortA Adjusted .

SEROUT2 SERPC,16390,["--Program initialized--",13,10] 'SERIAL Speed = 38400

Start:
CLEAR
PULSIN IRIN1,0,BITVALUE
IF (BITVALUE > 5400) and (bitvalue < 6100) THEN
Goto LEDADOS
else
goto Start
endif


LEDADOS:
GOSUB TESTABIT
ADDRESS.15 = BTRES
GOSUB TESTABIT
ADDRESS.14 = BTRES
GOSUB TESTABIT
ADDRESS.13 = BTRES
GOSUB TESTABIT
ADDRESS.12 = BTRES
GOSUB TESTABIT
ADDRESS.11 = BTRES
GOSUB TESTABIT
ADDRESS.10 = BTRES
GOSUB TESTABIT
ADDRESS.9 = BTRES
GOSUB TESTABIT
ADDRESS.8 = BTRES
GOSUB TESTABIT
ADDRESS.7 = BTRES
GOSUB TESTABIT
ADDRESS.6 = BTRES
GOSUB TESTABIT
ADDRESS.5 = BTRES
GOSUB TESTABIT
ADDRESS.4 = BTRES
GOSUB TESTABIT
ADDRESS.3 = BTRES
GOSUB TESTABIT
ADDRESS.2 = BTRES
GOSUB TESTABIT
ADDRESS.1 = BTRES
GOSUB TESTABIT
ADDRESS.0 = BTRES
GOSUB TESTABIT
CODE.7 = BTRES
GOSUB TESTABIT
CODE.6 = BTRES
GOSUB TESTABIT
CODE.5 = BTRES
GOSUB TESTABIT
CODE.4 = BTRES
GOSUB TESTABIT
CODE.3 = BTRES
GOSUB TESTABIT
CODE.2 = BTRES
GOSUB TESTABIT
CODE.1 = BTRES
GOSUB TESTABIT
CODE.0 = BTRES
GOSUB TESTABIT

SEROUT2 SERPC,16390,["Address= ",BIN16 ADDRESS," Code = ",BIN8 CODE,13,10]
GOTO Start



TESTABIT:
BITVALUE = 0
PULSIN IRIN1, 1, BITVALUE
IF (BITVALUE < 200) OR (BITVALUE > 600) THEN
SEROUT2 SERPC,16390,["Interrupted Code or Garbage ",13,10]
GOTO Start
ENDIF
IF BITVALUE < 400 THEN
Btres = 1
ELSE
Btres = 0
ENDIF
RETURN

End

leko
- 24th August 2005, 05:04
Hi Carlos!! You know the manchester code!!Some small alterations based on the examples of manchester code can be useful!

Você conhece o codigo manchester? Algumas pequenas alterações baseadas nos exemplos do codigo manchester podem ser interessantes!Vc ja olhou os exemplos para codificacao manchester!! No codigo da Melaine me parece que ela monta os dados seriais. Olhei muito rápido!! Qualquer coisa me manda um email [email protected]

http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=198&highlight=Manchester

MARCANTONIO
- 9th June 2007, 21:53
Hi Carlos,

Utilizei o seu código para decodificar o sinal enviado por um sensor de presença sem fio que utiliza o padrão 6p20b. O código compilou direitinho mas não consegui a decodificação do sinal. O meu receptor de RF está recebendo o sinal mas não consigo decodificá-lo. O que será que pode estar acontecendo?

picdev
- 10th June 2007, 17:29
Olá MARCANTONIO,

Especifique melhor o seu projeto para que eu possa entender o que pode estar acontecendo, como o tipo de PIC utilizado, se está utilizando Display, o tipo de receptor, e poste a sua rotina ou parte dela para que eu possa estar dando uma olhada.

Já adiantando, você pode olhar algumas coisinha básicas, como a configuração correta das portas do PIC, se estão definidas como entrada ou saída corretamente, se estão setadas como entrada/saída DIGITAL e não analógica, se você está usando a saída digital do seu receptor de RF e não a analógica, se as variáveis de programa estão com o tamanho correto (Byte,Word, Bit) etc.

Espero que tenha sucesso, depois poste aqui os resultados.

[ ]s
C.W.Rett

MARCANTONIO
- 10th June 2007, 22:19
Hi Carlos,

Estou utilizando o seu código com quase nenhuma alteração. As alterações que fiz foram basicamente na apresentação dos dados via LCD. O PIC utilizado é um 16f877 - 20MHz, conforme você tinha sugerido.
O meu receptor de rf é este comercializado na Tato
http://www.tato.ind.br/files/RxD1.pdf

Estou pretendendo decoficar os sinais enviados via RF para sistemas de alarme sem fio. Se pelo menos eu conseguisse fazer a decodificação já seria de grande ajuda pois era só ir adaptando o código.
Você conseguiu fazer a decodificação do ht6p20B com o exemplo acima? Como os dados eram apresentados? Você teria mais alguma dica ou exemplo?

Você pode entrar em contato direto comigo pelo e-mail abaixo

[email protected]

Um grande abraço.

picdev
- 11th June 2007, 01:56
Marcantonio, o receptor que eu tenho utilizado, é o DHAY 433MHz do link below :

http://www.dhay.com.br/Produtos/Plug-in/RX.htm

Não conheço este módulo da TATO ao qual você se referiu, não sei se a saída do mesmo é digital ou analógica, e se a saída de dados do mesmo é da mesma fase que o DHAY, talvez também seja necessário colocar um resistor de Pull-Up ou Pull-Down na saída do seu módulo para melhor definição do sinal.

Caso Você esteja em São Paulo, te aconselho comprar um destes módulos híbridos da DHAY, você os encontra na Multicomercial (Sta. Ifigênia), e o custo do mesmo é em torno de R$12,00 a R$15,00 aproximadamente, assim você poderia testar a rotina para ver o funcionamento da mesma, e talvez adaptar a seu receptor.

Já utilizei esta rotina em vários projetos, e funciona perfeitamente além de ser bem rápida na leitura e não apresentar leituras errôneas.

[ ]s
C.W.Rett

Ioannis
- 11th June 2007, 06:35
Hey boys, you happen to be in an english language speaking (=writing) forum!

Ioannis

MARCANTONIO
- 11th June 2007, 13:12
It forgives me.

My English is weak.

skimask
- 11th June 2007, 13:36
It forgives me.

My English is weak.

That's ok.
I'd be willing to bet that your English is a lot better than my '________'.
But it has been one of the only threads I haven't been able to follow.

Archangel
- 12th June 2007, 00:49
It forgives me.

My English is weak.

Weak is OK - I was born in USA and so is mine! Welcome to posting on this forum. Do not be bashful, your english will likely improve, as will your code :) Oh and to Skimask: I do not even speak '____________'.
EDIT: see ! I even mispelled it! Got too many _ _ _ in there:)

dhouston
- 12th June 2007, 02:59
Take a look at the Receive example in this thread

http://www.picbasic.co.uk/forum/showthread.php?t=6261

It's very similar to what you need to do.

MARCANTONIO
- 12th June 2007, 05:55
Thankful by the hint.

But I need specifically of examples for the ht6p20.
My objective is to decode signals for an alarm central that work with that code.

Marcantonio

picdev
- 12th June 2007, 09:09
They forgive me Boys,
I respect its opinion!
The interesting one on this, is that this post is died has two years, and now, five users decide to write here disapproving our native language.
Guys, for me, are much more easy to read in English who to write, but if any one to need aid (in English), I will strengthen myself to the maximum to write of form that this person understands. My colleague MARCANTONIO as well as I understands our proper language more easily, and as after two years only he revealed interested in this routine, nothing more just than to help it of the best form that I found.
They forgive me again, in next time I go to write in the two languages, but with certainty the English will not be so correct, therefore I will be using a translator on-line for this.
Thank You


Desculpem-me meninos,
Eu respeito sua opinião!
O interessante sobre isto, é que esse post está morto há dois anos , e agora , cinco usuários resolvem escrever aqui desaprovando nossa língua nativa.
Meu, para mim , é muito mais fácil ler em inglês que escrever, mas se qualquer um precisar de ajuda ( em inglês ), Eu me esforçarei ao máximo para escrever de forma que esta pessoa entenda.
Meu colega MARCANTONIO assim como eu compreende mais facilmente nossa própria língua, e como depois de dois anos apenas ele se mostrou interessado nesta rotina, nada mais justo que ajudá-lo da melhor forma que encontrei. Desculpem me novamente, na proxima vez vou escrever nas duas linguas , mas com certeza o inglês não será tão correto, pois estarei utilizando um tradutor on-line para isso.
Obrigado.

Ioannis
- 12th June 2007, 09:41
There is also the option of P.M directly to the person of interest!

Ioannis

picdev
- 13th June 2007, 03:42
Sorry again Ioannis, seens who I bothered you excessively with my native language. Please, talk with the administrator of this forun to exclude my name, and feel free to delete all my posts here.
Who am I with my poor 5 posts compared to you with yours 350 and up.

Good Bye for all, see you in another life......

skimask
- 13th June 2007, 04:49
Sorry again Ioannis, seens who I bothered you excessively with my native language. Please, talk with the administrator of this forun to exclude my name, and feel free to delete all my posts here.
Who am I with my poor 5 posts compared to you with yours 350 and up.

Good Bye for all, see you in another life......

Oh, I don't think anybody was getting mad at you or anything...just a bit of gentle ribbing I suppose...
As for me, I was just pointing out that I know English...AND THAT'S IT! Compare that to the bulk of the rest of the world where practically each person knows 2, 3, or more languages...

Ioannis
- 13th June 2007, 06:32
Hey, what's going on here? Did I say that I am bothered or want you to be excluded? I think I was very polite in suggesting that this is a forum open to anyone and for anyone to read, the language has to be english.

The matters discussed here are of general concern to the most people, so YOU are excluding the rest from being able to read the messages by writing in foreign lanquage!

Note that I too, do not speak english fluently, but that never stoped me from trying to give or ask for help.

I really cannot understand were I was wrong or what did I say to hurt your feelings. All in all if you really want to leave us, that's OK. But don't blame me for that. I never meant anything more than what I wrote. And that was purely friendly... Sad.

Ioannis

Archangel
- 13th June 2007, 08:08
2 languages are common on this forum, ME Labs pic basic & pro, and english.
PICBASIC because the forum is about that and English, largely because it is an English company paying the bills, that is not to say anything bad about other languages, Machine or Human. Ioannis, wanted to be INCLUDED in this thread, but could not understand Portuguese, I am pretty sure he speaks Greek very well, and his English is pretty good too. PICDEV's English is actually pretty fair, and as Skimask pointed out other languages mystify many of us as our governments do not make the effort to teach the general population various languages, but to communicate, there has to be a sender and a receiver, which understand at least some of the information. This I believe was the point of the original comments to use English, I see lots of snippets of other languages used here and I get it that it is not intended for me to understand. To all of our English as a second language members, I appreciate the extraordinary effort it takes you to post in english, posting in english will get you the most help however, and will help all the others here. I use this forum as a classrom, I learn from everyone elses mistakes as well as my own. I think the greatest thing about this forum is we can help each other.

bucanian
- 29th April 2013, 13:59
Sorry again Ioannis, seens who I bothered you excessively with my native language. Please, talk with the administrator of this forun to exclude my name, and feel free to delete all my posts here.
Who am I with my poor 5 posts compared to you with yours 350 and up.

Good Bye for all, see you in another life......

É isso mesmo cara!

AvionicsMaster1
- 30th April 2013, 14:28
Interesting! "É isso mesmo cara!" according to the Google machine is Portugese. I thought you were from Brazil. As for you English, I thought you were doing pretty good.

I do want to know though if Southern is a true language in the U.S.?

MOUNTAIN747
- 30th April 2013, 23:59
Well heck ya it is! Shucks, Southern is in fact the first English spoken here in America since the first English settlements were of the coast of Georgia, a southern state.