@csllc/cre3100-cli
v3.0.6
Published
CRE-3100 Command Line Interface
Downloads
15
Keywords
Readme
cre3100-cli
Command Line Utility for CRE3100
To use as a diagnostic utility
Installation: Install NodeJS 8 (e.g., 8.17.0) for your platform (http://nodejs.org)
Navigate to your home folder on your PC's filesystem or whever you save projects and execute the following commands.
git clone [email protected]:csllc/cre3100-cli.git
(requires SSH key to be set up with GitHub account)
cd ./cre3100-cli
npm i
The cre
, mdc
, slc
, and ssb
scripts will be available from this directory and must be executed using node
.
If you receive an EACCES error, you may need to fix your permissions (https://docs.npmjs.com/getting-started/fixing-npm-permissions) and then retry the installation.
Several utility programs are provided: slc : used when interfacing directly to the SLC card, via an RS-485 cable. ssb : used when interfacing directly to the SSB card, via an RS-485 cable. cre : used when interfacing to the system, or the MDC, via a UART cable.
The utility programs have similar use and command line options. To display the online help, use the -h command line option:
node ./slc -h
node ./ssb -h
node ./cre -h
Connect the adapter cable between your PC and the system or card. The adapter cable will appear as a 'COM' (serial) port on your computer. To find the name of the port, use the cre -l
(list ports) option with the cable disconnected; then connect the cable and run the same command again. You should see a new device (COMxx) appear when the command is run with the cable connected. If you do not see the COM port, troubleshoot cable driver installation.
To set the port used by the utility applications, you can either specify it on the command line (cre slaveId --port=COM23
for example), or set it as an environment variable:
set MODBUS_PORT=COM23
for Windows PCs
export MODBUS_PORT=/dev/cu.usbserial
for Macs
This will cause the any command run in that command prompt to use the specified port. By opening multiple command prompts and setting the MODBUS_PORT variable, you can monitor multiple systems from the same PC.
The environment variable setting lasts until the terminal window is closed. You can set environment variables permanently on your PC (use google to find instructions).
To Use as an Interface Library
You can use this package as a library to facilitate communication with a CRE-3100 via a serial-port type connection.
The basic steps are as follows:
Install the package in your nodejs project:
npm install csllc/cre3100-cli.git --save
Establish the physical connection to the device (this may be any of the connection types supported by the cs-modbus library (serial, TCP, etc)).
Create an interface object, supplying the physical connection instance, and the configuration for the MODBUS master. The configuration options are those supported by the cs-modbus library (https://github.com/csllc/cs-modbus)
The interface object will emit a 'connected' event when its initialization is complete (this does not actually communicate with a slave device; it is a confirmation that the initialization is complete and the master is ready to send messages).
An example of reading and writing configuration can be found in examples/generic-simple-serial.js