Copyright © 1998-2017 Luca Gallina
Free tools, hints, tips and tricks. Interesting and specialized applications are also on sale, all developed by programmers for programmers.
This tool reads position and buttons state from a common PC joystick connected to your PC and send the relevant data to a datablock in your S7 PLC (S7-300/-400 and TIA 1200/1500).
With S7joystick you can use an inexpensive PC joystick to control a device, to ease your commissioning, to test machinery.
Basic joysticks have two X-Y axis and four buttons, advanced joysticks may provide hat (or point-of-view) button, additional axis and more buttons.
Current version of S7joystick manages up to 6 analog axis, two hat buttons sets and up to 32 joystick buttons.
A sign-of-life variable is also provided in order to implement a safe communication check on PLC side.
NOTE: this utility works with Ethernet connection only,
Profibus MPI/DP connections are not supported.
We accept PayPal or wire transfer payments.
Contact us by email or use the “buy now” button.
Joystick interface area is mapped to a data block, button state and axis value can be easily accessed.
DATA_BLOCK "Joystick"
TITLE =
VERSION : 0.1
STRUCT
StatusFlags : STRUCT
JoystickActive : BOOL ; //TRUE=joystick is detected by Windows
JoystickDataValid : BOOL ; //TRUE=incoming joystick data are valid
END_STRUCT ;
SignOflife : INT ; //watchdog counter
Buttons : STRUCT
Button1 : BOOL ; //TRUE=button pressed
Button2 : BOOL ; //TRUE=button pressed
Button3 : BOOL ; //TRUE=button pressed
Button4 : BOOL ; //TRUE=button pressed
…
Button31 : BOOL ; //TRUE=button pressed
Button32 : BOOL ; //TRUE=button pressed
END_STRUCT ;
Hat1_POV : STRUCT
North : BOOL ; //TRUE=button pressed
NorthEast: BOOL ; //TRUE=button pressed
East : BOOL ; //TRUE=button pressed
SouthEast: BOOL ; //TRUE=button pressed
South : BOOL ; //TRUE=button pressed
SouthWest: BOOL ; //TRUE=button pressed
West : BOOL ; //TRUE=button pressed
NorthWest: BOOL ; //TRUE=button pressed
END_STRUCT ;
AxisX : WORD ; //0..65535, 32767=center position
AxisY : WORD ; //0..65535, 32767=center position
AxisZ : WORD ; //0..65535, 32767=center position
AxisRX : WORD ; //0..65535, 32767=center position
AxisRY : WORD ; //0..65535, 32767=center position
AxisRZ : WORD ; //0..65535, 32767=center position
AxisSLIDER1 : WORD ; //0..65535
AxisSLIDER2 : WORD ; //0..65535
END_STRUCT ;
The program, registration code and invoice will be sent via e-mail upon payment.
We normally deliver within 24 hours from payment.