Wire worked by not wireless


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    mankan's Avatar
    mankan Guest

    Default Wire worked by not wireless

    Dear Gurus,

    Below is the code I am using to build a wireless data transfer, I started by building a wired connection and it worked very fine but once I go wireless nothing works.

    Any idea, hint, help is greatly appreciated.

    Thanks,
    Mankan

    '************************************************* ***************
    '* Name : Receiver.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2006 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 5/10/2006 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************

    INCLUDE "modedefs.bas"

    '@DEVICE PIC16F628, WDT_ON
    '@DEVICE PIC16F628, BOD_ON
    '@DEVICE PIC16F628, PROTECT_OFF
    '@DEVICE PIC16F628, MCLR_ON

    DEFINE OSC 4
    DEFINE NO_CLRWDT

    '* Variable declarations
    Header var BYTE
    Counter VAR BYTE
    Packet VAR BYTE
    End_Of_Data VAR BYTE

    counterA VAR BYTE
    ErrorFlag var bit
    MyData var byte
    ManchesterWord Var WORD

    Temp_Byte var byte[5]
    Temp_Word var WORD[5]
    x VAR BYTE
    send_word VAR WORD

    SYNCH VAR byte
    SYNCH=$C6


    CMCON = 7
    VRCON = 0
    TRISB.1 = 1

    INPUT PORTB.1
    PORTB.1 = 1

    pause 10
    Loop:
    Header = 0
    HIGH PORTB.6
    'SERIN PORTB.1,N300,[SYNCH],Header,Counter,Packet,End_Of_Data
    'SERIN PORTB.1,N300,[SYNCH],ManchesterWord.lowbyte,ManchesterWord.highbyte
    SERIN PORTB.1,N300,[SYNCH],send_word.lowbyte,send_word.highbyte
    Temp_Word[0] = send_word
    For x=1 to 4
    SERIN PORTB.1,N300,300,Loop,send_word.lowbyte,send_word. highbyte
    Temp_Word[x] = send_word
    next x

    for x=0 to 4
    ManchesterWord = Temp_Word[x]
    GOSUB DecodeManchester
    Temp_Byte[x] = MyData
    next x

    Low PORTB.6
    Header = Temp_Byte[0]
    PAUSE 100
    if Header = 96 THEN
    gosub GLOW_PIN7
    if Counter = 2 Then
    gosub glow_pass
    ENDIF
    endif
    goto loop

    TimeOut:
    call GLOW_TIMEOUT
    goto loop

    GLOW_PASS:
    HIGH PORTB.5
    PAUSE 50

    LOW PORTB.5
    PAUSE 50
    RETURN

    GLOW_PIN7:
    HIGH PORTB.7
    PAUSE 50

    LOW PORTB.7
    PAUSE 50
    RETURN

    GLOW_TIMEOUT:
    HIGH PORTB.6
    PAUSE 500

    LOW PORTB.6
    PAUSE 500
    RETURN

    DecodeManchester:
    ErrorFlag=0
    For counterA=0 to 7
    if ManchesterWord.1=0 then
    MyData.7=0
    If ManchesterWord.0=0 then ErrorFlag=1
    else
    MyData.7=1
    If ManchesterWord.0=1 then ErrorFlag=1
    endif
    ManchesterWord=ManchesterWord>>2
    if counterA<7 then MyData=MyData>>1
    next counterA
    return

    /**********END OF Receiver*********************/

    /**********Start of Transmitter*********************/
    '************************************************* ***************
    '* Name : Transmitter.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2006 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 5/2/2006 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************

    INCLUDE "modedefs.bas"

    DEFINE OSC 4
    DEFINE NO_CLRWDT


    CMCON = 7
    VRCON = 0
    TRISB.2 = 0

    Header VAR BYTE
    End_Of_Data con 24
    SYNCH VAR byte
    SYNCH=$C6

    '* Variable declarations
    Counter VAR BYTE
    Packet VAR BYTE

    counterA VAR BYTE
    MyData var byte
    Temp_Byte var byte[5]
    Temp_Word var WORD[5]

    ManchesterWord Var WORD
    x VAR BYTE
    send_word VAR WORD

    Header = 96


    pause 10
    OUTPUT PORTB.2
    PORTB.2 = 0
    OUTPUT PORTB.4
    PORTB.4 = 0
    OUTPUT PORTB.5
    PORTB.5 = 0

    Counter = 2
    Packet = 78


    Temp_Byte[0] = 96
    Temp_Byte[1] = 16
    Temp_Byte[2] = 26
    Temp_Byte[3] = 36
    Temp_Byte[4] = 46

    start:
    pause 1000
    MyData = Header
    for x=0 to 4
    MyData = Temp_Byte[x]
    gosub EncodeManchester
    Temp_Word[x] = ManchesterWord
    nEXT X
    'SEROUT PORTB.2,N300,[126, SYNCH,Header, Counter, Packet, End_Of_Data]
    'SEROUT PORTB.2,N300,[126, SYNCH,ManchesterWord.lowbyte, ManchesterWord.highbyte]
    SEROUT PORTB.2,N300,[1263, SYNCH]
    for x=0 to 4
    send_word = Temp_Word[x]
    PAUSE 1
    SEROUT PORTB.2,N300,[send_word.lowbyte, send_word.highbyte]
    next x
    CALL GLOW_LED
    goto Start

    GLOW_LED:
    HIGH PORTB.5
    PAUSE 50

    LOW PORTB.5
    PAUSE 50
    RETURN

    EncodeManchester:
    ManchesterWord = 0
    for counterA=0 to 7
    if MyData.0 = 0 then
    ManchesterWord.14=1
    else
    ManchesterWord.15=1
    endif

    if CounterA<7 then ManchesterWord = ManchesterWord>>2
    MyData=MyData>>1
    Next CounterA
    return

    /************END OF TX****************/

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Probably not software related

    I'm not one of the most experienced people on this forum but I have made successful links with PIC's without wires. Can you tell us what you are using in the way of hardware? If your code works with wires, your code should work without wires. Have you ever done a wireless link with PIC's before?

    Chris

  3. #3
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    I forgot to mention, it is possible that your software may have an issue with timing. When I use a wireless link, I typically give a little more time for the transmit and receive signals....maybe an extra 10 to 20ms.

  4. #4
    mankan's Avatar
    mankan Guest


    Did you find this post helpful? Yes | No

    Default Hello Chris,

    Chris,

    Thank you very much for the reply. This is my first project with the PIC. Is there any other issue apart from time-to-transmit?

    Do you see anything wrong with my code? It worked fine with the wires.I have even grounded the Rx DataIn pin to overcome the noise.

    I am using laipac 434 series of Tx/Rx.

    Thanks,
    Mankan

  5. #5
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    I have never used those but I have used Linx Technologies LR series modules. I found that without a 10K pullup resistor (to +5V) on the RX side, they would not work at all. The TX side did not need anything. Are you making only a transmitter and receiver or are you making two transceivers. Don't forget that you cannot have to transmitters transmitting at the same time. With the Linx modules, if you don't pull down the PDN line, the transmit port will always be open making it impossible to send data. Of course, if only using one TX and one RX, this is not a problem. The other thing you may look at is interference in the surrounding area. Let me know if you still have problems.

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


    Did you find this post helpful? Yes | No

    Default

    The Laipac modules (also widely available under other names) use ASK and the suprerregenerative receiver has AGC/ATC so the output line will have continuous noise in the absence of a signal. I would not try to use serial in and out but would use some type of preamble that will serve to tell the receiver that a message is coming and also allow it to set its AGC/ATC. I use the NEC IR protocol and have never had much of a problem sending/receiving. However, it may or may not be the best choice depending on the type of data you need to transmit. The length of messages casn be a determining factor.

    I don't recall what Bruce Reynolds uses in his examples but he does have some examples using these modules on his web site.

Similar Threads

  1. Need Single wire serial LCD converter example
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 16th December 2009, 02:30
  2. Wireless Tachometer - Design Help
    By DanPBP in forum Off Topic
    Replies: 2
    Last Post: - 3rd May 2009, 09:06
  3. RS485 Vs Wireless (TWS-434A)
    By koossa in forum Off Topic
    Replies: 3
    Last Post: - 11th April 2009, 12:40
  4. Wireless communication gear.
    By toalan in forum Off Topic
    Replies: 5
    Last Post: - 17th March 2005, 16:33
  5. RPM with wire and PIC
    By Dwayne in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th December 2004, 20:42

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