Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sun Nov 19, 2017 8:58 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Networking G70
PostPosted: Wed May 10, 2006 1:05 pm 
Offline

Joined: Mon May 01, 2006 3:27 pm
Posts: 60
I am a newbee to Qlarity but have learned alot in the past week. My project is a light control panel with buttons and sliders that communicate throught the serial port to a microcontroller. So far its all working great.



Question:



How difficult is it to network the G70 so when one G70 is changed the others will also display the changes ?



It may be to much for me but I thought I would ask, Maybe I have to mich time on my hands..



Jerry


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 8:10 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Well what you are asking is possible, but may require a bit of work on your end.



I am going to assume that you are interested in getting the G70s to display the same data rather than the exact same pixels. (The latter is possible but a bit more involved).



To start with, let us assume the following topology



Code:

***********     ********

* Light   *_____* Main *

* Control *     * G70  *

***********     ********

                    |

                    |

      +-------------+----------+

      |             |          |

      |             |          |

  **********   **********  **********

  * Client *   * Client *  * Client *

  * G70    *   * G70    *  * G70    *

  **********   **********  **********





Let's start the discussion assuming that there are two sepearate Qlarity applications (these could use the same code base with some care, but start out with two separate applications until you are comfortable with what is going on). The Main app you have already started and have talking to the light controller. The Client app you will start new right now.



To start with, add an EthernetServer object to the main application. Set it up for UDP (this will be easier to deal with initially -- we can change to TCP later if you prefer). Set "enabled" and "startconnection" to true and pick a local port.



Next, handle the DataReceived event of the EthernetServer.



Code:

func datareceived(channel as comm, data[] as byte, ipaddr[] as byte, foreignport as integer)

    dim txData[] as byte



    'If we use TCP, we technically need to buffer and parse the buffer here.

    'For UDP this is sufficient as UDP is packet oriented.

    if data == "query" then

        'Run whatever code you need to to setup txData with your RED, GREEN, and BLUE arrays

        'along with any other data you wish to transfer

        txData = "data: red=1,2,3,4" 'i.e. change this line

        Transmit (channel, txData, false)

    endif

endfunc





Now, in the Client (new) workspace, add an EthernetClient object. Set it to talk UDP, and set the target IP address to be the IP of your Main G70. All other default properties should be sufficient.



Next, add a TimerV2 object. Set the time period to 1 second. In it's Timeout event, add the following code:

Code:

func timeout()

    EthernetClient_1.SendData = "query"

endfunc





Now, add a large label object. Next add a Data Received event to the EthernetClient.

Code:

func datareceived(data[] as byte)

    if left(data, 4) == "data") then

        label_1.value = data

    endif

endfunc





Now, if you run this on both terminals, you should see the data update on the client G70. Hopefully from here you can see how you could further parse the data and place it in controls like sliders. You can also send data from the Client G70s to the Main G70 for it to update its arrays and the light controller as well.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 9:38 am 
Offline

Joined: Mon May 01, 2006 3:27 pm
Posts: 60
Thanks I will order another G70



Jerry


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 12, 2006 8:53 am 
Offline

Joined: Mon May 01, 2006 3:27 pm
Posts: 60
I assume I use a Router between G70 ?



Jerry


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group