================================================================================================
This project demonstrates MODBUS RTU communication using ClearCore's Arduino wrapper. 

To use this project in its entirety, you will need:
2x Teknic ClearCores
1x Velocio HM-043AE Touchscreen HMI
1x RS-485 to UART/TTL converter
1x Teknic ClearPath-SD series servo
All required cables and power supplies (24VDC for ClearCore/HMI power, 24-75VDC for ClearPath)

The documentation in this example does not show wiring for power or programming. Refer to 
individual product manuals for this information.

ClearCore is used as both a MODBUS master (client) and a slave (server). The Velocio HMI is the 
master with CC-MBdisp being the slave. CC-MBdisp is also a master with CC-MBmtr being the slave.

See more documentation within the CC-MBdisp folder, CC-MBmtr folder, wiring folder, as well 
as the various Arduino/C++ files.
================================================================================================

All ClearCore code is written to be compiled within the Arduino IDE. Run the ClearCore installer
for Arduino first:
https://teknic.com/files/downloads/ClearCore_Arduino_Wrapper_Installer.zip

ModbusRTU and AppTimer must be installed (manually copied) as libraries (to "C:\Users\_____\Documents\Arduino\libraries").
These are both located in libraries.zip 
You can simply extract this zip file to the file location above.

NOTE: Both the CC-MBdisp and CC-MBmtr applications share some data. The data is in file "shared.h"
     but Arduino won't let 2 applications include the same file. So a 'master copy' is kept
     at <base_dir>\shared.h along with local copies in each application's folder.
     So any changes must occur in <base_dir>\shared.h, then the command 'copy_shared.bat' 
     must be run to copy the updated version to both applications.

About Arduino Builds (including libraries)
     https://arduino.github.io/arduino-cli/0.19/sketch-build-process/
     
About Arduino Libraries
     https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/how-to-install-a-library
=============================================================================================================

ClearPath-SD servo motor setup

 * 1. The connected ClearPath motor must be configured through the MSP software
 *    for Step and Direction mode (In MSP select Mode>>Step and Direction).
 * 2. The ClearPath motor must be set to use the HLFB mode "Servo On" through the
 *    MSP software
 * 3. Set the Input Format in MSP for "Step + Direction".
 *
 * ** Note: Set the Input Resolution in MSP the same as your motor's Positioning
 *    Resolution spec 
 *    [e.g. 800 or 6400 (NEMA 23/34), 4000 or 32000 (NEMA 56,143, IEC D100)]
 *    Change "MTR_CNTS_PER_REV" in CC-MBdisp.h to match. When the HMI runs, this 
 *    will change the "Scale Factor" in the setup screen. References to "Unit" 
 *    in the HMI program now correspond to a revolution of the motor shaft.
 *
 * Links:
 * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
 * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
 * ** ClearPath Manual (DC Power): https://www.teknic.com/files/downloads/clearpath_user_manual.pdf
 * ** ClearPath Manual (AC Power): https://www.teknic.com/files/downloads/ac_clearpath-mc-sd_manual.pdf
=============================================================================================================
