Serin2 and Serout2 with or without level converter


Closed Thread
Results 1 to 2 of 2
  1. #1
    fbestepe's Avatar
    fbestepe Guest

    Default Serin2 and Serout2 with or without level converter

    Hi everyone,

    The project on which I am studying has two main parts.
    1)- Data communication between PC and Pic
    and
    2)- Data communication between Pic and Electronic Electricity Meter (that has an rs232 com. port).

    As a summary, The PC will send something to Pic via UART (Hserin) in order to get data from Electricity Meter, then Pic will send something to Electricity Meter(Serout2) and after that the Pic will receive what the meter send (Serin2) and finally Pic will send whatever it received from Meter to PC (Hserout).

    Everything is OK about between PC and Pic. Now I am trying to make a data sending and receiving process between Pic and Meter. My related code is as below:

    a var byte[16]

    Serout2 PortC.2,27889,[47,63,33,13,10] ' 300 baud, Inverted logic
    pause 20

    Serin2 PortC.3,27889,2000,hata,[str a\16]
    pause 10
    Hserout [str a\16]

    pause 20

    for i=0 to 15
    Lcdout a[i]
    next i


    According to its communication protocol, the meter should sent 16 characters as meter identification with 300 baud, after receiving /?! <CR><LF> (Hserout[47,63,33,13,10]) , but instead it sends NULL characters (that is, 0 of Ascii table) to the pic. I used 22K and 1K for Serin2 and Serout2 for the connection between pic's ports and meter's rs2332 port ( and of course, pic's Rx to meter's Tx and pic's Tx to meter's Rx and also ground) . The mode must be 27889 for 7N1,300 baudrate (as required in the meter's communication protocol) and inverted logic.

    What should be the problem or solution? I will be pleased very much to hear all of your comments and suggestions.

    Sincerely,
    Firat.

  2. #2
    atomski's Avatar
    atomski Guest


    Did you find this post helpful? Yes | No

    Default

    Firat,

    First of all try to troubleshoot what's happening by connecting your PC directly to the meter, sending the quiery sequence and observing the response. If you get nulls you'll know the meter is not responding to the quiery. If you get the expected response, connect the PIC to the PC and see if it's sending the quiery string correctly... I guess I didn't help much but this way you'll be sure your hardware is working properly and that's a start...

    --
    Sincerest regards,

    YZ7REA Vladimir M Skrbic
    4N7ATV Repeater Administrator
    YU7GHZ Radio Club President

Similar Threads

  1. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 02:38
  2. Serin2 pass through to Serout2
    By scottl in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th November 2007, 19:17
  3. Serin2 and serout2
    By abood in forum Serial
    Replies: 0
    Last Post: - 12th August 2005, 09:59
  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 : 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