Problem with serin2 serout2


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2008
    Posts
    12

    Default Problem with serin2 serout2

    Hi for all friend


    with serial communication between two 16F84A I send a varible b0 from firt To second pic
    code :
    MAIN:
    FOR B0=4 T0 200
    SEROUT2 0,T9600,[DEC1 b0]
    PAUSE 10
    NEXT BO

    GOTO MAIN

    the second pic recieved only first byte B0=4 BY


    SERIN2 0,T9600,[DEC1 b0]

    but why second pic can't recieved variable from 4 TO 200

    I USE OSC 4MHZ
    THANK YOU FOR YOUR INTERSTING

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


    Did you find this post helpful? Yes | No

    Default

    Have you tried [DEC b0] on both ends?
    Regards,

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

  3. #3
    Join Date
    Dec 2008
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    yes i try [DEC b0] but nothing changed pic recieved only first byte

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Code:
    SEROUT2 0,T9600,[DEC1 b0]
    To use 9600,n,8,1 with Serin2/Serout2, code should be:

    Code:
    SEROUT2 Pin,84,[DEC b0]
    SERIN2 Pin,84,[b0]
    What does your program after the serin2 with the byte received? Very likely the second byte arrives when receiver is not yet ready, increase the Pause to 1000 and see if it works than reduce it gradually to the optimum.

    Al.
    Last edited by aratti; - 5th March 2009 at 18:30.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default

    DEC causes numbers to be sent in ASCII format. 1 to 9 will work fine since each number will
    be a single ASCII character. When you get to 10, it sends an ASCII 1 followed by an ASCII
    0, which requires two bytes. DEC 100 will be 3 ASCII bytes, etc.

    Try something like this;
    Code:
    T9600 CON 84
    
    MAIN:
    FOR B0=4 T0 200
    SEROUT2 0,T9600,[B0] ' without modifier, sends the unformatted byte value of 4 to 200
    PAUSE 10
    NEXT BO
    
    SERIN2 0,T9600,[B0] ' can receive a value from 0 to 255
    Regards,

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

  6. #6
    Join Date
    Dec 2008
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    hi all my friends

    thank you for your reply

    yes Mr ARATTI it's works good with

    SEROUT2 Pin,84,[DEC b0]
    Pause 100
    SERIN2 Pin,84,[b0]

    thank you very much and thanks for Mr Bruce
    Although I don't try yet his code

    good luck

Similar Threads

  1. Serout and 18F87J50
    By Glenn_Webber in forum Serial
    Replies: 8
    Last Post: - 20th November 2009, 14:26
  2. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 02:38
  3. Serout2 and Serin2 problem
    By MrSafe in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th July 2007, 04:33
  4. SEROUT2 and SERIN2 commands
    By bangunprayogi in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th August 2005, 09:03
  5. Simple PC Menu System with Serin2
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd April 2005, 08:27

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