## 5 Software Control Method Implementation  
One of the software control development's crucial objectives is to obtain a user-friendly and safe control unit to carry out all the trainable joints movement. The developed software's control model was created to run as a menu, coded using the C programming language. A menu is one of the most straightforward ways users can navigating through and interact with devices with various features. The menu approach is used at most of our ADL devices (e.g., Smartphones, PCs, and TVs), in almost every electronic device with a screen. We initialized the needed libraries for each input and output I/O devices' interface pins in the code. The incremental rotary encoder's enrollment enables the users to scroll through the menu items (control parameter options) by turning the encoder's shaft to the right or left. In contrast, the central pushbutton of the encoder is used to select the desired menu item. The developed embedded software enables the therapist to control the necessary therapy control parameters includes the ROM, speed, and repeat time generated towards the patient's limb. The developed menu structure is summarized in Figure 9. The menu item starts with a welcoming message; the main menu contains the trainable joint's movement (therapy type). In addition, we built a sub-menu that contains therapy control parameters includes: ROM/Distance, speed, repeats time for each therapy type. Once the therapy control parameters are selected, the menu item waits for a start button to be pressed. The therapy session can be started simply by clicking the control unit's start button. The program runs and executes until the therapy repeat time finishes. Moreover, during the therapy execution, the developed software monitors and displays the execution repeat's numbers. The control steps implementation to start a therapy are summarized as follows. 1. A confirmation warning will emerge from the sub-menu after selecting the desired trainable joint from the main menu, asking whether or not to confirm the type of therapy chosen; this is an additional safety feature at the software level. 2. After confirming the chosen F/E range, the second step is to select the desired ROM degrees for the wrist and forearm joints or minimum and maximum displacement to flex and extend the wrist and forearm therapy fingers. FWRMS controller is programmed to provide the Wrist F/E with controllable rotational ROMs ranged from 0\({}^{\circ}\)-78\({}^{\circ}\)/0\({}^{\circ}\)-68\({}^{\circ}\), Wrist R/U from 0\({}^{\circ}\)-28\({}^{\circ}\)/0\({}^{\circ}\)-38\({}^{\circ}\), while Forearm S/P from 0\({}^{\circ}\)-88\({}^{\circ}\)/0\({}^{\circ}\)-83\({}^{\circ}\), as shown in Table 2. To achieve these degrees, we implemented a position control method for the stepper motor. The necessary steps of the position control method of the used stepper motor include: Since the used motor step angle is 1.8 degrees, which means, for each step, the motor rotates 1.8 degrees; by using a simple calculation, the number of steps produced by the motor that needed to achieve the desired degrees for example 45 degrees can be determined (revolution Steps for each revolution = 45/step angle, (45/1.8 = 25 Steps for each revolution). practically, in order to achieve the desired 45 degrees, the motor driver sends 25 pulses into the step pin. Therefore, in the backend code, the developed loop has 25 iterations, so the step pin for pulse generation is adjusted on a high state and then low for each iteration. Once the 25 derived steps are executed, we add a two-second delay and then alter the rotation orientation by turning the direction pin on a low state pin, in that method we could also control the repeat numbers of the motor execution. In the developed menu items the users can select the number of the desired repeats ranged between 0-200 repeat. This method of was applied at all therapy execution control, and FMRMS took advantage of these steps to control and set the desired angular position. 3.