This is a sample project for automatically mounting multiple USB sticks on a B&R PLC. The task creates a file device with the name "USB_DEVICE1", "USB_DEVICE2", "USB_DEVICE3", ... This device name can the be used with all libraries that support files devices, e.x. FileIO. See How to import the user management into an existing project.
Download the latest release from here.
When a USB stick is unglugged during a writing procedeure it is important to stop the write process. If the write process is not stopped the stick can not be disconnect properly and will not reconnect when plugged back in. The task uses a variable structure to communicate with the outside world that can also be used to interact with other tasks. The structure USB looks as follows:
Level 1 | Level 2 | Level Description | ||
CMD | Used to trigger commands. | |||
---|---|---|---|---|
auto_scan | Automatically scan for USB sticks when enabled. | |||
error_reset | Reset pending erros | |||
PAR | Parameters tructure | |||
ignore_dongle | Ignore B&R license dongle | |||
refresh_interval | Check for USB stick every 3s (value 300) | |||
is_connected | Shows if a USB stick was detected. | |||
ERR | Information about errors | |||
state | State where the error occurred | |||
text | Error text | |||
status | Current status |
- Automation Studio 4.5
- Automation Runtime D4.52
Recommended task class is #8 with a 10ms cycle time.
- Remove state variable from PAR structure
- Added status variable to main structure
- Fixed USB reconnect issue
- Fixed USB reconnect issue
- Support for multiple USB sticks
- Initial commit