Reacting to a Receive Sequence - Sample Project: PingPong.ptp

<< Click to Display Table of Contents >>

Navigation:  Examples and Tutorials >

Reacting to a Receive Sequence - Sample Project: PingPong.ptp

The Docklight project PingPong.ptp is a simple example for how to define and use Receive Sequences.

 

Getting started

 

Go to the PROPERTIES Project Settings... dialog and choose a COM port.

Apply a simple loopback to this COM port: Connect Pin 2 (RX) with Pin 3 (TX). See RS232 SUB D9 Pinout.

Now press the Pt_Send_Button Send button for either of the two Send Sequences. Communication is started and the Send Sequence is transmitted. It will of course be instantly received on the COM port's RX line.

 

Docklight will detect the incoming data as being one of the defined Receive Sequences. It will then perform the action predefined for this event, which is sending out another sequence. As a result, Docklight will send out alternating Send Sequences - "Ping" and "Pong".

 

Use the stop Stop communication button to end the demo.

 

The Docklight communication display should look similar to this:

 

3/8/2009 16:25:44.201 [TX] - ----o Ping

3/8/2009 16:25:44.216 [RX] - ----o Ping "Ping" received

3/8/2009 16:25:44.218 [TX] - o---- Pong

3/8/2009 16:25:44.233 [RX] - o---- Pong "Pong" received

3/8/2009 16:25:44.236 [TX] - ----o Ping

3/8/2009 16:25:44.251 [RX] - ----o Ping "Ping" received

3/8/2009 16:25:44.254 [TX] - o---- Pong

3/8/2009 16:25:44.268 [RX] - o---- Pong "Pong" received

3/8/2009 16:25:44.271 [TX] - ----o Ping

3/8/2009 16:25:44.286 [RX] - ----o Ping "Ping" received

3/8/2009 16:25:44.289 [TX] - o---- Pong

3/8/2009 16:25:44.303 [RX] - o---- Pong "Pong" received

3/8/2009 16:25:44.307 [TX] - ----o Ping

3/8/2009 16:25:44.322 [RX] - ----o Ping "Ping" received

3/8/2009 16:25:44.324 [TX] - o---- Pong

...

 

See also the corresponding log files in the \Samples folder (PingPong_Logfile_asc.htm and PingPong_Logfile_hex.htm).

 

Further Information

 

This demo project can also be run in three alternative configurations:

 

1.Run two Docklight applications on the same PC using different COM ports. The two COM ports are connected using a simple null modem cable.
2.Instead of two RS232 COM ports and a null modem cable you can use a virtual null modem.
3.Use two PCs and run Docklight on each PC. Connect the two PCs using a simple null modem cable.

 

TIP: For Docklight Scripting there is also a related example project that uses a UDP loopback connection, and does not require any serial data ports. See the PingPong_UDP_Loopback.ptp project in the \Network folder of the \ScriptSamples directory.