HARSFEN0602ElmoHARmonicaSoftwareManual | PRELIMINARYDRAFT |
17 Appendix B: Harmonica Internals
This chapter summarises some of the Harmonica internals.
The chapter to give some deeper insights. It is not required for the standard Harmonica user.
17.1 Software Structure
The firmware is built from an initialisation block and from a run time block. The
Most of the motion control routines are performed by a periodic interrupt. The interrupt period is programmable.
The idle loop consumes all the remaining CPU time, polling if there is anything to do (like interpreting host commands or running a user program) and executing whatever found to do.
17.1.1The Initialization block
The initialization block is called immediately after
The initialization is a linear set of routine, doing the following:
-Complete DSP register programming
-Initializing all the volatile data
-Attempt to read database from a serial flash, or reset data base to factory default if database reading failed
-Initialize the communication.
-Reset all CAN database – PDO mappings etc. and set CAN status to pre- operational.
-If there is an autoexec program defined, launch it (with thread 0).
17.1.2The periodic Interrupt
This interrupt has the cycle time of
This interrupt does, every cycle, as follows:
-Commutation
-Hazard handling
-Motor current control
-RS232 transmission and receiving
-Data recorder (may be activated only every fourth cycle)
After completing the “every cycle” jobs, the periodic interrupt forks to periodic jobs of lesser frequency. The following jobs are made once per four periods:
-Calculate speed
-Calculate motion reference
-Closed loop speed or position control
-Controller gains scheduling.
-Read digital input, with software
-Manage Homing
-Handle high priority CAN actions:
oReact to time stamps
oReact to SYNC message by logging time and sending synchronous PDO's o React to NMT
o React to
o Route lower priority CAN messages to handling by the idle loop.
The following jobs are made once per 32 sampling periods: