https://github.com/otti/espadslib
Simple Beckhoff ADS communication for ESP
https://github.com/otti/espadslib
ads arduino beckhoff esp esp32 library twincat
Last synced: about 1 year ago
JSON representation
Simple Beckhoff ADS communication for ESP
- Host: GitHub
- URL: https://github.com/otti/espadslib
- Owner: otti
- Created: 2022-09-15T14:03:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-31T19:09:28.000Z (over 1 year ago)
- Last Synced: 2025-04-12T04:12:53.923Z (about 1 year ago)
- Topics: ads, arduino, beckhoff, esp, esp32, library, twincat
- Language: C
- Homepage:
- Size: 236 KB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple ESP library for Beckhoff ADS
## Features
* Base functions
* Ads Read
* Ads Write
* Ads ReadWrite
* Convenience functions which are based on the functions above
* Ads WritePlcVarByName
* Ads ReadPlcVarByName
* Ads ReadCoe (with and without complete access)
* Ads WriteCoe (with and without complete access)
## How to install
Download this repository as zip file and import it to the Arduino libraries.
(Sketch -> Include Library -> Add .ZIP Library)
## Usage
* Set WiFi SSID and password in the example .ino file
* Set the SrcAmsAddr to the IP address of your ESP followed by `1.1`.
* In the TwinCAT "Add Route Dialog" of the target machine you have to add the IP of this ESP.
Make sure, that you have set the "Remote Route" to "None"
### Writing CoE Values
Set the DestAmsAddr and the port in the code to the AmsAddr of the slave you want to access.
### Writing PLC variables
Set the DestAmsAddr in the code to the AmsAddr of the target. This usually ends with `.1.1`
Set the port to the port of your PLC. The first PLC usually has port 851 on TwinCAT3 and 801 on TwinCAT2.
The port is also available as define. (`AMSPORT_R0_PLC_TC3`)
## Limitations
To save some memory, the lib can read and write a maximum ammount auf 64 bytes.
This value can be increased by overwriting the `#define ADS_MAX_DATA_SIZE` in ads.h
## Current status/To Do
* The Lib is tested insufficiently
* Should work with ESP8266, but not tested
* The ADS Read, Write and ReadWrite function are mostly identical. With some affort this three functions can share the same code.
## Debugging
* For some debug outputs on the serial console set `#define ADS_DEBUG_PRINT_ENABLE = 1`
* DebugPrintHex() can be used to print a hex dump in a format like a hex editor