RF Transmitter


Closed Thread
Results 1 to 5 of 5

Thread: RF Transmitter

  1. #1
    et_Fong's Avatar
    et_Fong Guest

    Default RF Transmitter

    My project is using RS-232 Pin 3 to send data to PIC16F84A, after that the PIC will send the data to Holtek 12E encoder then transmit the data the RF transmitter module. Then the RF signal will receive by a receiver circuit. the decoder on the receiver circuit, the 8 address pin i connect it to ground.
    then i been told that the encoder 8 address pin need to connect to ground too.
    Now, here is my question, how to modify my programming if i connect the encoder address pin to ground.
    p/s: RS232 :9600 baud, no parity, 8 data, and 1 stop bit

    ;************************************************* *****************
    ;
    ; The Serial Interface Between PC and PIC
    ;
    ;************************************************* *****************
    list p=pic16f84a
    include p16f84a.inc
    __CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF
    errorlevel -302 ;Eliminate bank warning

    ;************Label Definition*************************************

    ra4 equ 04 ;RA4 bit
    cnt01 equ 0c ;counter address
    address equ 0e ;address word
    addtemp equ 0f ;address tempory
    datbyte equ 10 ;data word
    dattemp equ 11 ;data temport

    ;************* Program Start *************************************
    org 0 ;Reset vector
    goto Start
    org 4 ;Interrupt vector
    goto Start

    ;*********** Initial Process *************************************

    Start bsf STATUS,RP0 ;change to Bank1
    movlw b'00010000'
    movwf TRISA ;Set PORTA,4 to input mode
    clrf TRISB ;Set PORTB to Output mode
    bcf STATUS,RP0 ;Change to Bank0
    clrf PORTB ;Clear PORTB
    clrf PORTA ;Clear PORTA

    ;************ Synchronize Check Process **************************

    keyscan btfsc PORTA,ra4 ;ra4 Low?
    goto keyscan
    bit_1 call delay
    btfss PORTA,ra4 ;ra4 High?
    goto bit_1
    call delay
    btfsc PORTA,ra4 ;ra4 Low?
    goto keyscan
    call delay
    btfss PORTA,ra4 ;ra4 High?
    goto bit_1
    call delay
    btfsc PORTA,ra4 ;ra4 Low?
    goto keyscan
    call delay
    btfss PORTA,ra4 ;ra4 High?
    goto bit_1
    call delay
    btfsc PORTA,ra4 ;ra4 Low?
    goto keyscan
    call delay
    btfss PORTA,ra4 ;ra4 High?
    goto bit_1
    call delay

    call delay
    call delay

    ;********************** Match ************************************

    movf PORTA,w
    andlw b'00010000'
    movwf addtemp
    rrf addtemp,f
    rrf addtemp,f
    rrf addtemp,f
    rrf addtemp,w
    andlw b'00000001'
    movwf address
    call delay ;1st address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf addtemp
    rrf addtemp,f
    rrf addtemp,f
    rrf addtemp,w
    andlw b'00000010'
    iorwf address,f
    call delay ;2nd address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf addtemp
    rrf addtemp,f
    rrf addtemp,w
    andlw b'00000100'
    iorwf address,f
    call delay ;3rd address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf addtemp
    rrf addtemp,w
    andlw b'00001000'
    iorwf address,f
    call delay ;4th address bit finish

    movf PORTA,w
    andlw b'00010000'
    iorwf address,f
    call delay ;5th address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf addtemp
    rlf addtemp,w
    andlw b'00100000'
    iorwf address,f
    call delay ;6th address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf addtemp
    rlf addtemp,f
    rlf addtemp,w
    andlw b'01000000'
    iorwf address,f
    call delay ;7th address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf addtemp
    rlf addtemp,f
    rlf addtemp,f
    rlf addtemp,w
    andlw b'10000000'
    iorwf address,f
    movf address,w
    movwf PORTB

    call delay ;8th address bit finish

    call delay
    call delay

    ;*************** START TO READ DATA WORD *************************

    movf PORTA,w
    andlw b'00010000'
    movwf dattemp
    rrf dattemp,f
    rrf dattemp,f
    rrf dattemp,f
    rrf dattemp,w
    andlw b'00000001'
    movwf datbyte
    call delay ;1st address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf dattemp
    rrf dattemp,f
    rrf dattemp,f
    rrf dattemp,w
    andlw b'00000010'
    iorwf datbyte,f
    call delay ;2nd address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf dattemp
    rrf dattemp,f
    rrf dattemp,w
    andlw b'00000100'
    iorwf datbyte,f
    call delay ;3rd address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf dattemp
    rrf dattemp,w
    andlw b'00001000'
    iorwf datbyte,f
    call delay ;4th address bit finish

    movf PORTA,w
    andlw b'00010000'
    iorwf datbyte,f
    call delay ;5th address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf dattemp
    rlf dattemp,w
    andlw b'00100000'
    iorwf datbyte,f
    call delay ;6th address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf dattemp
    rlf dattemp,f
    rlf dattemp,w
    andlw b'01000000'
    iorwf datbyte,f
    call delay ;7th address bit finish

    movf PORTA,w
    andlw b'00010000'
    movwf dattemp
    rlf dattemp,f
    rlf dattemp,f
    rlf dattemp,w
    andlw b'10000000'
    iorwf datbyte,f
    movf datbyte,w
    movwf PORTA
    call delay ;8th address bit finish
    call delay

    goto keyscan

    ;******************** Delay **************************************

    delay movlw d'35' ;(1) Set loop cnt1
    movwf cnt01 ;(1) Save loop cnt1
    delay1 decfsz cnt01,f ;(1)*35 cnt1-1=0?
    goto delay1 ;(2)*34 No, continue
    return ;(2) yes. cnt end
    ;Total 107*1usec=105.6usec
    ;which > 104.166usec(1/9600)

    ;************************* Finish ********************************

    end

  2. #2
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    EDIT: Okay, now I have looked at your code and see your problem. The problem is that you are not using "PicBasicPro". So you are in the wrong FORUM.... good luck.



    Just curious...If you are already using a PIC, then why add a Holtek chip to your data path? Why not use SerOut and SerIn, and eliminate the Holtek chip altogether. Or write your own serial routines if you need manchester encoding or whatever.

    If I remember right, the Holtek chips have to send the data repeatedly (maybe 5 times?), and has to receive it 3 times. That's alot of overhead for data transmission. Unless you are only sending single byte commands?

    As far as the address pins, they just have to be set the same on both chips. Usually with dip switches. Get a copy of the Holtek datasheets. They are pretty detailed with example circuits.
    Last edited by milestag; - 26th October 2005 at 15:57.
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

  3. #3
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    What are you trying to accomplish? A contact closure, data transmission, or just a signaling device? I'm in agreement that you can drop the Holtek encoder/ decoders, or get rid of the PIC. The Holteks can be used with buttons, just as the PICs can very easily emulate the Holtek chips. When the 12E is activated, it sends a 12 bit PWM AM word. It repeats this after a small delay until deactivated. The receiver looks for three correct words in a row. The first 8 bits are address, the last 4 are control bits. It is easier to write the code in assembly, due to tight timing, but it can be done in PBP.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    Look at an earlier post of mine: http://www.picbasic.co.uk/forum/show...79&postcount=6

    Ioannis

  5. #5
    et_Fong's Avatar
    et_Fong Guest


    Did you find this post helpful? Yes | No

    Default

    since i am using Microsoft VB to make my interface, so i am using "170" as synchronize signal, "0" as address bit, "0~9" data bit which run certain function. that's why i need to perform the "match" , to read the "0" address bit, which is similar as connect PORT B to ground.
    after i send the RF signal, the receiver size will receive and decode the signal to 4 parallel data to PIC16F84A RA0~3, then it will control the movement according to the data receive........

Similar Threads

  1. Control NEXA 230V RF Switch
    By Fredrick in forum Code Examples
    Replies: 3
    Last Post: - 6th December 2009, 23:19
  2. Interfacing 16F88 to RF module
    By scomi85 in forum General
    Replies: 2
    Last Post: - 19th February 2009, 12:52
  3. problem with sending data using RF module
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 51
    Last Post: - 10th April 2008, 17:08
  4. Interfacting RF Module
    By rastan in forum General
    Replies: 8
    Last Post: - 10th November 2004, 22:27
  5. RF transmitter, RS232, and Visual Basic
    By pt3rg in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd January 2004, 19:42

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