PACA rs232 pecularity

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by nickrusanov, Dec 29, 2010.

  1. nickrusanov

    nickrusanov

    Joined:
    Aug 5, 2004
    Messages:
    308
    Likes Received:
    0
    Location:
    russia
    I try to connect PACA with third party controller using it's RS232 port

    I have the most simple code:
    ----
    Initialisation
    OpenSerial(2, 2, 9600, 8, 1, scNoFlowControl, scNoParity);

    Module
    once (GetLightingState("test") = ON) then
    begin
    WriteSerial(2, '0304on'#13#10);
    end;

    once (GetLightingState("test") = OFF) then
    begin
    WriteSerial(2, '0304off'#13#10);
    end;

    ----

    Strange thing is that it works perfect, while in PICED operation mode with computer COM port 2.

    When uploaded to PACA it works only first time when I change group "test". It sends normal command. But after that it only sends this first command ok, but not second. For example if I turned "test" ON, 0304on is sent. Then I turn "test" OFF - nothing happens, turn ON again - 0304on. And vice-versa, if first command after PACA loads it "test OFF" then only 0304off is sent fine, cannot get 0304on.

    could anyone explain, why does this happen, how can I change it? thank you!

    UPD:
    PS. It looks like second command is being sent, but somhow it's different from the first one, so receiving controller does not understand it...
     
    Last edited by a moderator: Dec 29, 2010
    nickrusanov, Dec 29, 2010
    #1
  2. nickrusanov

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,315
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hello Nick
    I was looking at your post hoping to learn something and I was wondering if the CR and LF needs to be '#13'.
    I think I remember needing the extra appostrophies.
    WriteClientSocket(1, 'Q0,2,-,-'#13'');
     
    DarylMc, Jan 2, 2011
    #2
  3. nickrusanov

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Putting the #13 within the apostrophes will result in the characters '#', '1' and '3' being sent, which is not what is required.
     
    Darren, Jan 15, 2011
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.