Assign Serial RS232 Logic to a CTouch Software Button?

Discussion in 'C-Bus Serial Protocols' started by paulyp, Sep 10, 2012.

  1. paulyp

    paulyp

    Joined:
    Jan 4, 2012
    Messages:
    12
    Likes Received:
    0
    Location:
    Sydney - North Shore
    Hi Guys,
    I've finally got my serial port to control my Yami amp and want to assign a button on the CTouch to send the command to the amp. I have wired the Ctouch to the amp's serial port.

    The command I have is below, is this correct and how can I make a button on the screen send the command when I press it?

    OpenSerial(1, 1, 9600, 8, 1, scNoFlowControl, scNoParity);
    delay (1);
    WriteSerial(1,'0,1,40,PUT,System(Power_Control(Power=Standby)),45'#13#10);

    Thanks very much for your help in advance!

    Paul
     
    paulyp, Sep 10, 2012
    #1
  2. paulyp

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Normally you would open the serial port in the Initialisation section of the code. Put the WriteSerial function in a module by itself and disable that module in the Initialisation section. Have the module also disable itself when complete:

    Code:
    { Initialisation Section }
    
    OpenSerial(1, 1, 9600, 8, 1, scNoFlowControl, scNoParity);
    DisableModule("Power Control");
    
    { Module called Power Control }
    
    WriteSerial(1,'0,1,40,PUT,System(Power_Control(Power=Standby)),45'#13#10); 
    DisableModule("Power Control");
    
    The button on the touch screen needs to use the Module Enable special function to enable the Power Control module.
     
    Darren, Sep 10, 2012
    #2
  3. paulyp

    paulyp

    Joined:
    Jan 4, 2012
    Messages:
    12
    Likes Received:
    0
    Location:
    Sydney - North Shore
    Brilliant, thanks very much for the advice!
     
    paulyp, Sep 11, 2012
    #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.