Holtek Encoder HT6P20


Closed Thread
Results 1 to 22 of 22
  1. #1
    Join Date
    Jul 2005
    Posts
    6

    Default Holtek Encoder HT6P20

    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
    Last edited by picdev; - 25th July 2005 at 23:03.

  2. #2
    Join Date
    Jul 2005
    Posts
    6


    Did you find this post helpful? Yes | No

    Thumbs up Ht6p20b

    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

  3. #3
    leko's Avatar
    leko Guest


    Did you find this post helpful? Yes | No

    Lightbulb ht6p20b

    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/show...ght=Manchester

  4. #4


    Did you find this post helpful? Yes | No

    Red face

    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?

  5. #5
    Join Date
    Jul 2005
    Posts
    6


    Did you find this post helpful? Yes | No

    Lightbulb 6p20b

    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
    Last edited by picdev; - 10th June 2007 at 18:32.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    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.

  7. #7
    Join Date
    Jul 2005
    Posts
    6


    Did you find this post helpful? Yes | No

    Lightbulb

    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

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Hey boys, you happen to be in an english language speaking (=writing) forum!

    Ioannis

  9. #9


    Did you find this post helpful? Yes | No

    Default

    It forgives me.

    My English is weak.

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MARCANTONIO View Post
    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.

  11. #11
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MARCANTONIO View Post
    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
    Last edited by Archangel; - 12th June 2007 at 01:52.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  12. #12
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    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.

  13. #13


    Did you find this post helpful? Yes | No

    Red face

    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

  14. #14
    Join Date
    Jul 2005
    Posts
    6


    Did you find this post helpful? Yes | No

    Exclamation Off topic

    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.

  15. #15
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    There is also the option of P.M directly to the person of interest!

    Ioannis

  16. #16
    Join Date
    Jul 2005
    Posts
    6


    Did you find this post helpful? Yes | No

    Exclamation Bye Bye..........

    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......

  17. #17
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by picdev View Post
    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...

  18. #18
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    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
    Last edited by Ioannis; - 13th June 2007 at 07:34.

  19. #19
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Inclusion and commonality

    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.
    Last edited by Archangel; - 13th June 2007 at 09:12.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  20. #20
    Join Date
    Apr 2013
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Bye Bye..........

    Quote Originally Posted by picdev View Post
    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!

  21. #21
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Bye Bye..........

    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.?

  22. #22
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Bye Bye..........

    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.

Similar Threads

  1. Quadrature encoder and ASM Interrupts. questions..
    By godfodder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th March 2013, 15:45
  2. Instant Int and encoder (Elect. Gearing)
    By boroko in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 29th November 2009, 03:29
  3. encoder HEDL 5540
    By kutsi in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th June 2007, 15:00
  4. Holtek - HT6012 Encoder
    By ero in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th March 2006, 14:02
  5. encoder wowes
    By wallaby in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 6th December 2005, 22:56

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts