- Firmware is fully compatible with the controller board AMC1.5 (and AMC1.6) by Thanos.
- To configure the firmware can use either a standard terminal program, or special management program - xSimCTRL.exe, supplied with the firmware.
- The firmware uses the modified control algorithm, in contrast to a simple proportional control is used in the original firmware Thanos.
- The speed of the COM port - 115200.
- To control the motors of a 5-byte command in the format:
0x41, 0x42, 0xFF, a0, a1.
- The firmware implements two channel PWM (10 bit resolution), designed to control DC motors through a fee Tronigr's DIY Simple Dual Mosfet H-Bridge. PWM frequency - 18 kHz (18 MHz quartz).
- Period of the main program loop 3.57 ms for the 18 MHz quartz
- During operation of the controller on the LCD displays the following information (in a row for each axis control):
a given position (0 .. 255), sensor readings (0 .. 255), the level of the PWM (-1023 .. 1023), the current Kp
In this case a negative value means the PWM motor rotation in the opposite direction.
- Apply a modified algorithm of the survey feedback sensors (potentiometers). In the firmware includes software thresholds, designed as to limit the working range of the sensors, and for inverting the feedback signals, which can be important when using a Hall sensor. At the same time on the leg ARef microcontroller must be filed with the voltage of 5V.
- Partially supports incremental encoders as the feedback sensors.
2. Description of the control algorithm motors.
At each step of the control (the period of 3.57 ms), the computation of the error of positioning:
Error = SetPos - CurrSens
where
SetPos - position received from x-sim software.
CurrSens - the current value of the sensor feedback (motor current position).
With the implementation of the classical algorithm P-control action is calculated by the formula:
PWM = Error * Kp
where
PWM - the new value of the control signal output,
Kp - coefficient of proportional control.
The modified control algorithm is implemented in this version, as follows:
PWM = minPWM + Error*KpX
where
minPWM - the minimum level of the PWM to the motor,
KpX - dynamically modifiable factor proportional control.
Coefficient minPWM is a constant defined by the user during setup. Setting the value of this coefficient is greater than zero may be true in the case when to start the motor is required to attach to it a high enough voltage.
The coefficient selected KpX program of the two user settable coefficients - KpLo and KpHi. Selecting one of these parameters is carried out when receiving a control command to the new provisions of the axes. In this case, first calculate the absolute value (modulus) of the difference between the new position given Pos (n) and the previous one given position Pos (n-1), and then are selected by the condition:
IF abs( Pos(n) – Pos(n-1) ) > KpTh then
KpX = KpHi
Else
KpX = KpLo
where
KpTh - the threshold value defined by the user.
Thus, the large differences between the new and the previous position specified as the ratio of n-regulatory factor chosen KpHi, and for small - KpLo. This makes it possible to configure different factors in order to prevent overshoot on sharp movements of the axis, not missing in this small vibration.
Upon reaching the axis of the engine it shuts down the specified position.
In addition, to prevent the rocking axis of the non-precision positioning introduced an additional parameter that defines the "dead" zone - minD. If the deviation of the values of the sensor feedback from the given position does not exceed ± minD, the engine is turned off.
By default, the firmware, the following coefficients:
KpLo = 20
KpHi = 10
KpTh = 5
minD = 2
minPWM = 0
Note that when setting KpLo = KpHi, minPWM = 0 and minD = 0, the modified control algorithm is transformed into a classic that is implemented in firmware Thanos.
3. Parameters of feedback sensors (potentiometers)
This firmware implements the following algorithm for processing feedback signals received from the potentiometers.
For each axis of the introduction of two thresholds - SensLo and SensHi. If the sensor readings will be less than the value SensLo (or, respectively, greater than SensHi), the engine stops. And will only move in the opposite direction. Thus, the user can limit the working area of the sensor. In this case the remainder of the range of values between SensLo SensHi and converted into a scale of 0 .. 255.
With the help of the coefficients and SensLo SensHi can also of invert value of the sensor. It's enough to set the value SensLo MORE than SensHi
By default, the firmware, the following values of the coefficients for the two axes:
SensLo = 45
SensHi = 210
These settings allow for potentiometers with an angle of 270 ° to keep the working area of 180 °. In this work area is located in the center of the potentiometer.
If you want to "flip" the sensor, set it SensLo = 210, SensHi = 45
These policy guides are designed to prevent mechanical damage to the sensor in the "flight" through the axis of the extreme positions.
4. The use of incremental encoders
The kit includes the software version of the firmware, which supports the encoders as sensors feedback.
Encoders to be connected to port B of the microcontroller:
PORTB0 .. PORTB1 - the first channel encoder control
PORTB2 .. PORTB3 - the second channel encoder control
To restrict the movement of the axis should be included in the scheme of limit switches applying logic 0 level at operation on port A of the microcontroller
PINA4 - upper switch of Channel Management
PINA5 - the bottom of the first channel control switch
PINA6 - upper switch of the second channel management
PINA7 - the bottom of the second channel switch control
In connection with the firmware included in the encoder initial calibration procedure, which is run by applying 0 (button) on the leg 2 port A. The axis of the sink way down in the trailer and the program fixes the zero position.
The calibration procedure can be caused by feeding the controller messages
0x41, 0x42, 0x7F, 0xXX, 0xXX.
Encoders must be calibrated in a pair, or if at least one axis of the trailer can not be found - the controller has completed the calibration procedure. Exit - just reset the device.
The range of the encoder is configured strictly as firmware, but not in the terminal. Now for the encoder is 1024 pulses per revolution of the range of the angle - 180 °.
5. Using the DIP switches
Dip-switch number 1 (PORTB4) is designed to convert AMC in edit mode parameters using a terminal program.
When editing parameters do not need to enter a value that should not be edited. In response to a query about editing simply press the keypad. Enter to move to the next editable parameter.
Dip-switch number 2 (PORTB5) is designed to determine the mode of positioning axes at the start of the controller.
If the switch is set to "0", then when you turn on the controller will move the axis of the middle position (position = 127). Otherwise, the position of the axes when you turn on the controller will not be changed.
6.Description of program management xSimCTRL
The program is designed to receive data from the AMC Thanos with the firmware from the ALE-SOFT ver.2.0
The program allows you to generate control commands and transmit them to the controller board via RS232. As well as receiving data from the controller to display them as graphs, write a text file for further analysis.
Starting with version 2.0 of the program the opportunity to adjust rates in the firmware of the controller, which is an alternative to the use of the terminal.
The main window is shown in Fig.
In fact the appointment of government is clear from their names. In the menu "Settings" to configure the COM port settings - 115200, 8, 1, no parity.
Managing a graphical representation
When pressed RMB (right mouse button) is a graphic image shift. When pressed LMB - scaling. At the same time to zoom down the need for coatings to hold the mouse left to right.
The data, trapped in ZoomBox «thrown open" to all of the window. If you hold down LMB to hold the cursor right to left, then the graph returns to its original scale.
In addition to scaling the image, you can use the mouse wheel.
Sending and receiving data
The transfer of control commands on the AMC begins after you check the box "to include the transfer of" the period specified in the "period (ms)." The user has the ability to specify the position of the axis, either manually or using a software generator, a separate controller for each axis
After you check the box "include taking" the controller goes into transfer mode "telemetry" data to the computer Check the "start recording" includes forwarding the received data to the clipboard image data for output on a computer screen. Buffer Size - or rather, the recording time is specified in the appropriate edit box.
Editing the parameters of the controller
Editing the parameters of the controller is made by introducing new values into the appropriate fields of the program. At the same time transfer the edited parameter to the controller by pressing the key Enter.
The "Save Settings" is intended to make the controller commands save the new setting in the EEPROM. Retained only the data that have been transferred to the controller when editing.
About atmega8535 fuses look...
http://www.x-sim.de/forum/viewtopic.php?f=39&t=237&start=80#p2895
This is small demonstration of new firmware features in video
More videos about using this software you can found here (Thanks to Thanos)
http://www.x-sim.de/forum/viewtopic.php?f=39&t=132
Some words about dip-switch configuration. When I say about dip-switces - I (as programmer

The startup sequence for using Alt. firmware with terminal progpam (mode TTY, DIP-Swith 1 is OFF)
- set dip-switch 1 OFF (attention! You must change dip-switches before powering AMC, because FW read its position once, when starting)
- connect AMC to PC, set AMC power ON (on LCD line "TTY editing mode"),
- execute the terminal program on PC,
- open and setup COM-port in terminal. You will see empty terminal screen, because the prompt message from AMC was received before program executing.
- reset AMC. This step is needed only in TTY mode and only to check communication with terminal program by receiving prompt message from AMC after resetting,
- follow the screen instruction for changing FW parameters,
- save parameters to EEPROM AMC,
- close terminal program,
- set AMC power OFF,
- set dip-swith 1 ON - this is normal work mode of AMC.
The startup sequence for using Alt. firmware with x-sim software or xSimCTRL software (normal work mode, DIP-Swith 1 is ON)
- set dip-switch 1 ON,
- connect AMC to PC, set AMC power ON (on LCD lines with current AMC values for two axes),
- execute the xSimCTRL program on PC,
- If it FIRST TIME executing or if you CHANGE COM-port, go to "setup" menu, select COM-port and setup it. In any other way you dont need use "setup" menu every time when program is executing. And you dont need reset AMC for begining comunication in this case.
- set checkboxes for working with programm.
PS: This is a project of small group of authors and testers from:
http://mal4x.ru/forum/forums.php?forum=6