Transmission works with wires but not always with wireless


Results 1 to 40 of 43

Threaded View

  1. #5
    Join Date
    Apr 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Transceiver

    Include "Modedefs.bas"

    ct55 var byte: encoded1 var byte: p var byte: counter var byte: e var byte: action var byte:
    encoded var byte: encoded2 var byte: action2 var byte: B0 var bit: B1 var bit: B0=1: B1=0:
    p=0: e=0: encoded1=0: counter = 0: action=0: action2=0: encoded=0: encoded2=0:

    Main:

    Clr:
    p=0: e=0: encoded1=0: action=0: action2=0: encoded=0: encoded2=0

    Maina:
    ct55=0 'counter for $55 is zero

    Wait55:
    serin PORTB.0, n2400, encoded1
    If encoded1 = $55 Then
    ct55 = ct55 + 1
    If ct55 = 4 Then goto Waitaa
    Else
    goto Maina
    Endif
    goto Wait55

    Waitaa:
    serin PORTB.0, n2400, encoded1
    If encoded1 <> $aa Then goto Maina
    serin PORTB.0, n2400, encoded1
    write 0, encoded1

    For counter = 0 to 3 : p.0[counter] = encoded1.0[counter*2]:Next counter
    write 1,p

    e = p:
    If ((e.3=B0) and (e.2=B1)) Then
    goto L3
    Else
    write 2, p
    goto Clr
    Endif

    L3:
    If((p.1=0) and (p.0=0)) Then
    action=%1010
    write 3, p
    For counter = 0 to 3
    If action.0[counter]=0 Then
    encoded.0[counter*2]=0 : encoded.0[counter*2+1]=1
    Else
    encoded.0[counter*2]=1 : encoded.0[counter*2+1]=0
    Endif
    Next counter:
    write 8, encoded
    For counter = 0 to 4
    serout PORTB.7, n2400, [$55,$55,$55,$55,$aa, encoded]
    Next counter
    goto Clr


    Endif

    If ((p.1=0) and (p.0=1)) Then
    action2 = %1011
    write 4, p
    For counter = 0 to 3
    If action2.0[counter]=0 Then
    encoded2.0[counter*2] = 0: encoded2.0[counter*2+1] = 1
    Else
    encoded2.0[counter*2] = 1: encoded2.0[counter*2+1] = 0
    Endif
    Next counter:
    write 9, encoded2
    For counter = 0 to 4
    serout PORTB.7, n2400, [$55,$55, $55, $55,$aa, encoded2]
    Next counter
    goto Clr

    Endif
    End

    Receiver

    Include "Modedefs.bas"
    cot55 var byte: encoded1 var byte: p var byte: counter var byte: e var byte:
    p = 0: e = 0: encoded1 = 0: counter = 0:

    Main:


    Mainb:
    cot55=0 'counter for $55 is zero

    Wait55:
    serin PORTB.0, n2400, encoded1
    If encoded1 = $55 Then cot55 = cot55 + 1
    If cot55 = 4 Then
    goto Waitaa
    Else
    goto Wait55
    Endif
    'goto Wait55

    Waitaa:
    serin PORTB.0, n2400, encoded1
    If encoded1 <> $aa Then goto Maina
    serin PORTB.0, n2400, encoded1
    write 0, encoded1

    For counter = 0 to 3 : p.0[counter] = encoded1.0[counter*2]: Next counter
    write 1,p

    If (p.1=1) Then
    goto B4
    Else
    write 2,p
    High 2
    Pause 1000
    Low 2
    goto Mainb
    Endif

    B4:
    e = p
    write 3, e
    High 1
    Pause 1000
    Low 1
    High 5
    serout PORTB.3, n2400, [e.3]
    serout PORTB.4, n2400, [e.2]
    goto Mainb

    End
    Last edited by jyi1; - 24th April 2007 at 05:46.

Similar Threads

  1. Wireless Tachometer - Design Help
    By DanPBP in forum Off Topic
    Replies: 2
    Last Post: - 3rd May 2009, 09:06
  2. RS485 Vs Wireless (TWS-434A)
    By koossa in forum Off Topic
    Replies: 3
    Last Post: - 11th April 2009, 12:40
  3. Serial Wireless
    By mackrackit in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th May 2007, 16:06
  4. Serial comm - are 2 wires for TX only enough?
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 30th August 2006, 03:23
  5. RS 485 wireless communication
    By Armadus in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 26th January 2006, 19:30

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