serout and serin problem


Closed Thread
Results 1 to 4 of 4
  1. #1
    nicolelawsc's Avatar
    nicolelawsc Guest

    Default serout and serin problem

    hi all,
    i am dealing with a rf transmitter and receiver project. there are 3 transmitter and 1 receiver used in this project. transmitter used pic16f84a and the receiver used 16f877a.
    below is the code


    transmitter:
    include "modedefs.bas"
    define osc 4
    input porta.0
    output portb.0
    output portb.1
    output portb.2
    output portb.3

    led_on:
    high portB.1
    if porta.0=1 then transmit

    transmit:
    low portb.1
    high PORTB.2
    serout PORTB.0,N9600,["A",1]--(tansmitter1),
    --serout PORTB.0,N9600,["A",2]--(transmitter2)
    --serout PORTB.0,N9600,["A",3]--(transmitter3)


    low PORTB.2
    low portb.1
    goto led_on


    end




    receiver:


    serin PORTB.2,N9600,["A"],rx


    SELECT CASE rx
    CASE 1
    goto station1

    CASE 2
    goto station2

    CASE 3
    goto station3

    END SELECT


    station1:

    lcdout $FE,1, "station one"

    portb.6=0
    portb.3=1

    pause 2000
    portb.3=0
    goto loop


    station2:

    lcdout $FE,1, "station two "
    portb.6=0
    portb.5=1
    pause 2000
    portb.5=0

    station3:
    lcdout $FE,1, "station three "
    portb.3=1
    portb.5=1
    pause 1000
    portb.3=0
    portb.5=0
    goto loop
    end



    my problem now is at the receiver i use lcd to test the result and i found out the serin command at the receiver and the select case below it also did not perform at all.It just direct go through content in station 1 only. station 2 and 3 totally did not perform.


    another problem is i want to define the value of X1, X2,X3, Y1,Y2,and Y3.
    but the value of X1,Y1,and X2 are negative value so how can i deal with it?all in word.
    X1 = ? (X1=-2)
    Y1 = ? (Y1=-2)
    X2 = ? '(X2=-2)
    Y2 = 6000 '(Y2=6)
    X3 = 6000 '(X3=6)
    Y3 = 6000 '(Y3=6)


    hope to hear u soon.thank you for ur consideration.

  2. #2


    Did you find this post helpful? Yes | No

    Default serin and serout over RF

    Sorry, I just realized that your serouts are exclusive to each associated transmitter device.... kind of hard to know what's going to happen without knowing what lines are being used as busy/handshaking lines...
    Last edited by picster; - 11th April 2006 at 15:42.

  3. #3
    nicolelawsc's Avatar
    nicolelawsc Guest


    Did you find this post helpful? Yes | No

    Unhappy any suggestion?

    do u hv any suggetion to solve this problem?actually i hv 3 pair of transmitter and only one receiver.each of the transmitter with a identify code for receiver to determine the code sent from which transmitter.as i post the code above. Below shows the concept of my code,can u please give me some comment whether my code have any problem.i try many ways already but still do not know why my receiver can not receive data.
    serout PORTB.0,N9600,["A",1]--transmitter 1 with the identify code "1"
    serout PORTB.0,N9600,["A",2] --transmitter 2 with the identify code "2"
    serout PORTB.0,N9600,["A",3]--transmitter 3 with the identify code "3"
    and at the receiver the command is--serin PORTB.2,N9600,["A"],rx
    what i mean here is each of the transmitter hv the password "A" and the number at the back of "A " represent the identify code.then at the receiver if the rx it receive is "1", mean receive from transmitter 1.
    rx is "2" mean receive from transmitter 2 and rx "3"mean receive from transmitter 3.
    is it my code got error?any correction for me?

    actually at the receiver pin 3 is detect pin.at the datasheet it stated may used to derive a carrier detect to enable external circuit when a signal is being received.if unused connect a 10k ohm resistor to Vcc.
    so i jz connect it directly with 10Kohm resistor to Vcc.Do u think this pin can help me in this situation?if yes,can u please gv me some guide line?


    another problem is i am dealing with a math problem. the equation as below:
    ---theta s= actan (Y2/X2)- theta 2-----
    Y2, X2 and theta 2 are known,i need to find the theta s but by using pic basic pro, i do not know how to deal with "actan"

  4. #4
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello,

    I don't fully understand what you are trying to do, or what your schematic is looking like but I would try the following:

    1. You said it only works on Transmitter 1.. That is case statement 1.

    For this, I would drop the case statement and us "IF" "Then" statements... see if that makes a difference.

    2. You have extremley long pauses after each recieve... the first 2 have 2 second pauses, the last one has 1 second pause.... Is this too long of a pause??? Is it necessary?

    3. Baudrate... 9000 Try something like 300 first.


    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

Similar Threads

  1. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  2. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 17:11
  3. Serin serout problem
    By lerameur in forum mel PIC BASIC Pro
    Replies: 336
    Last Post: - 6th February 2007, 04:25
  4. Replies: 11
    Last Post: - 13th July 2005, 19:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

Members who have read this thread : 2

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