Campbell Hausfeld SDM-CAN Manual Do Utilizador

Página de 74
Section 4.  Programming CRBasic  
Dataloggers to use the SDM-CAN 
This chapter describes how to program the CR5000/CR9000X and older CR9000 dataloggers, 
using CRBASIC language, to control the SDM-CAN interface. Similar principles can be 
followed for newer CRX000 dataloggers that include the SDM-CAN instruction in their 
operating system. 
4.1  General Principles 
Some newer dataloggers use the CRBASIC programming language. CRBASIC 
incorporates an instruction which is virtually identical to P118, described in 
Section 3. To avoid duplication this section of the manual simply references the 
relevant paragraphs in that section. For this reason you are advised to read section 
three in its entirety to gain a full understanding of all the general principles and 
parameter settings. 
Currently neither the CR5000, CR9000X nor CR9000 support interrupt driven 
events as described above. However, with the extra speed of these dataloggers, a 
similar function can be achieved by polling a digital input and only executing the 
instructions required when the port is high. The consequences of doing this in 
either the slow or fast tables needs to be considered, especially when trying to 
synchronise this data with analogue measurements. 
4.1.1 High Speed Block Mode 
Operating system Version 3 supports a new high speed block mode for SDM 
communication that allows much faster data transfers to the logger. This was 
implemented for the CR9000 and CR5000 to allow users to run a program at more 
than 200Hz with the SDM-CAN. It gives a 5 fold improvement in performance 
over normal mode. Block mode operation is activated by using data types 65 to 
70; these are the block mode equivalents of data type’s 1 to 6. When block mode 
is active then all CAN data is collected at  the beginning of the scan in parallel 
with analogue measurements. There are a number of restrictions when using block 
mode. There is a limit of 128 values that can be read in total. Other restrictions are 
logger specific. On a CR9000 - firstly you can only have one differently addressed 
SDM-CAN in each scan unless all other differently addressed SDM-CAN’s are 
using normal mode data types 1 to 6. Secondly you cannot use conditional 
statements with SDM-CAN instructions which are enabled for block mode. 
Restrictions for use with the CR9000X/CR5000 are that you must keep all block 
mode instructions together and not intermix normal mode instructions within the 
group of block mode instructions. You can however put normal mode instructions 
in front or after the group of block mode instructions. You cannot use conditional 
statements on either normal or block mode SDM-CAN instructions. 
Time to execute block mode for a CR9000 in milliseconds with maximum bus 
speed `SDMSpeed(0)’ is approximately = 1.50 + 0.1 * n bytes of data. 
Time to execute block mode for a CR9000 in milliseconds with default bus speed 
is approximately = 2.07 + 0.207 * n bytes of data. 
Time to execute block mode for a CR5000 in milliseconds with maximum bus 
speed `SDMSpeed(12)’ is approximately = 1.60 + 0.108 * n bytes of data. 
4-1