lcd lib

Dependencies:   mbed LCD_DISCO_F469NI TS_DISCO_F469NI BSP_DISCO_F469NI EasyCAT_lib

Committer:
haddad1995
Date:
Fri Mar 11 09:18:13 2022 +0000
Revision:
2:4a0d3be00487
Parent:
1:8574e7a8fcde
Child:
4:186727e0bdea
change

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wsteenberg 0:ebf3f36f3a64 1 //---------------------------------------------------------------
wsteenberg 0:ebf3f36f3a64 2 //
wsteenberg 0:ebf3f36f3a64 3 //---------------------------------------------------------------
wsteenberg 0:ebf3f36f3a64 4 #include "mbed.h"
wsteenberg 0:ebf3f36f3a64 5 #include "F469_BUTTON.hpp"
wsteenberg 0:ebf3f36f3a64 6 #include "F469_SLIDER.hpp"
haddad1995 2:4a0d3be00487 7 #include "EasyCAT.h" // EasyCAT library to interface the LAN9252
wsteenberg 0:ebf3f36f3a64 8
wsteenberg 0:ebf3f36f3a64 9 DigitalOut led_green(LED1);
wsteenberg 0:ebf3f36f3a64 10 DigitalOut led_orange(LED2);
wsteenberg 0:ebf3f36f3a64 11 DigitalOut led_red(LED3);
wsteenberg 0:ebf3f36f3a64 12 DigitalOut led_blue(LED4);
wsteenberg 0:ebf3f36f3a64 13
wsteenberg 0:ebf3f36f3a64 14 TS_DISCO_F469NI ts_;
wsteenberg 0:ebf3f36f3a64 15 LCD_DISCO_F469NI lcd_;
wsteenberg 0:ebf3f36f3a64 16
haddad1995 2:4a0d3be00487 17 EasyCAT EASYCAT; // EasyCAT istantiation
wsteenberg 0:ebf3f36f3a64 18
wsteenberg 0:ebf3f36f3a64 19 char char_SliderDisplayValue[4]; // String Value to display for the Slider Control value
wsteenberg 0:ebf3f36f3a64 20 uint16_t SliderDisplayValue_; // Variable used to access Slider Control Value in F469SLIDER.cpp
wsteenberg 0:ebf3f36f3a64 21
haddad1995 2:4a0d3be00487 22 //---- global variables ---------------------------------------------------------------------------
haddad1995 2:4a0d3be00487 23 int menu = 0;
haddad1995 2:4a0d3be00487 24
haddad1995 2:4a0d3be00487 25 UWORD ContaUp; // used for sawthoot test generation
haddad1995 2:4a0d3be00487 26 UWORD ContaDown; //
haddad1995 2:4a0d3be00487 27
haddad1995 2:4a0d3be00487 28 unsigned long Millis = 0;
haddad1995 2:4a0d3be00487 29 unsigned long Millis2 = 0;
haddad1995 2:4a0d3be00487 30 unsigned long PreviousSaw = 0;
haddad1995 2:4a0d3be00487 31 unsigned long PreviousCycle = 0;
haddad1995 2:4a0d3be00487 32
haddad1995 2:4a0d3be00487 33 int8_t stand = 0; // data to test
haddad1995 2:4a0d3be00487 34 int8_t start = 0; // data to test
haddad1995 2:4a0d3be00487 35 int8_t stepping = 0; // data to test
haddad1995 2:4a0d3be00487 36 int8_t endStep = 0; // data to test
haddad1995 2:4a0d3be00487 37
haddad1995 2:4a0d3be00487 38 int8_t enable = 0; // data to test
haddad1995 2:4a0d3be00487 39 int8_t enable_Lateral = 0; // data to test
haddad1995 2:4a0d3be00487 40 int8_t quick_Stop = 0; // data to test
haddad1995 2:4a0d3be00487 41 int8_t clear_Fault = 0; // data to test
haddad1995 2:4a0d3be00487 42
haddad1995 2:4a0d3be00487 43 float Standing_Time = 2.0 ;
haddad1995 2:4a0d3be00487 44 char Standing_Time_S[10];
haddad1995 2:4a0d3be00487 45 float Step_Time = 2.0 ;
haddad1995 2:4a0d3be00487 46 char Step_Time_S[10];
haddad1995 2:4a0d3be00487 47 float Wait_COM_Tr_Time = 0.5 ;
haddad1995 2:4a0d3be00487 48 char Wait_COM_Tr_Time_S[10];
haddad1995 2:4a0d3be00487 49 int COM_Tr_Threshold = 20 ;
haddad1995 2:4a0d3be00487 50 char COM_Tr_Threshold_S[10];
haddad1995 2:4a0d3be00487 51
haddad1995 2:4a0d3be00487 52 int8_t Ethercat = 0 ;
haddad1995 2:4a0d3be00487 53 char Ethercat_S[10];
haddad1995 2:4a0d3be00487 54 float Running_Time = 0.0 ;
haddad1995 2:4a0d3be00487 55 char Running_Time_S[20];
haddad1995 2:4a0d3be00487 56 int State_Step = 0 ;
haddad1995 2:4a0d3be00487 57 char State_Step_S[10];
haddad1995 2:4a0d3be00487 58 int Status_Driver = 0 ;
haddad1995 2:4a0d3be00487 59 char Status_Driver_S[10];
haddad1995 2:4a0d3be00487 60 int END = 0 ;
haddad1995 2:4a0d3be00487 61 char END_S[10];
haddad1995 2:4a0d3be00487 62
haddad1995 2:4a0d3be00487 63 //---- declarations for Arduino "millis()" emulation -----------------------
haddad1995 2:4a0d3be00487 64
haddad1995 2:4a0d3be00487 65 static Ticker uS_Tick;
haddad1995 2:4a0d3be00487 66 static volatile uint32_t MillisVal = 0;
haddad1995 2:4a0d3be00487 67
haddad1995 2:4a0d3be00487 68 void InitMillis(void);
haddad1995 2:4a0d3be00487 69 void mS_Tick(void);
haddad1995 2:4a0d3be00487 70
haddad1995 2:4a0d3be00487 71 inline static uint32_t millis (void)
haddad1995 2:4a0d3be00487 72 {
haddad1995 2:4a0d3be00487 73 return MillisVal;
haddad1995 2:4a0d3be00487 74 };
haddad1995 2:4a0d3be00487 75
haddad1995 2:4a0d3be00487 76
haddad1995 2:4a0d3be00487 77
haddad1995 2:4a0d3be00487 78 //---------------------------------------------------------------------------------------------
wsteenberg 0:ebf3f36f3a64 79 int main()
wsteenberg 0:ebf3f36f3a64 80 {
wsteenberg 0:ebf3f36f3a64 81 led_green = 1; // Switch off all LEDs
wsteenberg 0:ebf3f36f3a64 82 led_orange = 1;
wsteenberg 0:ebf3f36f3a64 83 led_red = 1;
wsteenberg 0:ebf3f36f3a64 84 led_blue = 1;
wsteenberg 0:ebf3f36f3a64 85
wsteenberg 0:ebf3f36f3a64 86 lcd_.Clear(LCD_COLOR_WHITE); // Set LCD Background colour
wsteenberg 0:ebf3f36f3a64 87
haddad1995 2:4a0d3be00487 88 // Set Text colour to Black
haddad1995 2:4a0d3be00487 89
haddad1995 2:4a0d3be00487 90 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 91 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 92 lcd_.DisplayStringAt(10, 20, (uint8_t *)" Status EtherCAT: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 93 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 94 lcd_.DisplayStringAt(400, 20, (uint8_t *)" Running Time: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 95 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 96 lcd_.DisplayStringAt(10, 60, (uint8_t *)" State Step: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 97 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 98 lcd_.DisplayStringAt(400, 60, (uint8_t *)" Status Driver: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 99 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 100 lcd_.DisplayStringAt(10, 440, (uint8_t *)" END ? : ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 101 lcd_.DrawHLine(20, 90, 760);
haddad1995 2:4a0d3be00487 102 lcd_.DrawHLine(20, 91, 760);
haddad1995 2:4a0d3be00487 103
haddad1995 2:4a0d3be00487 104 lcd_.SetTextColor(LCD_COLOR_RED);
haddad1995 2:4a0d3be00487 105 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 106 lcd_.DisplayStringAt(10, 110, (uint8_t *)" Driver Controle ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 107
haddad1995 2:4a0d3be00487 108 Button btn1(lcd_, ts_, 20, 160, 160, 70,
haddad1995 2:4a0d3be00487 109 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, "Enable", Font20); // Define btn1 button
haddad1995 2:4a0d3be00487 110 btn1.Render(); // Draw btn1 button
haddad1995 2:4a0d3be00487 111
haddad1995 2:4a0d3be00487 112 Button btn2(lcd_, ts_, 220, 160, 160, 70,
haddad1995 2:4a0d3be00487 113 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, "Lateral", Font20); // Define test button
haddad1995 2:4a0d3be00487 114 btn2.Render(); // Draw btn2 button
haddad1995 2:4a0d3be00487 115 Button btn3(lcd_, ts_, 420, 160, 160, 70,
haddad1995 2:4a0d3be00487 116 LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1, "Quick Stop", Font20); // Define btn3 button
haddad1995 2:4a0d3be00487 117 btn3.Render(); // Draw btn3 button
wsteenberg 0:ebf3f36f3a64 118
haddad1995 2:4a0d3be00487 119 Button btn4(lcd_, ts_, 620, 160, 160, 70,
haddad1995 2:4a0d3be00487 120 LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1, "Clear Fault", Font20); // Define btn4 button
haddad1995 2:4a0d3be00487 121 btn4.Render(); // Draw btn3 button
wsteenberg 0:ebf3f36f3a64 122
haddad1995 2:4a0d3be00487 123 lcd_.SetTextColor(LCD_COLOR_RED);
haddad1995 2:4a0d3be00487 124 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 125 lcd_.DisplayStringAt(10, 250, (uint8_t *)" Step Control ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 126
haddad1995 2:4a0d3be00487 127
haddad1995 2:4a0d3be00487 128 Button button3D1(lcd_, ts_, 20, 300, 160, 70,
haddad1995 2:4a0d3be00487 129 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Stand", Font20); // Define button3D1 button
haddad1995 2:4a0d3be00487 130 button3D1.Render();
wsteenberg 0:ebf3f36f3a64 131
haddad1995 2:4a0d3be00487 132 Button button3D2(lcd_, ts_, 220, 300, 160, 70,
haddad1995 2:4a0d3be00487 133 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Start", Font20); // Define button3D2 button
haddad1995 2:4a0d3be00487 134 button3D2.Render();
haddad1995 2:4a0d3be00487 135
haddad1995 2:4a0d3be00487 136 Button button3D3(lcd_, ts_, 420, 300, 160, 70,
haddad1995 2:4a0d3be00487 137 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Stepping", Font20); // Define button3D3 button
haddad1995 2:4a0d3be00487 138 button3D3.Render();
haddad1995 2:4a0d3be00487 139 Button button3D4(lcd_, ts_, 620, 300, 160, 70,
haddad1995 2:4a0d3be00487 140 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "EndStep", Font20); // Define button3D3 button
haddad1995 2:4a0d3be00487 141 button3D4.Render();
haddad1995 2:4a0d3be00487 142
haddad1995 2:4a0d3be00487 143 lcd_.SetTextColor(LCD_COLOR_RED);
haddad1995 2:4a0d3be00487 144 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 145 lcd_.DisplayStringAt(280, 440, (uint8_t *)" MOTION PROJECT ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 146
haddad1995 2:4a0d3be00487 147 Button btn5(lcd_, ts_, 660, 410, 120, 60,
haddad1995 2:4a0d3be00487 148 LCD_COLOR_ORANGE, LCD_COLOR_GRAY, 1, "Next", Font20); // Define btn4 button
haddad1995 2:4a0d3be00487 149 btn5.Render();
haddad1995 2:4a0d3be00487 150
haddad1995 2:4a0d3be00487 151 // printf ("\nEasyCAT - Generic EtherCAT slave\n"); // print the banner
wsteenberg 0:ebf3f36f3a64 152
haddad1995 2:4a0d3be00487 153 InitMillis(); // init Arduino "millis()" emulation
wsteenberg 0:ebf3f36f3a64 154
haddad1995 2:4a0d3be00487 155 ContaDown.Word = 0x0000;
haddad1995 2:4a0d3be00487 156 ContaUp.Word = 0x0000;
wsteenberg 0:ebf3f36f3a64 157
wsteenberg 0:ebf3f36f3a64 158 while (true) // Main program loop
haddad1995 2:4a0d3be00487 159 {
wsteenberg 0:ebf3f36f3a64 160 led_green = 1; // Switch off all LEDs
wsteenberg 0:ebf3f36f3a64 161 led_orange = 1;
wsteenberg 0:ebf3f36f3a64 162 led_red = 1;
haddad1995 2:4a0d3be00487 163 led_blue = 1;
haddad1995 2:4a0d3be00487 164
haddad1995 2:4a0d3be00487 165 if (btn1.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 166 {
haddad1995 2:4a0d3be00487 167 if (enable==0)
haddad1995 2:4a0d3be00487 168 {
haddad1995 2:4a0d3be00487 169 enable=1;
haddad1995 2:4a0d3be00487 170 }
haddad1995 2:4a0d3be00487 171 else enable=0;
haddad1995 2:4a0d3be00487 172 lcd_.SetFont(&Font16);
haddad1995 2:4a0d3be00487 173 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 174 lcd_.DisplayStringAt(5, 460, (uint8_t *)"Enable pressed - switch on orange LED", LEFT_MODE);
haddad1995 2:4a0d3be00487 175 led_orange = 0;
haddad1995 2:4a0d3be00487 176 wait(0.2);
haddad1995 2:4a0d3be00487 177 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 178
haddad1995 2:4a0d3be00487 179 }
haddad1995 2:4a0d3be00487 180 // End btn1 button instructions
haddad1995 2:4a0d3be00487 181 if (btn2.Press()) // Check if test button was touched and run instructions if true
haddad1995 2:4a0d3be00487 182 {
haddad1995 2:4a0d3be00487 183 if (enable_Lateral==0)
haddad1995 2:4a0d3be00487 184 {
haddad1995 2:4a0d3be00487 185 enable_Lateral=1;
haddad1995 2:4a0d3be00487 186 }
haddad1995 2:4a0d3be00487 187 else enable_Lateral=0;
haddad1995 2:4a0d3be00487 188 lcd_.SetFont(&Font16);
haddad1995 2:4a0d3be00487 189 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 190 lcd_.DisplayStringAt(5, 460, (uint8_t *)"Enable Lateral pressed - switch on red LED", LEFT_MODE);
haddad1995 2:4a0d3be00487 191 led_red = 0;
haddad1995 2:4a0d3be00487 192 wait(0.2);
haddad1995 2:4a0d3be00487 193 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 194
haddad1995 2:4a0d3be00487 195 } // End test button instructions
dcspencer 1:8574e7a8fcde 196
haddad1995 2:4a0d3be00487 197 if (btn3.Press()) // Check if 3Dbutton button was touched and run instructions if true
wsteenberg 0:ebf3f36f3a64 198 {
haddad1995 2:4a0d3be00487 199 if (quick_Stop==0)
haddad1995 2:4a0d3be00487 200 {
haddad1995 2:4a0d3be00487 201 quick_Stop=1;
haddad1995 2:4a0d3be00487 202 }
haddad1995 2:4a0d3be00487 203 else quick_Stop=0;
wsteenberg 0:ebf3f36f3a64 204 lcd_.SetFont(&Font16);
wsteenberg 0:ebf3f36f3a64 205 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 206 lcd_.DisplayStringAt(5, 460, (uint8_t *)"Quick Stop pressed - switch on blue LED", LEFT_MODE);
haddad1995 2:4a0d3be00487 207 led_blue = 0;
haddad1995 2:4a0d3be00487 208 wait(0.2);
haddad1995 2:4a0d3be00487 209 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 210 } // End 3D button instructions
haddad1995 2:4a0d3be00487 211 if (btn4.Press()) // Check if test button was touched and run instructions if true
wsteenberg 0:ebf3f36f3a64 212 {
haddad1995 2:4a0d3be00487 213 if (clear_Fault==0)
haddad1995 2:4a0d3be00487 214 {
haddad1995 2:4a0d3be00487 215 clear_Fault=1;
haddad1995 2:4a0d3be00487 216 }
haddad1995 2:4a0d3be00487 217 else clear_Fault=0;
wsteenberg 0:ebf3f36f3a64 218 lcd_.SetFont(&Font16);
wsteenberg 0:ebf3f36f3a64 219 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 220 lcd_.DisplayStringAt(5, 460, (uint8_t *)"Clear Fault pressed - switch on red LED", LEFT_MODE);
wsteenberg 0:ebf3f36f3a64 221 led_red = 0;
haddad1995 2:4a0d3be00487 222 wait(0.2);
haddad1995 2:4a0d3be00487 223 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 224
haddad1995 2:4a0d3be00487 225 }
haddad1995 2:4a0d3be00487 226
haddad1995 2:4a0d3be00487 227
haddad1995 2:4a0d3be00487 228 if (button3D1.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 229 {
haddad1995 2:4a0d3be00487 230 if (stand==0)
haddad1995 2:4a0d3be00487 231 {
haddad1995 2:4a0d3be00487 232 stand=1;
haddad1995 2:4a0d3be00487 233 }
haddad1995 2:4a0d3be00487 234 else stand=0;
haddad1995 2:4a0d3be00487 235 lcd_.SetFont(&Font16);
haddad1995 2:4a0d3be00487 236 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 237 lcd_.DisplayStringAt(5, 460, (uint8_t *)"Stand pressed - switch on orange LED", LEFT_MODE);
haddad1995 2:4a0d3be00487 238 led_orange = 0;
haddad1995 2:4a0d3be00487 239 wait(0.2);
haddad1995 2:4a0d3be00487 240 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 241
haddad1995 2:4a0d3be00487 242 }
haddad1995 2:4a0d3be00487 243 // End btn1 button instructions
haddad1995 2:4a0d3be00487 244
haddad1995 2:4a0d3be00487 245 if (button3D2.Press()) // Check if test button was touched and run instructions if true
haddad1995 2:4a0d3be00487 246 {
haddad1995 2:4a0d3be00487 247 if (start==0)
haddad1995 2:4a0d3be00487 248 {
haddad1995 2:4a0d3be00487 249 start=1;
haddad1995 2:4a0d3be00487 250 }
haddad1995 2:4a0d3be00487 251 else start=0;
haddad1995 2:4a0d3be00487 252 lcd_.SetFont(&Font16);
haddad1995 2:4a0d3be00487 253 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 254 lcd_.DisplayStringAt(5, 460, (uint8_t *)"Start pressed - switch on red LED", LEFT_MODE);
haddad1995 2:4a0d3be00487 255 led_red = 0;
haddad1995 2:4a0d3be00487 256 wait(0.2);
haddad1995 2:4a0d3be00487 257 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
wsteenberg 0:ebf3f36f3a64 258
wsteenberg 0:ebf3f36f3a64 259 } // End test button instructions
wsteenberg 0:ebf3f36f3a64 260
haddad1995 2:4a0d3be00487 261 if (button3D3.Press()) // Check if 3Dbutton button was touched and run instructions if true
wsteenberg 0:ebf3f36f3a64 262 {
haddad1995 2:4a0d3be00487 263 if (stepping==0)
haddad1995 2:4a0d3be00487 264 {
haddad1995 2:4a0d3be00487 265 stepping=1;
haddad1995 2:4a0d3be00487 266 }
haddad1995 2:4a0d3be00487 267 else stepping=0;
wsteenberg 0:ebf3f36f3a64 268 lcd_.SetFont(&Font16);
wsteenberg 0:ebf3f36f3a64 269 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 270 lcd_.DisplayStringAt(5, 460, (uint8_t *)"Stepping pressed - switch on blue LED", LEFT_MODE);
haddad1995 2:4a0d3be00487 271 led_blue = 0;
haddad1995 2:4a0d3be00487 272 wait(0.2);
haddad1995 2:4a0d3be00487 273 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 274 }
wsteenberg 0:ebf3f36f3a64 275
haddad1995 2:4a0d3be00487 276 if (button3D4.Press()) // Check if 3Dbutton button was touched and run instructions if true
haddad1995 2:4a0d3be00487 277 {
haddad1995 2:4a0d3be00487 278 if (endStep==0)
haddad1995 2:4a0d3be00487 279 {
haddad1995 2:4a0d3be00487 280 endStep=1;
haddad1995 2:4a0d3be00487 281 }
haddad1995 2:4a0d3be00487 282 else endStep=0;
wsteenberg 0:ebf3f36f3a64 283 lcd_.SetFont(&Font16);
wsteenberg 0:ebf3f36f3a64 284 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 285 lcd_.DisplayStringAt(5, 460, (uint8_t *)"EndStep pressed - switch on blue LED", LEFT_MODE);
haddad1995 2:4a0d3be00487 286 led_blue = 0;
haddad1995 2:4a0d3be00487 287 wait(0.2);
haddad1995 2:4a0d3be00487 288 lcd_.DisplayStringAt(5, 460, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 289 }
wsteenberg 0:ebf3f36f3a64 290
haddad1995 2:4a0d3be00487 291 if ( btn5.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 292 { menu = 1 ;
haddad1995 2:4a0d3be00487 293 lcd_.Clear(LCD_COLOR_WHITE);
haddad1995 2:4a0d3be00487 294 led_orange = 0;
haddad1995 2:4a0d3be00487 295 wait(0.1);
haddad1995 2:4a0d3be00487 296 led_orange = 1; // Set LCD Background colour
haddad1995 2:4a0d3be00487 297
haddad1995 2:4a0d3be00487 298 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 299 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 300 lcd_.DisplayStringAt(20, 65, (uint8_t *)"Standing Time", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 301 sprintf(Standing_Time_S, "%0.2f", Standing_Time);
haddad1995 2:4a0d3be00487 302 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 303 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 304 lcd_.DisplayStringAt(320, 65, (uint8_t *)Standing_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 305 Button btn11(lcd_, ts_, 400, 40, 160, 70,
haddad1995 2:4a0d3be00487 306 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, " + ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 307 btn11.Render();
haddad1995 2:4a0d3be00487 308 Button btn12(lcd_, ts_, 600, 40, 160, 70,
haddad1995 2:4a0d3be00487 309 LCD_COLOR_RED , LCD_COLOR_DARKBLUE, 1, " - ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 310 btn12.Render();
haddad1995 2:4a0d3be00487 311
haddad1995 2:4a0d3be00487 312 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 313 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 314 lcd_.DisplayStringAt(20, 165, (uint8_t *)"Step Time", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 315 sprintf(Step_Time_S, "%0.2f", Step_Time);
haddad1995 2:4a0d3be00487 316 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 317 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 318 lcd_.DisplayStringAt(320, 165, (uint8_t *)Step_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 319 Button btn13(lcd_, ts_, 400, 140, 160, 70,
haddad1995 2:4a0d3be00487 320 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, " + ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 321 btn13.Render();
haddad1995 2:4a0d3be00487 322 Button btn14(lcd_, ts_, 600, 140, 160, 70,
haddad1995 2:4a0d3be00487 323 LCD_COLOR_RED , LCD_COLOR_DARKBLUE, 1, " - ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 324 btn14.Render();
haddad1995 2:4a0d3be00487 325
haddad1995 2:4a0d3be00487 326 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 327 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 328 lcd_.DisplayStringAt(20, 265, (uint8_t *)"Wait COM Tr Time", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 329 sprintf(Wait_COM_Tr_Time_S, "%0.2f", Wait_COM_Tr_Time);
haddad1995 2:4a0d3be00487 330 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 331 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 332 lcd_.DisplayStringAt(320, 265, (uint8_t *)Wait_COM_Tr_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 333 Button btn15(lcd_, ts_, 400, 240, 160, 70,
haddad1995 2:4a0d3be00487 334 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, " + ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 335 btn15.Render();
haddad1995 2:4a0d3be00487 336 Button btn16(lcd_, ts_, 600, 240, 160, 70,
haddad1995 2:4a0d3be00487 337 LCD_COLOR_RED , LCD_COLOR_DARKBLUE, 1, " - ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 338 btn16.Render();
haddad1995 2:4a0d3be00487 339
haddad1995 2:4a0d3be00487 340 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 341 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 342 lcd_.DisplayStringAt(20, 365, (uint8_t *)"COM Tr Threshold", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 343 sprintf(COM_Tr_Threshold_S, "%d", COM_Tr_Threshold);
haddad1995 2:4a0d3be00487 344 lcd_.SetFont(&Font24);
wsteenberg 0:ebf3f36f3a64 345 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 346 lcd_.DisplayStringAt(320, 365, (uint8_t *)COM_Tr_Threshold_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 347 lcd_.DisplayStringAt(370, 365, (uint8_t *)"%", LEFT_MODE);
haddad1995 2:4a0d3be00487 348 Button btn17(lcd_, ts_, 400, 340, 160, 70,
haddad1995 2:4a0d3be00487 349 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, " + ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 350 btn17.Render();
haddad1995 2:4a0d3be00487 351 Button btn18(lcd_, ts_, 600, 340, 160, 70,
haddad1995 2:4a0d3be00487 352 LCD_COLOR_RED , LCD_COLOR_DARKBLUE, 1, " - ", Font24); // Define btn1 button
haddad1995 2:4a0d3be00487 353 btn18.Render();
haddad1995 2:4a0d3be00487 354
haddad1995 2:4a0d3be00487 355 Button btn6(lcd_, ts_, 20, 410, 120, 60,
haddad1995 2:4a0d3be00487 356 LCD_COLOR_ORANGE, LCD_COLOR_GRAY, 1, "Back", Font20); // Define btn4 button
haddad1995 2:4a0d3be00487 357 btn6.Render();
haddad1995 2:4a0d3be00487 358
haddad1995 2:4a0d3be00487 359 lcd_.SetTextColor(LCD_COLOR_RED);
haddad1995 2:4a0d3be00487 360 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 361 lcd_.DisplayStringAt(280, 440, (uint8_t *)" MOTION PROJECT ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 362
haddad1995 2:4a0d3be00487 363 while (menu==1)
haddad1995 2:4a0d3be00487 364 { if (btn11.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 365 {
haddad1995 2:4a0d3be00487 366 Standing_Time = Standing_Time + 0.5 ;
haddad1995 2:4a0d3be00487 367 sprintf(Standing_Time_S, "%0.2f", Standing_Time);
haddad1995 2:4a0d3be00487 368 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 369 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 370 lcd_.DisplayStringAt(320, 65, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 371 lcd_.DisplayStringAt(320, 65, (uint8_t *)Standing_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 372
haddad1995 2:4a0d3be00487 373 }
haddad1995 2:4a0d3be00487 374 if (btn12.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 375 { if (Standing_Time>0)
haddad1995 2:4a0d3be00487 376 {
haddad1995 2:4a0d3be00487 377 Standing_Time = Standing_Time - 0.5 ;
haddad1995 2:4a0d3be00487 378 sprintf(Standing_Time_S, "%0.2f", Standing_Time);
haddad1995 2:4a0d3be00487 379 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 380 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 381 lcd_.DisplayStringAt(320, 65, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 382 lcd_.DisplayStringAt(320, 65, (uint8_t *)Standing_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 383 }
haddad1995 2:4a0d3be00487 384 }
haddad1995 2:4a0d3be00487 385 if (btn13.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 386 {
haddad1995 2:4a0d3be00487 387 Step_Time = Step_Time + 0.5 ;
haddad1995 2:4a0d3be00487 388 sprintf(Step_Time_S, "%0.2f", Step_Time);
haddad1995 2:4a0d3be00487 389 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 390 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 391 lcd_.DisplayStringAt(320, 165, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 392 lcd_.DisplayStringAt(320, 165, (uint8_t *)Step_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 393
haddad1995 2:4a0d3be00487 394 }
haddad1995 2:4a0d3be00487 395 if (btn14.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 396 { if (Step_Time>0)
haddad1995 2:4a0d3be00487 397 {
haddad1995 2:4a0d3be00487 398 Step_Time = Step_Time - 0.5 ;
haddad1995 2:4a0d3be00487 399 sprintf(Step_Time_S, "%0.2f", Step_Time);
haddad1995 2:4a0d3be00487 400 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 401 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 402 lcd_.DisplayStringAt(320, 165, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 403 lcd_.DisplayStringAt(320, 165, (uint8_t *)Step_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 404 }
haddad1995 2:4a0d3be00487 405 }
haddad1995 2:4a0d3be00487 406 if (btn15.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 407 {
haddad1995 2:4a0d3be00487 408 Wait_COM_Tr_Time = Wait_COM_Tr_Time + 0.5 ;
haddad1995 2:4a0d3be00487 409 sprintf(Wait_COM_Tr_Time_S, "%0.2f", Wait_COM_Tr_Time);
haddad1995 2:4a0d3be00487 410 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 411 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 412 lcd_.DisplayStringAt(320, 265, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 413 lcd_.DisplayStringAt(320, 265, (uint8_t *)Wait_COM_Tr_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 414
haddad1995 2:4a0d3be00487 415 }
haddad1995 2:4a0d3be00487 416 if (btn16.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 417 { if (Wait_COM_Tr_Time>0)
haddad1995 2:4a0d3be00487 418 {
haddad1995 2:4a0d3be00487 419 Wait_COM_Tr_Time = Wait_COM_Tr_Time - 0.5 ;
haddad1995 2:4a0d3be00487 420 sprintf(Wait_COM_Tr_Time_S, "%0.2f", Wait_COM_Tr_Time);
haddad1995 2:4a0d3be00487 421 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 422 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 423 lcd_.DisplayStringAt(320, 265, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 424 lcd_.DisplayStringAt(320, 265, (uint8_t *)Wait_COM_Tr_Time_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 425 }
haddad1995 2:4a0d3be00487 426 }
haddad1995 2:4a0d3be00487 427 if (btn17.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 428 {
haddad1995 2:4a0d3be00487 429 COM_Tr_Threshold = COM_Tr_Threshold + 5 ;
haddad1995 2:4a0d3be00487 430 sprintf(COM_Tr_Threshold_S, "%d", COM_Tr_Threshold);
haddad1995 2:4a0d3be00487 431 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 432 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 433 lcd_.DisplayStringAt(320, 365, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 434 lcd_.DisplayStringAt(320, 365, (uint8_t *)COM_Tr_Threshold_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 435
haddad1995 2:4a0d3be00487 436 }
haddad1995 2:4a0d3be00487 437 if (btn18.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 438 { if (COM_Tr_Threshold>0)
haddad1995 2:4a0d3be00487 439 {
haddad1995 2:4a0d3be00487 440 COM_Tr_Threshold = COM_Tr_Threshold - 5 ;
haddad1995 2:4a0d3be00487 441 sprintf(COM_Tr_Threshold_S, "%d", COM_Tr_Threshold);
haddad1995 2:4a0d3be00487 442 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 443 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 444 lcd_.DisplayStringAt(320, 365, (uint8_t *)" ", LEFT_MODE);
haddad1995 2:4a0d3be00487 445 lcd_.DisplayStringAt(320, 365, (uint8_t *)COM_Tr_Threshold_S, LEFT_MODE);
haddad1995 2:4a0d3be00487 446 }
haddad1995 2:4a0d3be00487 447 }
haddad1995 2:4a0d3be00487 448 if (btn6.Press() ) // Check if btn1 button was touched and run instructions if true
haddad1995 2:4a0d3be00487 449 {
haddad1995 2:4a0d3be00487 450 menu=0;
haddad1995 2:4a0d3be00487 451 led_orange = 0;
haddad1995 2:4a0d3be00487 452 lcd_.Clear(LCD_COLOR_WHITE); // Set LCD Background colour
haddad1995 2:4a0d3be00487 453 lcd_.SetTextColor(LCD_COLOR_BLACK); // Set Text colour to Black
haddad1995 2:4a0d3be00487 454 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 455 lcd_.DisplayStringAt(10, 20, (uint8_t *)" Status EtherCAT: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 456 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 457 lcd_.DisplayStringAt(400, 20, (uint8_t *)" Running Time: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 458 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 459 lcd_.DisplayStringAt(10, 60, (uint8_t *)" State Step: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 460 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 461 lcd_.DisplayStringAt(400, 60, (uint8_t *)" Status Driver: ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 462 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 463 lcd_.DisplayStringAt(10, 440, (uint8_t *)" END ? : ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 464 lcd_.DrawHLine(20, 90, 760);
haddad1995 2:4a0d3be00487 465 lcd_.DrawHLine(20, 91, 760);
haddad1995 2:4a0d3be00487 466
haddad1995 2:4a0d3be00487 467 lcd_.SetTextColor(LCD_COLOR_RED);
haddad1995 2:4a0d3be00487 468 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 469 lcd_.DisplayStringAt(10, 110, (uint8_t *)" Driver Controle ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 470
haddad1995 2:4a0d3be00487 471 Button btn1(lcd_, ts_, 20, 160, 160, 70,
haddad1995 2:4a0d3be00487 472 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, "Enable", Font20); // Define btn1 button
haddad1995 2:4a0d3be00487 473 btn1.Render(); // Draw btn1 button
haddad1995 2:4a0d3be00487 474
haddad1995 2:4a0d3be00487 475 Button btn2(lcd_, ts_, 220, 160, 160, 70,
haddad1995 2:4a0d3be00487 476 LCD_COLOR_GREEN , LCD_COLOR_DARKBLUE, 1, "Lateral", Font20); // Define test button
haddad1995 2:4a0d3be00487 477 btn2.Render(); // Draw btn2 button
haddad1995 2:4a0d3be00487 478 Button btn3(lcd_, ts_, 420, 160, 160, 70,
haddad1995 2:4a0d3be00487 479 LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1, "Quick Stop", Font20); // Define btn3 button
haddad1995 2:4a0d3be00487 480 btn3.Render(); // Draw btn3 button
haddad1995 2:4a0d3be00487 481
haddad1995 2:4a0d3be00487 482 Button btn4(lcd_, ts_, 620, 160, 160, 70,
haddad1995 2:4a0d3be00487 483 LCD_COLOR_BROWN, LCD_COLOR_GRAY, 1, "Clear Fault", Font20); // Define btn4 button
haddad1995 2:4a0d3be00487 484 btn4.Render(); // Draw btn3 button
haddad1995 2:4a0d3be00487 485
haddad1995 2:4a0d3be00487 486 lcd_.SetTextColor(LCD_COLOR_RED);
haddad1995 2:4a0d3be00487 487 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 488 lcd_.DisplayStringAt(10, 250, (uint8_t *)" Step Control ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 489
haddad1995 2:4a0d3be00487 490
haddad1995 2:4a0d3be00487 491 Button button3D1(lcd_, ts_, 20, 300, 160, 70,
haddad1995 2:4a0d3be00487 492 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Stand", Font20); // Define button3D1 button
haddad1995 2:4a0d3be00487 493 button3D1.Render();
haddad1995 2:4a0d3be00487 494
haddad1995 2:4a0d3be00487 495 Button button3D2(lcd_, ts_, 220, 300, 160, 70,
haddad1995 2:4a0d3be00487 496 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Start", Font20); // Define button3D2 button
haddad1995 2:4a0d3be00487 497 button3D2.Render();
haddad1995 2:4a0d3be00487 498
haddad1995 2:4a0d3be00487 499 Button button3D3(lcd_, ts_, 420, 300, 160, 70,
haddad1995 2:4a0d3be00487 500 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "Stepping", Font20); // Define button3D3 button
haddad1995 2:4a0d3be00487 501 button3D3.Render();
haddad1995 2:4a0d3be00487 502 Button button3D4(lcd_, ts_, 620, 300, 160, 70,
haddad1995 2:4a0d3be00487 503 LCD_COLOR_BLUE, LCD_COLOR_YELLOW, 2, "EndStep", Font20); // Define button3D3 button
haddad1995 2:4a0d3be00487 504 button3D4.Render();
haddad1995 2:4a0d3be00487 505
haddad1995 2:4a0d3be00487 506 lcd_.SetTextColor(LCD_COLOR_RED);
haddad1995 2:4a0d3be00487 507 lcd_.SetFont(&Font24); // Font size 24
haddad1995 2:4a0d3be00487 508 lcd_.DisplayStringAt(280, 440, (uint8_t *)" MOTION PROJECT ", LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 509
haddad1995 2:4a0d3be00487 510 Button btn5(lcd_, ts_, 660, 410, 120, 60,
haddad1995 2:4a0d3be00487 511 LCD_COLOR_ORANGE, LCD_COLOR_GRAY, 1, "Next", Font20); // Define btn4 button
haddad1995 2:4a0d3be00487 512 btn5.Render();
haddad1995 2:4a0d3be00487 513
haddad1995 2:4a0d3be00487 514 wait(0.2);
haddad1995 2:4a0d3be00487 515 }
haddad1995 2:4a0d3be00487 516 wait(0.02f);
haddad1995 2:4a0d3be00487 517 }
haddad1995 2:4a0d3be00487 518 } // End test button instructions // End 3D button instructions
haddad1995 2:4a0d3be00487 519
wsteenberg 0:ebf3f36f3a64 520 wait(0.02f);
haddad1995 2:4a0d3be00487 521
haddad1995 2:4a0d3be00487 522 Millis = millis(); //
haddad1995 2:4a0d3be00487 523 if (Millis - PreviousCycle >= 10) // each 10 mS
haddad1995 2:4a0d3be00487 524 { //
haddad1995 2:4a0d3be00487 525 PreviousCycle = Millis; //
haddad1995 2:4a0d3be00487 526
haddad1995 2:4a0d3be00487 527 EASYCAT.MainTask(); // execute the EasyCAT task
haddad1995 2:4a0d3be00487 528
haddad1995 2:4a0d3be00487 529
haddad1995 2:4a0d3be00487 530
haddad1995 2:4a0d3be00487 531 EASYCAT.BufferIn.Cust.Standing_Time_T= Standing_Time;
haddad1995 2:4a0d3be00487 532
haddad1995 2:4a0d3be00487 533 EASYCAT.BufferIn.Cust.Step_Time_T= Step_Time;
haddad1995 2:4a0d3be00487 534
haddad1995 2:4a0d3be00487 535 EASYCAT.BufferIn.Cust.Wait_COM_Tr_Time_T= Wait_COM_Tr_Time;
haddad1995 2:4a0d3be00487 536
haddad1995 2:4a0d3be00487 537 EASYCAT.BufferIn.Cust.COM_Tr_Threshold_T= (COM_Tr_Threshold/100);
haddad1995 2:4a0d3be00487 538
haddad1995 2:4a0d3be00487 539
haddad1995 2:4a0d3be00487 540
haddad1995 2:4a0d3be00487 541 EASYCAT.BufferIn.Cust.Stand= stand;
haddad1995 2:4a0d3be00487 542
haddad1995 2:4a0d3be00487 543 EASYCAT.BufferIn.Cust.Start = start;
haddad1995 2:4a0d3be00487 544
haddad1995 2:4a0d3be00487 545 EASYCAT.BufferIn.Cust.Stepping = stepping;
haddad1995 2:4a0d3be00487 546
haddad1995 2:4a0d3be00487 547 EASYCAT.BufferIn.Cust.EndStep = endStep;
haddad1995 2:4a0d3be00487 548
haddad1995 2:4a0d3be00487 549 EASYCAT.BufferIn.Cust.Enable= enable;
haddad1995 2:4a0d3be00487 550
haddad1995 2:4a0d3be00487 551 EASYCAT.BufferIn.Cust.EnableLateral = enable_Lateral;
haddad1995 2:4a0d3be00487 552
haddad1995 2:4a0d3be00487 553 EASYCAT.BufferIn.Cust.QuickStop = quick_Stop;
haddad1995 2:4a0d3be00487 554
haddad1995 2:4a0d3be00487 555 EASYCAT.BufferIn.Cust.ClearFault = clear_Fault;
haddad1995 2:4a0d3be00487 556
haddad1995 2:4a0d3be00487 557 //Ethercat = EASYCAT.BufferOut.Cust.EtherCAT;
haddad1995 2:4a0d3be00487 558
haddad1995 2:4a0d3be00487 559 //Running_Time = EASYCAT.BufferOut.Cust.Running_Time_T ;
haddad1995 2:4a0d3be00487 560
haddad1995 2:4a0d3be00487 561 //State_Step = EASYCAT.BufferOut.Cust.State_Step_T ;
haddad1995 2:4a0d3be00487 562
haddad1995 2:4a0d3be00487 563 //Status_Driver = EASYCAT.BufferOut.Cust.Status_Driver_T ;
haddad1995 2:4a0d3be00487 564
haddad1995 2:4a0d3be00487 565 //END = EASYCAT.BufferOut.Cust.END_T ;
haddad1995 2:4a0d3be00487 566
haddad1995 2:4a0d3be00487 567
haddad1995 2:4a0d3be00487 568 }
haddad1995 2:4a0d3be00487 569 sprintf(Ethercat_S, "%d", Ethercat);
haddad1995 2:4a0d3be00487 570 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 571 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 572 lcd_.DisplayStringAt(320, 20, (uint8_t *)Ethercat_S, LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 573
haddad1995 2:4a0d3be00487 574
haddad1995 2:4a0d3be00487 575 sprintf(Running_Time_S, "%0.2f", Running_Time);
haddad1995 2:4a0d3be00487 576 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 577 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 578 lcd_.DisplayStringAt(700, 20, (uint8_t *)Running_Time_S, LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 579
haddad1995 2:4a0d3be00487 580 sprintf(State_Step_S, "%d", State_Step);
haddad1995 2:4a0d3be00487 581 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 582 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 583 lcd_.DisplayStringAt(320, 60, (uint8_t *)State_Step_S, LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 584
haddad1995 2:4a0d3be00487 585 sprintf(Status_Driver_S, "%d", Status_Driver);
haddad1995 2:4a0d3be00487 586 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 587 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 588 lcd_.DisplayStringAt(700, 60, (uint8_t *)Status_Driver_S, LEFT_MODE); // Display main header text
haddad1995 2:4a0d3be00487 589
haddad1995 2:4a0d3be00487 590 sprintf(END_S, "%d", END);
haddad1995 2:4a0d3be00487 591 lcd_.SetFont(&Font24);
haddad1995 2:4a0d3be00487 592 lcd_.SetTextColor(LCD_COLOR_BLACK);
haddad1995 2:4a0d3be00487 593 lcd_.DisplayStringAt(150, 440, (uint8_t *)END_S, LEFT_MODE); // Display main header text
wsteenberg 0:ebf3f36f3a64 594 } // End Main program loop
wsteenberg 0:ebf3f36f3a64 595 } // End Main program
haddad1995 2:4a0d3be00487 596
haddad1995 2:4a0d3be00487 597
haddad1995 2:4a0d3be00487 598 //--- functions for Arduino "millis()" emulation -------------------------------------
haddad1995 2:4a0d3be00487 599
haddad1995 2:4a0d3be00487 600
haddad1995 2:4a0d3be00487 601 void InitMillis(void)
haddad1995 2:4a0d3be00487 602 {
haddad1995 2:4a0d3be00487 603 uS_Tick.attach (&mS_Tick, 0.001);
haddad1995 2:4a0d3be00487 604 }
haddad1995 2:4a0d3be00487 605
haddad1995 2:4a0d3be00487 606 void mS_Tick(void)
haddad1995 2:4a0d3be00487 607 {
haddad1995 2:4a0d3be00487 608 MillisVal++;
haddad1995 2:4a0d3be00487 609 }
haddad1995 2:4a0d3be00487 610 void Menu0(void)
haddad1995 2:4a0d3be00487 611 {
haddad1995 2:4a0d3be00487 612
haddad1995 2:4a0d3be00487 613 }