UART vs software RS232


Closed Thread
Results 1 to 28 of 28

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    I always use a wait modifier to synch to the first byte in a packet.

    This is the line used to receive in my remote sprinkler controller using a pair of
    XStream 900MHz OEM modules;

    SERIN2 RX,84,[WAIT("A"),CMD,RlyNum,State]

    It waits for the A then grabs data. Really simple and it works.

    I would probably have used a pair of Linx LR series like Earltyso did, but I built
    the remote sprinkler controller LONG before the LR series were available.
    Regards,

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

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Ok -- I'll keep playing with it.

    I remember now why I didn't have a wait in there....because I have to keep things moving for counters and other processes....I never tried the wait command but it probably won't hurt anything....few milliseconds at most I guess.

    It just keeps ticking me off though because it works prefectly wired, so I hate to be screwing with the code.

    Thanks for the input.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    A wait with a time-out is what you need. After the time-out the code will jump to the label of you choice.
    Dave
    Always wear safety glasses while programming.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I'm out to lunch on how to use wait and timeout.

    here's my code for the receiver.....


    SERIN PORTA.4, T1200, [QUAL1, QUAL2], LOWER, HIGHER

    Works fine...looks for 2 qualifier bytes...then shows the data (lower and higher).

    Do I even need wait? Is it in there as default because I have the qualifiers?

    Also, in my PBP book it only talks about "WAIT" in the SERIN2 page ?


    If I'm doing something wrong, how would I write the line above using "wait"?

    I tried some things but got errors --

    [WAIT, QUAL1,QUAL2], ETC
    [WAIT,"QUAL1","QUAL2"] ETC

    THANKS AGAIN

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default


    That is how you WAIT using SERIN
    From the manual:
    ‘ Wait until the character “A” is received
    serially on Pin1 and put next character into B0
    SERIN 1,N2400,[“A”],B0
    You are waiting on
    [QUAL1, QUAL2]

    Now to use a time out, again from the manual
    SERIN
    Pin,Mode,{Timeout,Label,}{[Qual...],}{Item...}
    See what we can do here
    Code:
    SERIN PORTA.4, T1200, [QUAL1, QUAL2], LOWER, HIGHER
    change to this to wait on two QUALs and if QUALs are not received in 100ms, then it jumps to "LABELofCHOICE"
    Code:
    SERIN PORTA.4, T1200,100,LABELofCHOICE, [QUAL1, QUAL2], LOWER, HIGHER
    Me thinks you are looking at this to hard, relax a bit .
    Dave
    Always wear safety glasses while programming.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    You're right -- that's always the case.

    In fact, here is the conclusion.....

    I "thought" that I had my code at T1200 but it was at N1200.....BUT, I didn't really care anyway because it was my (mis) understanding that as long as BOTH pics were the same, that it didn't mean diddly squat.

    After all, it's just inversion isn't it?...and I was using CMOS inverters on my breadboard...so in my mind, I was trying it "both ways". ?

    So, anyway, I just changed both sides to T1200 (I know, that was suggested in the first place).....and all is fine.

    BUT what am I missing here?

    Like I say, when I set up my wired connection, it didn't matter if I used T1200 or N1200....as long as the were both the same.....it worked either way......so, what am I missing here?

    What a pisser.

    --Michael

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Also --

    Is there ANYTHING I can do other than changing the code to T1200?

    I have some units already out there using N1200 and was hoping to add wireless function to them.

    Again, I tried 4011's but no luck.

    When I say anything, I mean ANYTHING.

    Could I put another PIC in my wireless module and do something there?

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


    Did you find this post helpful? Yes | No

    Default

    With your wired connection you had full control over both modes so you could just program
    both PICs to send/receive in inverted or non-inverted modes.

    With the Maxstream units your only option is to program the sending/receiving PICs to use
    non-inverted modes - if connected directly to the Maxstream modules.

    If you prefer inverted mode, then a simple inverter on both ends should do the trick, but it
    has to be fast enough to handle whatever data rate you use without messing with timing.

    I would opt for a simple firmware change before adding new hardware though. Just my 2c.

    data is data
    Data is data, but inverted or non-inverted does matter. Think about about it like this -
    suppose you program a PIC to receive data in non-inverted mode. This PIC is the RF
    module. Now connect another PIC to it that you've programmed to send & receive in
    inverted mode. It doesn't work.

    If you reprogram the 1st one to use the same mode, it works. You have control over that.
    You don't with the Maxstream unit. So you program controllers on both ends to use the correct
    mode, or insert a data inverter.
    Last edited by Bruce; - 5th September 2008 at 14:35. Reason: Why
    Regards,

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

Similar Threads

  1. PIC uart basics
    By Michael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th September 2008, 19:11
  2. Software RS232 and wireless modules
    By Michael in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th August 2008, 05:27
  3. Software Stack
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2007, 10:04
  4. Replies: 3
    Last Post: - 26th November 2006, 21:47
  5. Infrared Communications over RS232 UART or with B0 interupt
    By modifyit in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th December 2005, 19:17

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