Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Mon Nov 20, 2017 2:18 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Oct 28, 2009 1:28 pm 
Offline
User avatar

Joined: Wed May 10, 2006 7:25 am
Posts: 26
Location: Nashvegas, TN
Hello,

I am planning on doing a project with a Z60 that involves alot of communications on an RS-485 network. There will be up to 25-30 Z60's connected on the network and data is sent pretty constantly (although sporadic). Only occassionally will the actual data be for any one single unit (they will be addressed).

From my understanding and previous experience with the communications on your terminals (being single threaded) do you think this will cause problems with the operation of the Z60's?

For example if I am receiving data, will my Z60 not respond to user input on the screen?

Thanks.


Top
 Profile  
 
PostPosted: Thu Oct 29, 2009 7:30 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
This will depend very heavily on what you are doing with the data.

One thing to emphasize, is that while the Qlarity runtime is single threaded, the terminal itself uses many threads. Serial I/O (the actual transmitting and receiving characters on the line) does not occur in the Qlarity runtime thread, although the Qlarity thread does need to process the serial data to do useful work.

Lets look at a hypothetical serial protocol to illustrate:

Imagine a protocol where each message consists of:
[*]2 bytes address (hex string 00-FF)
[*]N bytes of data
[*]\r (carriage return) packet seperator

Now, imagine that your Qlarity terminal has this code:

'Global:
Code:
dim terminalID as string
init terminalID := "03"

Code:
'In a BasicSerial object
func DataReceived(data[] as byte)
    dim pos, oldPos as integer
    dim pktAddress as string
    buffer := buffer + data
    pos = find(buffer, 0, -1, ";")
    while pos > 0 do
        'Quickly check if this packet is for us.  if so process it, if not ignore it
        pktAddress = mid(buffer, oldPos, 2)
        if (pktAddress == "FF") or (pktAddress == terminalID) then 'Assumes FF is a broadcast address
            'Process the packet here
        endif

        oldPos = pos+1
        pos = find(buffer, oldPos, -1, ";")
    loop

    if oldPos > 0 then
        buffer = mid(buffer, oldPos, -1)
    endif
endfunc


This should quickly and efficiently ignore any data not directed at the Z60 while still catching any packets that are addressed to it. Unless your protocol is using enormous packets (10k bytes+) you would not notice any UI slowdown, even under a moderate amount of network traffic.

(There optimizations that can be performed to handle even large packets efficiently, they just take some more code and huge packets are fairly rare).

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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