Holtek Decoder


Closed Thread
Results 1 to 17 of 17

Thread: Holtek Decoder

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Guy,

    You're very welcome, and thank you too. I'm glad you found a good use for it.

    Edit: If you ever need to create your own PIC chip to emulate the Holtek 8-bit encoder too, I posted a pretty cool project for the Crownhill Amicus board here http://www.myamicus.co.uk/content.ph...Remote-Control with code for one.

    And PC software to control the PIC, so you have a PC-based encoder to control your PIC-based decoder. Pretty fun stuff...
    Last edited by Bruce; - 6th August 2010 at 22:50. Reason: Emulate the Holtek 8-bit encoder too
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Jun 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Holtek Decoder

    the code work great.

    i there i am newbie in this forum and also at Picbasic pro, i need help in this code as well. the other PIC cannot receive every single bits , pls help
    thanks alot

    CLEAR
    @ device pic16F876A, HS_OSC, wdt_on, lvp_off, protect_off
    DEFINE OSC 20

    ADDRESS VAR WORD ' Holds 10-bit address
    DAT_OUT VAR BYTE ' Holds 8-bit data byte
    BITS VAR BYTE ' Bit index for address & data bit pointer
    LOOPS VAR BYTE ' Loop var for encode routine
    LEDGreen var PORTC.4

    ' Use this timing for a Holtek HT640 @3V, 390K osc resistor
    LONGB CON 732 ' 732uS for long bit & inter-bit delay
    SHORTB CON 382 ' 382uS for short bit & inter-bit delay

    ' Use this timing for a Holtek HT640 @5V, 390K osc resistor
    'LONGB CON 861 ' 861uS for long bit & inter-bit delay
    'SHORTB CON 431 ' 431uS for short bit & inter-bit delay

    SYMBOL E_OUT = PORTB.5 ' Assign encoder data out (to RF module) pin here

    ' Bank 1 Hardware initialization
    'OPTION_REG = 128 ' Pull-ups = off, GPIO.2 = I/O, prescaler to Timer1

    ' Bank 0 Hardware initialization
    PORTB = 0 ' Data output to RF transmitter idles low
    TRISB=%00000000 ' all outputs

    ' sending A#2#3#64 with MCS terminal turns ON relay #1 at address #2
    ' #3 is sent since the FCTN-RLY4-xxx has the upper 2 address bits of the
    ' 10-bit decoder address left open (floating).

    MAIN:
    ;DEBUGIN 5000,MAIN,[WAIT("A"),ADDRESS.LOWBYTE,ADDRESS.HIGHBYTE,DAT_OUT]
    ADDRESS = $31F '1100011111
    DAT_OUT = $99 '10011001

    ENCODE_640:
    high LEDGreen

    FOR LOOPS = 1 TO 8 ' 8 data packet bursts per transmit period
    ' to simulate user button presses. |
    ' now do synch period & synch bits _ __ _ __ _|
    HIGH E_OUT : PAUSEUS SHORTB ' | | | | | | | | | |
    LOW E_OUT : PAUSEUS SHORTB ' | | | | | | | | | |
    HIGH E_OUT : PAUSEUS LONGB ' | | | | | | | | | |
    LOW E_OUT : PAUSEUS LONGB ' | | | | | | | | | |
    HIGH E_OUT : PAUSEUS SHORTB ' | | | | | | | | | | ADDRESS | DATA
    LOW E_OUT : PAUSEUS SHORTB ' | | | | | | | | | | 10-BIT | 8-BIT
    HIGH E_OUT : PAUSEUS LONGB ' | | | | | | | | | |
    LOW E_OUT : PAUSEUS LONGB ' 14mS | | | | | | | | | |
    HIGH E_OUT : PAUSEUS SHORTB '_____ | |_| |__| |_| |__| |
    ' SYNCH BITS |
    ' now encode/send address
    FOR BITS = 0 to 9 ' send 10-bit address
    IF ADDRESS.0[BITS] = 1 THEN ' a 1 indicates the address bit is floating. NOT 1
    LOW E_OUT : PAUSEUS LONGB
    HIGH E_OUT : PAUSEUS SHORTB
    LOW E_OUT : PAUSEUS LONGB
    HIGH E_OUT : PAUSEUS SHORTB
    ELSE
    LOW E_OUT : PAUSEUS SHORTB
    HIGH E_OUT : PAUSEUS LONGB
    LOW E_OUT : PAUSEUS SHORTB
    HIGH E_OUT : PAUSEUS LONGB
    ENDIF
    NEXT BITS

    ' now encode/send data
    FOR BITS = 0 to 7 ' 8-bit data
    IF DAT_OUT.0[BITS] THEN
    LOW E_OUT : PAUSEUS LONGB
    HIGH E_OUT : PAUSEUS SHORTB
    LOW E_OUT : PAUSEUS LONGB
    HIGH E_OUT : PAUSEUS SHORTB
    ELSE
    LOW E_OUT : PAUSEUS SHORTB
    HIGH E_OUT : PAUSEUS LONGB
    LOW E_OUT : PAUSEUS SHORTB
    HIGH E_OUT : PAUSEUS LONGB
    ENDIF
    NEXT BITS
    LOW E_OUT ' start synch period @ start of 2nd data packet
    PAUSE 14 ' 14mS to 15mS synch period
    NEXT LOOPS ' Close loop
    LOW E_OUT ' Disable transmitter (turn off carrier)

    low LEDGreen
    pause 1000
    GOTO Main

    END

  3. #3
    Join Date
    Jun 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Holtek Decoder

    Any Help Pls.. i does received the data but not what i set in

    ADDRESS = $31F '1100011111
    DAT_OUT = $99 '10011001

  4. #4
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Post Re: Holtek Decoder

    Try the HT648L. This will decode data from the HT640.
    Just make sure you select the same address as the one selected on the encoder (HT640)

  5. #5
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default Re: Holtek Decoder

    Just to make sure I am getting it correctly (Bruce's code), is the Frequency of the operation of Holtek 640 in the above example 79Khz (appx) ?

Similar Threads

  1. CTCSS Tone Decoder Sample Program
    By sozkarabacak in forum General
    Replies: 0
    Last Post: - 20th October 2009, 07:15
  2. Req: Basic code for 32 bit hitach ir decoder
    By aa222k in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th January 2009, 06:16
  3. tone decoder
    By grounded in forum General
    Replies: 6
    Last Post: - 30th June 2008, 21:46
  4. Replies: 1
    Last Post: - 10th May 2006, 16:17
  5. 3-to-8 Decoder Program
    By BlackNoir in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th December 2005, 20:51

Members who have read this thread : 0

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