![RoboteQ CANBus Series User'S Reference Manual Download Page 23](http://html1.mh-extra.com/html/roboteq/canbus-series/canbus-series_users-reference-manual_1471291023.webp)
CANBus Networking Manual
23
RoboCAN via MicroBasic Scripting
Below is a sample script that continuously reads and print the counter value of node 4
top:
FetchCANValue(4, _C, 1) ‘ request data from remote node
while(IsCANValueReady = false) ‘ wait until data is received
end while
Counter = ReadCANValue() ‘ read value
print (Counter, “\r”) ‘ print value followed by new line
goto top ‘ repeat forever
Continuous Scan
In many applications, it is necessary to monitor the value of an operating parameter on a
remote node. A typical example would be reading continuously the value of a counter. In
order to improve efficiency and reduce overhead, a technique is implemented to automat-
ically scan a desired parameter from a given node, and make the value available for read-
ing without the need to send a Fetch command.
A function is provided to initiate the automatic sending of a value from the remote node,
at a specific periodic rate, and to be stored to user selected location in a receive buffer.
The remote node will then send the data continuously without further commands.
A function is then provided to detect the arrival of a new value in that buffer location, and
another to read the value from that location.
Since the scan rate is known, the execution of the script can be timed so that it is not
necessary to check the arrival of a new value.
Request value to be issued at
every t ms, to buffer location n
[Check if new value arrived]
Read from Scan buffer
Remote node
Local Scan Buffer
A scan is initiated with the function:
ScanCANValue(id, cc, ch, tt, bb)
Where:
id is the remote Node Id in decimal