Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI PID DmTftLibraryEx
Revision 32:1be3d79ff4db, committed 2022-04-08
- Comitter:
- lex9296
- Date:
- Fri Apr 08 05:27:20 2022 +0000
- Parent:
- 31:913f664c6189
- Child:
- 33:f77aa3ecf87d
- Commit message:
- Actuator is Working, but I might need some Current Loop.
Changed in this revision
--- a/Display/DisplayDriver.cpp Fri Mar 11 10:25:46 2022 +0000
+++ b/Display/DisplayDriver.cpp Fri Apr 08 05:27:20 2022 +0000
@@ -542,12 +542,8 @@
extern uint16_t aui16_PlotClears_Lo[240];
extern uint16_t aui16_PlotClears_Hi[240];
-void LCM_PlotVector (void) {
+void LCM_PlotVector (uint16_t ui16_Background, uint16_t ui16_Foreground) {
uint16_t ui16_Index000;
-//uint16_t ui16_ActualSample;
-//uint16_t ui16_PreviousSample;
-//uint16_t ui16_Length;
-//int16_t i16_Length;
// LA: Scope Bar Plot, Theory of Operation
// ===================================
@@ -563,13 +559,13 @@
// LA: Clear Previous Plot by means of the Hi/Lo Array(s)
//
- Tft.drawVerticalLineEx (ui16_Index000, 300 - aui16_PlotClears_Hi[ui16_Index000], (int16_t) aui16_PlotClears_Hi[ui16_Index000]- aui16_PlotClears_Lo[ui16_Index000], Scale2RGBColor(31, 31, 31));
+ Tft.drawVerticalLineEx (ui16_Index000, 300 - aui16_PlotClears_Hi[ui16_Index000], (int16_t) aui16_PlotClears_Hi[ui16_Index000]- aui16_PlotClears_Lo[ui16_Index000], ui16_Background);
// LA: Then PLOT the New
//
aui16_PlotClears_Hi[ui16_Index000] = (uint16_t) (af_PlotSamples[ui16_Index000]* 100);
aui16_PlotClears_Lo[ui16_Index000] = (uint16_t) (af_PlotSamples[ui16_Index000- 1]* 100);
//
- Tft.drawVerticalLineEx (ui16_Index000, 300 - aui16_PlotClears_Hi[ui16_Index000], (int16_t) aui16_PlotClears_Hi[ui16_Index000]- aui16_PlotClears_Lo[ui16_Index000], Scale2RGBColor(0, 0, 0));
+ Tft.drawVerticalLineEx (ui16_Index000, 300 - aui16_PlotClears_Hi[ui16_Index000], (int16_t) aui16_PlotClears_Hi[ui16_Index000]- aui16_PlotClears_Lo[ui16_Index000], ui16_Foreground);
}
}
--- a/Display/DisplayDriver.h Fri Mar 11 10:25:46 2022 +0000 +++ b/Display/DisplayDriver.h Fri Apr 08 05:27:20 2022 +0000 @@ -149,7 +149,7 @@ void LCM_SetPixel (uint16_t ui_X, uint16_t ui_Y, uint16_t ui16_Color); void LCM_DrawLine (uint16_t ui_X0, uint16_t ui_Y0, uint16_t ui_X1, uint16_t ui_Y1, uint16_t ui16_Color); -void LCM_PlotVector (void); +void LCM_PlotVector (uint16_t ui16_Background, uint16_t ui16_Foreground); #endif //TFT_DISPLAY_DRIVER_H
--- a/QEI.lib Fri Mar 11 10:25:46 2022 +0000 +++ b/QEI.lib Fri Apr 08 05:27:20 2022 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/QEI/#fe23b32e62ca +https://os.mbed.com/users/lex9296/code/QEI/#0db131925e56
--- a/SWPos/SWPos.cpp Fri Mar 11 10:25:46 2022 +0000
+++ b/SWPos/SWPos.cpp Fri Apr 08 05:27:20 2022 +0000
@@ -960,15 +960,15 @@
// LA: if Not Homed, Positioning Flag(s) are Kept Clear
//
- b_GoingFW = false;
- out.b_InToleranceFW = false;
- b_GoingBW = false;
- out.b_InToleranceBW = false;
+ b_GoingFW = false;
+ out.b_InToleranceFW = false;
+ b_GoingBW = false;
+ out.b_InToleranceBW = false;
- out.b_Accelerating = false;
- out.b_MaxSpeedReached = false;
- out.b_Decelerating = false;
- out.b_InPosition = false;
+ out.b_Accelerating = false;
+ out.b_MaxSpeedReached = false;
+ out.b_Decelerating = false;
+ out.b_InPosition = false;
b_AuxCalculateProfile_000 = false;
b_AuxCalculateProfile_001 = false;
@@ -984,15 +984,15 @@
// LA: if Not Powered, Motion Flag(s) are Kept Clear
//
- b_GoingFW = false;
- out.b_InToleranceFW = false;
- b_GoingBW = false;
- out.b_InToleranceBW = false;
+ b_GoingFW = false;
+ out.b_InToleranceFW = false;
+ b_GoingBW = false;
+ out.b_InToleranceBW = false;
- out.b_Accelerating = false;
+ out.b_Accelerating = false;
out.b_MaxSpeedReached = false;
- out.b_Decelerating = false;
- out.b_InPosition = false;
+ out.b_Decelerating = false;
+ out.b_InPosition = false;
b_AuxCalculateProfile_000 = false;
b_AuxCalculateProfile_001 = false;
--- a/main.cpp Fri Mar 11 10:25:46 2022 +0000
+++ b/main.cpp Fri Apr 08 05:27:20 2022 +0000
@@ -1,4 +1,3 @@
-
//Warning: Incompatible redefinition of macro "MBED_RAM_SIZE" in "tmp/HU5Hqj", Line: 39, Col: 10
#ifndef MBED_RAM_SIZE
@@ -8,28 +7,28 @@
#include "QEI.h"
#include "SWPos.h"
-#include "DmTftIli9341.h"
-
#include "Timers.h"
-//#include "Menu.h"
#include "Eeprom.h"
-//#include "main.h"
-//#include "app_config.h"
#define MAX_CHAR_PER_LINE 28
#define TEXT_ROW_SPACING 16
#define FONT_CHAR_WIDTH 8
#define FONT_CHAR_HEIGHT 16
-//#include "mbed.h"
#include "DisplayDriver.h"
-//#include "DmTftIli9341.h"
-//#include "DmTouch.h"
-//#include "DmTouchCalibration.h"
-int32_t i32_Pulses;
-//
+void LCM_ShowTactics(
+ int32_t i32_Pulses,
+ int32_t i32_ATVSpeed,
+ float f_ai0000_Aux,
+ float f_ai0001_Aux,
+ float f_ai0002_Aux,
+ float f_ai0003_Aux,
+ float f_ai0004_Aux,
+ float f_ai0005_Aux
+ );
static void SampleAndStore (void);
+
Ticker SampleTimer; // LA: To Sample 1AI any ms
float af_PlotSamples[240]; // LA: "Horiz" Plot Array
@@ -57,6 +56,9 @@
//DigitalOut SD_CS (D8); // MBED description of pin
DigitalIn userButton (USER_BUTTON);
+//
+DigitalOut rENA_Off (PC_0); // CN7.38 - Power Enable Relay, Power Disabled when true
+DigitalOut rDIR_FWD (PC_1); // CN7.36 - Move Direction Relay Bridge, Move FW(Extends) when true
AnalogIn adc_temp (ADC_TEMP);
AnalogIn adc_vref (ADC_VREF);
@@ -74,6 +76,8 @@
// ===
//
QEI Stabilus322699 (PA_1, PA_0, NC, 100, QEI::X4_ENCODING);
+//DigitalIn Hall_A (PA_1);
+//DigitalIn Hall_B (PA_0);
// Motion
// ======
@@ -100,25 +104,15 @@
// =======
//
int main (void){
-char StringText[MAX_CHAR_PER_LINE + 1]; // don't forget the /0 (end of string)
-//char StringText2[MAX_CHAR_PER_LINE + 1];
-//char StringText3[MAX_CHAR_PER_LINE + 1];
+const float cf_PWMPeriod_s = 0.010;
-//uint16_t ui16_TestColor = 0x0000;
-//uint16_t ui16_TestStep = 0x0000;
-//
-//uint16_t ui16_R = 0x00;
-//uint16_t ui16_G = 0x00;
-//uint16_t ui16_B = 0x00;
-
-uint32_t ui32_PreCallms;
-uint32_t ui32_PostCallms;
-uint32_t ui32_Samplems;
+ rDIR_FWD = true; // LA: Actuator Extends
+ rENA_Off = true; // LA: Drive Power is Off
EepromInit(); // LA: Inizializza la EEProm
TimersInit(); // LA: Parte il Timer a 1ms
- SampleTimer.attach_us( &SampleAndStore, 1000 );
+ SampleTimer.attach_us(&SampleAndStore, 250);
// LA: FactoryReset se "userButton" premuto all'avvio
//
@@ -127,8 +121,8 @@
}
DisplayDriverInit();
- PWM_PB3.period_us(100); // LA: Avvia il PWM con TimeBase 100us
- PWM_PB3.pulsewidth_us(0); // 0.. 100us -> 0.. 100%, Set to ZERO
+ PWM_PB3.period(cf_PWMPeriod_s); // LA: Avvia il PWM con TimeBase x [s]
+ PWM_PB3.write((float) 0.0); // Set to 0%
// LA: Motion (1st) Setup
//
@@ -137,28 +131,35 @@
in_PosizionatoreSW.i32_Max_Speed = 1024; // [ui]
in_PosizionatoreSW.i32_ZeroSpeed = 0; //
+ // POS Mode
+ // ========
+ //
+ in_PosizionatoreSW.b_ServoLock = true;
+ in_PosizionatoreSW.rtServoLock_Q = false;
+ //
+ in_PosizionatoreSW.i64_TargetPosition = 3200; // [ui]
+ in_PosizionatoreSW.i64_ActualPosition = Stabilus322699.getPulses(); //
+ in_PosizionatoreSW.i64_AccelerationWindow = 64; // LA: Spazio concesso all'accelerazione.
+ in_PosizionatoreSW.i64_DecelerationWindow = 512; // Spazio concesso alla decelerazione, è prioritario rispetto all'accelerazione.
+ in_PosizionatoreSW.i64_diToleranceWindow = 10; // Finestra di Tolleranza
+ //
+ in_PosizionatoreSW.f_MaximumSpeed_x100_FW = 16.0; // % of "i32_Max_Speed"
+ in_PosizionatoreSW.f_MaximumSpeed_x100_BW = 60.0; //
+ in_PosizionatoreSW.f_ServoLockSpeed_x100_FW = 4.8; // Riferimento di velocità minima a cui (appena) si muove l'asse [verso FW]
+ in_PosizionatoreSW.f_ServoLockSpeed_x100_BW = 18.0; // Riferimento di velocità minima a cui (appena) si muove l'asse [verso BW]
+
+ // JOG Mode
+ // ========
+ //
in_PosizionatoreSW.b_JogMode = false;
in_PosizionatoreSW.b_JogFW = false;
in_PosizionatoreSW.b_JogBW = false;
in_PosizionatoreSW.i32_JogAccel_ms = 500; // [ms]
in_PosizionatoreSW.i32_JogDecel_ms = 250; //
//
- in_PosizionatoreSW.f_JogSpeed_x100_FW = 25.0; // % of "i32_Max_Speed"
- in_PosizionatoreSW.f_JogSpeed_x100_BW = 25.0; //
+ in_PosizionatoreSW.f_JogSpeed_x100_FW = (in_PosizionatoreSW.f_MaximumSpeed_x100_FW/ 2); // LA: JOG's the Half of Max POS's Speed
+ in_PosizionatoreSW.f_JogSpeed_x100_BW = (in_PosizionatoreSW.f_MaximumSpeed_x100_BW/ 2); //
- in_PosizionatoreSW.b_ServoLock = true;
- in_PosizionatoreSW.rtServoLock_Q = false;
- //
- in_PosizionatoreSW.i64_TargetPosition = 1000; // [ui]
- in_PosizionatoreSW.i64_ActualPosition = 200; //
- in_PosizionatoreSW.i64_AccelerationWindow = 50; // LA: Spazio concesso all'accelerazione.
- in_PosizionatoreSW.i64_DecelerationWindow = 50; // Spazio concesso alla decelerazione, è prioritario rispetto all'accelerazione.
- in_PosizionatoreSW.i64_diToleranceWindow = 10; // Finestra di Tolleranza
- //
- in_PosizionatoreSW.f_MaximumSpeed_x100_FW = 25.0; // % of "i32_Max_Speed"
- in_PosizionatoreSW.f_MaximumSpeed_x100_BW = 25.0; //
- in_PosizionatoreSW.f_ServoLockSpeed_x100_FW = 5.0; //
- in_PosizionatoreSW.f_ServoLockSpeed_x100_BW = 5.0; //
// LA: Color RGB Component(s)
// ======================
@@ -182,126 +183,47 @@
// writeReg(GREEN, (Color & 0x07e0) >> 5);
// writeReg(BLUE, (Color & 0x001f));
//
- LCM_SetTextColor(Scale2RGBColor (31, 31, 31), Scale2RGBColor (0, 0, 0)); // LA: Black on White
- LCM_ClearScreen (Scale2RGBColor (31, 31, 31));
+ LCM_SetTextColor(Scale2RGBColor (0, 0, 0), Scale2RGBColor (31, 0, 0)); // LA: Red on Black
+ LCM_ClearScreen (Scale2RGBColor (0, 0, 0)); // Black Background
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 0), "You Start Me Up ..."); // Intro Text
-// ui16_TestColor = Scale2RGBColor (ui16_R, ui16_G, ui16_B);
-// LCM_SetTextColor (
-// Scale2RGBColor (0, 0, 0),
-// Scale2RGBColor (31, 31, 31)
-// );
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 0), "You Start Me Up ...");
+// rDIR_FWD = false; // Collapse
+// rENA_Off = false; // Power On
+
+ in_PosizionatoreSW.b_ServoLock = true;
+ in_PosizionatoreSW.rtServoLock_Q = true;
while (1) {
- static int32_t Pulses_Prec;
- static uint32_t ms_0002_prec;
- static uint32_t ms_0003_prec;
-
- float f_ai0000_Aux;
- //
- float f_ai0000_prec;
- float f_ai0001_prec;
- float f_ai0002_prec;
- float f_ai0003_prec;
- float f_ai0004_prec;
-
-/*
- i32_Pulses = Stabilus322699.getPulses();
- PWM_PB3.pulsewidth_us(((float)i32_Pulses/ (float)5000.0)* (float)100.0); // 0.. 100us -> 0.. 100%
-
- in_PosizionatoreSW.i64_ActualPosition = (int64_t) i32_Pulses; //
-
- ui32_PreCallms = TimersTimerValue(); // Freezes the Actual Sample.
- PosizionatoreSW (in_PosizionatoreSW, out_PosizionatoreSW);
- ui32_PostCallms = TimersTimerValue();
- //
- if (ui32_PostCallms >= ui32_PreCallms)
- ui32_Samplems = ui32_PostCallms- ui32_PreCallms; // Result => Actual - Previous
- else
- ui32_Samplems = ui32_PostCallms+ (0x7fffffff- ui32_PreCallms); // Result => Actual+ (Rollover- Previous)
-*/
-// Override
-//
-
-
- // LA: Wedge 4 LCDRefresh
-/*
- if (
- (i32_Pulses != Pulses_Prec)
- ) {
- sprintf (StringText,
- "Pulses: %d ", i32_Pulses);
- LCM_SetTextColor (Scale2RGBColor (0, 0, 31), Scale2RGBColor (31, 31, 0));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 1), StringText);
- }
-*/
-
-// if (out_PosizionatoreSW.ui32_PassedActual_ms != ms_0003_prec) {
- if (ui32_Samplems != ms_0003_prec) {
- sprintf (StringText,
-// "PassedActual_ms: %d ", out_PosizionatoreSW.ui32_PassedActual_ms);
- "PassedActual_ms: %d ", ui32_Samplems);
- LCM_SetTextColor (Scale2RGBColor (0, 31, 0), Scale2RGBColor (31, 0, 31));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 2), StringText);
-// ms_0003_prec = out_PosizionatoreSW.ui32_PassedActual_ms;
- ms_0003_prec = ui32_Samplems;
- }
+ float f_PWMPercent;
- if (out_PosizionatoreSW.i32_ATVSpeed != ms_0002_prec) {
- sprintf (StringText,
- "Speed[ui]: %d ", out_PosizionatoreSW.i32_ATVSpeed);
- LCM_SetTextColor (Scale2RGBColor (0, 31, 0), Scale2RGBColor (31, 0, 31));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 3), StringText);
- ms_0002_prec = out_PosizionatoreSW.i32_ATVSpeed;
- }
-
- f_ai0000_Aux = adc_temp.read();
- if (f_ai0000_Aux != f_ai0000_prec) {
- sprintf (StringText,
-// "ADC Temp = %f\n", (f_ai0000_Aux* 100));
- "ADC Temp = %f ", (f_ai0000_Aux* 100));
- LCM_SetTextColor (Scale2RGBColor (0, 31, 0), Scale2RGBColor (31, 0, 31));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 4), StringText);
- f_ai0000_prec = f_ai0000_Aux;
- }
-
- f_ai0000_Aux = adc_vbat.read();
- if (f_ai0000_Aux != f_ai0001_prec) {
- sprintf (StringText,
-// "ADC VBat = %f\n", (f_ai0000_Aux* 100));
- "ADC VBat = %f ", (f_ai0000_Aux));
- LCM_SetTextColor (Scale2RGBColor (0, 31, 0), Scale2RGBColor (31, 0, 31));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 5), StringText);
- f_ai0001_prec = f_ai0000_Aux;
- }
+ in_PosizionatoreSW.i64_ActualPosition = Stabilus322699.getPulses();
+ //
+ PosizionatoreSW (in_PosizionatoreSW, out_PosizionatoreSW);
+ in_PosizionatoreSW.rtServoLock_Q = false;
+
+ // int64_t i64_StartPosition;
+ // int64_t i64_Distance;
+ // bool b_Accelerating; // LA: bACPos_Accelerating
+ // bool b_MaxSpeedReached;
+ // bool b_Decelerating; // bACPos_Decelerating
+ // bool b_InPosition;
+ // bool b_InToleranceFW;
+ // bool b_InToleranceBW;
+
+ // int32_t i32_ATVSpeed;
+ f_PWMPercent = ((float)out_PosizionatoreSW.i32_ATVSpeed)/ (float)in_PosizionatoreSW.i32_Max_Speed; // LA: In Range (float) 0.. 1
+ PWM_PB3.write((float) 1.0- f_PWMPercent); // Set to x%
- f_ai0000_Aux = adc_vref.read();
- if (f_ai0000_Aux != f_ai0002_prec) {
- sprintf (StringText,
-// "ADC VRef = %f\n", (f_ai0000_Aux* 100));
- "ADC VRef = %f ", (f_ai0000_Aux));
- LCM_SetTextColor (Scale2RGBColor (0, 31, 0), Scale2RGBColor (31, 0, 31));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 6), StringText);
- f_ai0002_prec = f_ai0000_Aux;
- }
-
- f_ai0000_Aux = ADC12_IN9.read();
- if (f_ai0000_Aux != f_ai0003_prec) {
- sprintf (StringText,
- "ADC12.09 = %f ", (f_ai0000_Aux));
- LCM_SetTextColor (Scale2RGBColor (0, 31, 0), Scale2RGBColor (31, 0, 31));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 8), StringText);
- f_ai0003_prec = f_ai0000_Aux;
- }
-
- f_ai0000_Aux = ADC12_IN15.read();
- if (f_ai0000_Aux != f_ai0004_prec) {
- sprintf (StringText,
- "ADC12.15 = %f ", (f_ai0000_Aux));
- LCM_SetTextColor (Scale2RGBColor (0, 31, 0), Scale2RGBColor (31, 0, 31));
- LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 9), StringText);
- f_ai0004_prec = f_ai0000_Aux;
- }
+ // bool b_ATVDirectionFW;
+ rDIR_FWD = out_PosizionatoreSW.b_ATVDirectionFW;
+
+ // bool b_ATVDirectionBW;
+
+ // bool b_STW1_On;
+ // bool b_STW1_NoCStop;
+ // bool b_STW1_NoQStop;
+ // bool b_STW1_Enable;
+ rENA_Off = !out_PosizionatoreSW.b_STW1_Enable;
// LA: Scope, Theory of operation.
// ===========================
@@ -310,21 +232,126 @@
// 2) Store @ the correct ms
// 3) Plot the current Section of the Sampling Vector
//
+ LCM_ShowTactics (
+ Stabilus322699.getPulses(), // Row 1
- LCM_PlotVector();
+ out_PosizionatoreSW.i32_ATVSpeed, // 3
+ adc_temp.read(), // 4
+ adc_vbat.read(), // 5
+ adc_vref.read(), // 6
+
+ ADC12_IN9.read(), // 8
+ ADC12_IN15.read(), // 9
+ (f_PWMPercent* 100) // 10
+ );
+
+ LCM_PlotVector (
+ Scale2RGBColor (0, 0, 0), // Back: Black
+ Scale2RGBColor (31, 0, 0) // Fore: Red
+ );
+
+
+ if (out_PosizionatoreSW.b_InPosition)
+ if (in_PosizionatoreSW.i64_TargetPosition > 0)
+ in_PosizionatoreSW.i64_TargetPosition = 0;
+ else
+ in_PosizionatoreSW.i64_TargetPosition = 3200;
}
}
-static void SampleAndStore (void) {
+void LCM_ShowTactics(
+ int32_t i32_Pulses,
+ int32_t i32_ATVSpeed,
+ float f_ai0000_Aux,
+ float f_ai0001_Aux,
+ float f_ai0002_Aux,
+ float f_ai0003_Aux,
+ float f_ai0004_Aux,
+ float f_ai0005_Aux
+ ) {
+
+char StringText[MAX_CHAR_PER_LINE+ 1]; // don't forget the /0 (end of string)
+
+static int32_t Pulses_Prec;
+static uint32_t ms_0002_prec;
+
+static float f_ai0000_prec;
+static float f_ai0001_prec;
+static float f_ai0002_prec;
+static float f_ai0003_prec;
+static float f_ai0004_prec;
+static float f_ai0005_prec;
+
+ if (i32_Pulses != Pulses_Prec) {
+ sprintf (StringText,
+ "Pulses: %d ", i32_Pulses);
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 1), StringText);
+ Pulses_Prec = i32_Pulses;
+ }
+
+ if (i32_ATVSpeed != ms_0002_prec) {
+ sprintf (StringText,
+ "Speed[ui]: %d ", i32_ATVSpeed);
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 3), StringText);
+ ms_0002_prec = i32_ATVSpeed;
+ }
+
+ if (f_ai0000_Aux != f_ai0000_prec) {
+ sprintf (StringText,
+ "ADC Temp = %f ", (f_ai0000_Aux* 100));
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 4), StringText);
+ f_ai0000_prec = f_ai0000_Aux;
+ }
+
+ if (f_ai0001_Aux != f_ai0001_prec) {
+ sprintf (StringText,
+ "ADC VBat = %f ", (f_ai0001_Aux* 10));
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 5), StringText);
+ f_ai0001_prec = f_ai0001_Aux;
+ }
+
+ if (f_ai0002_Aux != f_ai0002_prec) {
+ sprintf (StringText,
+ "ADC VRef = %f ", (f_ai0002_Aux* 10));
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 6), StringText);
+ f_ai0002_prec = f_ai0002_Aux;
+ }
+
+ if (f_ai0003_Aux != f_ai0003_prec) {
+ sprintf (StringText,
+ "ADC12.09 = %f ", (f_ai0003_Aux* 10)/ 3);
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 8), StringText);
+ f_ai0003_prec = f_ai0003_Aux;
+ }
+
+ if (f_ai0004_Aux != f_ai0004_prec) {
+ sprintf (StringText,
+ "ADC12.15 = %f ", (f_ai0004_Aux* 10)/ 3);
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 9), StringText);
+ f_ai0004_prec = f_ai0004_Aux;
+ }
+
+ if (f_ai0005_Aux != f_ai0005_prec) {
+ sprintf (StringText,
+ "PB3 PWM%% = %f ", (f_ai0005_Aux));
+ LCM_DrawString (0, 0+ (TEXT_ROW_SPACING* 10), StringText);
+ f_ai0005_prec = f_ai0005_Aux;
+ }
+}
+
+//static void SampleAndStore (void) {
+void SampleAndStore (void) {
+//static int32_t i32_Pulses;
int16_t i16_SampleIndex;
//float f_SampleAux;
- af_PlotSamples[240- 1] = ADC12_IN9.read();
- for (i16_SampleIndex = 0; i16_SampleIndex < (240- 1); i16_SampleIndex++) {
+// af_PlotSamples[240- 1] = ADC12_IN9.read();
+ af_PlotSamples[240- 1] = (float) Stabilus322699.getChannelA() * 0.33f;
+
+ for (i16_SampleIndex = 0; i16_SampleIndex < (240- 1); i16_SampleIndex++)
af_PlotSamples[i16_SampleIndex] = af_PlotSamples[i16_SampleIndex+ 1];
- }
- i32_Pulses++;
+// i32_Pulses++;
}
// getDmTft().setPixel (0,0,1);