<< Previous          Next >>

Page 2

Put 2 PGraph2D components and change it properties as below.
       
        Value expression : m0, Quantity of monitor : 1, range from 50 to 100 (to display the 200 second history of humidity of climate room #1 in Hex. value)
       
        Value expression : m1, Quantity of monitor : 1, range from 20 to 40 (to display the 200 second history of temperature of climate room #1 in Hex. value)

Note : "Device polling period" property will have no effects in HD13xx applet (or application).

Add a Serial gate button to trigger the climate controller and receive the climate data. Assign its property as following so that it can periodically (period : 2 sec.) send and receive a data.
       
The serial protocol s1 and r1 will be defined later.

Put a Page jump button and set its text as "Back to the previous page" and set its jump page to "0".

Arrange components and resize them. The page 2 is finished.
       

Serial protocol definition

Click on "Serial protocol setup" button or select "Serial protocol" from "Setup" menu and add 2 new 'send' protocols and 2 new 'receive' protocols and edit them.
The list of 4 protocols are as following.
       

Page 1

The triggering command 's0' is constant value 02,05,03 in Hex.

And the corresponding receive data format 'r0'is 

with Acknowledge 0x06 and 1000 milliseconds of timeout.

When the Serial Gate Button in the first page is pressed (the send protocol symbol is 's0' and the receive protocol symbol is 'r0', event repeat with the period of 7 sec.), the applet will send data 0x02,0x05,0x03 periodically to the climate controller and the controller will reply immediately. The received data will contain 8 ASCII values that are the temperature and the humidity of 4 climate rooms and the length of each ASCII values are not known and separated by a comma (0x2C in Hex.). These ASCII values will be displayed in the Serial Label components in the first page. The received data also contains the temperature and the humidity value of room #1in Hex, form in the end of the data. These Hex. values will be displayed by the Horizontal Bar Gauge components in the first page also. The event repeating period is 7 seconds so that the graph will update its display value in every 7 seconds. 0x02 in the head and 0x03 in the tail of received data indicates the begin and the end of the data.

Page 2

The triggering command 's1' is constant value 02,06,03 in Hex.

And the corresponding receive data format 'r1' is 

with Acknowledge 0x06 and 1000 milliseconds of timeout.

When the Serial Gate Button in the second page is pressed (the send protocol symbol is 's1' and the receive protocol symbol is 'r1', event repeat with the period of 2 sec.), the applet will send data 0x02,0x06,0x03 periodically to the climate controller and the controller will reply immediately. The received data contains the temperature and the humidity value of room #1in Hex, form in the end of the data. These Hex. values will be displayed by two PGraph2D components in the second page. The event repeating period is 2 seconds so that the graph will update its display shape in every 2 seconds. 0x02 in the head and 0x03 in the tail of received data indicates the begin and the end of the data.

Note : While one of Serial Gate Button is pressed and repeating sending and receiving data, every another Serial Gate Button will be disabled.

<< Previous          Next >>

href="samplehd1300-climate-2.htm">Next >>