Modifying GADC example board file.

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Tue May 07, 2013 6:09 am

Jep, what inmarket said.

When you want to create a bar graph like application, make sure you clear the area of the line/bar when you redraw it. You can optimize it by first checking if the value became smaller than the one currently being displayed.
Note that you could also use the already existing slider widget to display a bar graph. It gives you the advantage of the custom render interface which allows you to make it look like what ever you want.


~ Tectu

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Thu May 09, 2013 11:15 am

Did you get it to work? It would be nice if you always let other people know if you finally got everything working. For one that we know that our help was somehow helpful and for another that people coming to this thread searching for something similar know that it has worked.


~ Tectu

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Fri May 10, 2013 8:41 am

Yes Tectu the help from you and the other has been amazing i have got it working enough to see whats going on when i pass metal over my detector coil .
Sorry about the delay i have been playing around with my code. :)
My coding is a mess and i have not used timers yet but still i can see the coil decay and how it changes when a object is passed over the coil i still have a lot of work to go with coding and circuit design as what i am using now is very basic. Below is my code and a couple of videos of it in action .
I also added my board file and panel file just in case it helps others..
Any suggestions would be great.
Setup:
STM32F4 Discovery
7" lcd with SSD1963 controller (China / Ebay)

Code: Select all

    /*
       ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
                     2011 Giovanni Di Sirio.

        This file is part of ChibiOS/RT.

        ChibiOS/RT is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 3 of the License, or
        (at your option) any later version.

        ChibiOS/RT is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
    */
#include <stdio.h>
#include "ch.h"
#include "hal.h"
#include "gfx.h"
#include "dawetecsml.h"
#include "chprintf.h"
#include "string.h"
#include "stubs.c"
#include "syscalls.c"

static gdispImage myImage;
//ADC 2 SETUP (coil decay read)
#define ADC_GRP2_NUM_CHANNELS   1
#define ADC_GRP2_BUF_DEPTH      16

static adcsample_t samples2[ADC_GRP2_NUM_CHANNELS * ADC_GRP2_BUF_DEPTH];
size_t nx = 0, ny = 0;
static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n) {

      (void)adcp;
      if (samples2 == buffer) {
        nx += n;
      }
      else {
        ny += n;
      }
    }

static void adcerrorcallback(ADCDriver *adcp, adcerror_t err) {

      (void)adcp;
      (void)err;
    }
static const ADCConversionGroup adcgrpcfg2 = {
      TRUE,
      ADC_GRP2_NUM_CHANNELS,
      adccallback,
      adcerrorcallback,
      0,                        /* CR1 */
      ADC_CR2_SWSTART,          /* CR2 */
      ADC_SMPR1_SMP_AN11(ADC_SAMPLE_15),
      0,                        /* SMPR2 */
      ADC_SQR1_NUM_CH(ADC_GRP2_NUM_CHANNELS),
      0,
      ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
    };
//ADC1 SETUP (battery test)
#define ADC_GRP1_NUM_CHANNELS   1
#define ADC_GRP1_BUF_DEPTH      1
static adcsample_t samples1[ADC_GRP1_NUM_CHANNELS * ADC_GRP1_BUF_DEPTH];
static const ADCConversionGroup adcgrpcfg1 = {
      TRUE,
      ADC_GRP1_NUM_CHANNELS,
      NULL,
      NULL,
      0,                        /* CR1 */
      ADC_CR2_SWSTART,          /* CR2 */
      ADC_SMPR1_SMP_AN12(ADC_SAMPLE_112),
      0,                        /* SMPR2 */
      ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS),
      0,
      ADC_SQR3_SQ1_N(ADC_CHANNEL_IN12)
    };
//App entry
int main(void) {
      halInit();
      chSysInit();
//reset lcd
      palClearPad(GPIOC, GPIOC_PIN6);
      chThdSleepMilliseconds(100);
      palSetPad(GPIOC, GPIOC_PIN6);
/* Initialize and clear the display */
      font_t font1 = gdispOpenFont("Larger");
      font_t font2 = gdispOpenFont("UI1");
      gdispInit();
      gdispClear(Black);
/** Setting up analog inputs      */
      palSetGroupMode(GPIOC, PAL_PORT_BIT(1),0, PAL_MODE_INPUT_ANALOG);
      palSetGroupMode(GPIOC, PAL_PORT_BIT(2),0, PAL_MODE_INPUT_ANALOG);
/** Activates the ADC1/ADC2 driver.*/
      adcStart(&ADCD1, NULL);
      adcStart(&ADCD2, NULL);
/** Starts an ADC continuous conversion.*/
      adcStartConversion(&ADCD2, &adcgrpcfg1, samples1, ADC_GRP1_BUF_DEPTH);
      adcStartConversion(&ADCD1, &adcgrpcfg2, samples2, ADC_GRP2_BUF_DEPTH);

//Splash Screen
      gdispImageSetMemoryReader(&myImage, dawetecsml);
      gdispImageOpen(&myImage);
      gdispImageDraw(&myImage, 120, 150, myImage.width, myImage.height, 0, 0);
      gdispImageClose(&myImage);
      chThdSleepMilliseconds(1000);
      gdispClear(Black);
//main menu Labels
      gdispDrawString(10, 1, "DaweTec Titan200", font1, White);
      gdispDrawString(10, 470, "Version 1.1", font1, White);
      gdispDrawString(10, 235, "Detection Level:",font2 , White);

//draw level borders
      gdispDrawLine(194,149,194,471,Grey);
      gdispDrawLine(194,471,418,471,Grey);
      gdispDrawLine(420,471,420,149,Grey);
      gdispDrawLine(194,149,420,149,Grey);
//PLUSE START
      char buffer[5];//Buffer for start voltage
      char buffer1[5];//Buffer for end voltage
      char Batt[5];//Buffer for battery test
      palSetPadMode(GPIOD,13,PAL_MODE_OUTPUT_PUSHPULL);// set pulse trigger output

while ( TRUE ) {
      gdispFillArea(10, 220, 90, 10, Black);
      gdispDrawString(10, 220, "Detection ON",font2 , White);
//Test Battery Level Average Samples On Channel 2 PC2 And Display as percentage
      float voltage1 = ((((adcsample_t) (samples1[0])*2.12/4096)/2.12)*100);
      gdispFillArea(670, 1, 140, 10, Black);
      sprintf(Batt, "Battery Level: %.2f", voltage1);
      gdispDrawString(670, 1, Batt, font1 , White);
//Fire Pulse's and read feedback
      palClearPad(GPIOD,13);       //Coil ON - Pulse trigger for mosfet driver
      chThdSleepMicroseconds(250); // Coil Charge
      palSetPad(GPIOD,13);         //Coil OFF
//All the DrawPixels used below are just to make slight delay.
      gdispDrawPixel(30,10,Black);
      gdispDrawPixel(30,10,Black);
//Read samples of coil decay
      float volts2 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
            gdispDrawPixel(30,10,Black);
      float volts3 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts4 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float  volts5 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts6 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts7 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts8 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts9 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts10 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts11 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float  volts12 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts13 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts14 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts15 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts16 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float  volts17 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts18 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts19 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts20 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts21 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts22 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts23 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts24 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
      float volts25 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
              gdispDrawPixel(30,10,Black);
        float volts26 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts27 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts28 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts29 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts30 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts31 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts32 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts33 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts34 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts35 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts36 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts37 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts38 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts39 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts40 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts41 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
           gdispDrawPixel(30,10,Black);
     float volts42 =  ((adcsample_t) ((samples2[3]+samples2[4]+samples2[5]+samples2[6]+samples2[7]+samples2[8])/6)*2.45/4096);
//Display Sample Data
      gdispFillArea(195, 150, 223, 321, Black);
      gdispDrawLine(195,200,200,(460-(coord_t)(volts2*100)),Red);
      gdispDrawLine(200,(460-(coord_t)(volts2*100)),205,(460-(coord_t)(volts3*100)),Red);
      gdispDrawLine(205,(460-(coord_t)(volts3*100)),210,(460-(coord_t)(volts4*100)),Red);
     gdispDrawLine(210,(460-(coord_t)(volts4*100)),215,(460-(coord_t)(volts5*100)),Red);
     gdispDrawLine(215,(460-(coord_t)(volts5*100)),220,(460-(coord_t)(volts6*100)),Red);
     gdispDrawLine(220,(460-(coord_t)(volts6*100)),225,(460-(coord_t)(volts7*100)),Red);
     gdispDrawLine(225,(460-(coord_t)(volts7*100)),230,(460-(coord_t)(volts8*100)),Red);
     gdispDrawLine(230,(460-(coord_t)(volts8*100)),235,(460-(coord_t)(volts9*100)),Red);
     gdispDrawLine(235,(460-(coord_t)(volts9*100)),240,(460-(coord_t)(volts10*100)),Red);
     gdispDrawLine(240,(460-(coord_t)(volts10*100)),245,(460-(coord_t)(volts11*100)),Red);
     gdispDrawLine(245,(460-(coord_t)(volts11*100)),250,(460-(coord_t)(volts12*100)),Red);
     gdispDrawLine(250,(460-(coord_t)(volts12*100)),255,(460-(coord_t)(volts13*100)),Red);
     gdispDrawLine(255,(460-(coord_t)(volts13*100)),260,(460-(coord_t)(volts14*100)),Red);
     gdispDrawLine(260,(460-(coord_t)(volts14*100)),265,(460-(coord_t)(volts15*100)),Red);
     gdispDrawLine(265,(460-(coord_t)(volts15*100)),270,(460-(coord_t)(volts16*100)),Red);
     gdispDrawLine(270,(460-(coord_t)(volts16*100)),275,(460-(coord_t)(volts17*100)),Red);
     gdispDrawLine(275,(460-(coord_t)(volts17*100)),280,(460-(coord_t)(volts18*100)),Red);
     gdispDrawLine(280,(460-(coord_t)(volts18*100)),285,(460-(coord_t)(volts19*100)),Red);
     gdispDrawLine(285,(460-(coord_t)(volts19*100)),290,(460-(coord_t)(volts20*100)),Red);
     gdispDrawLine(290,(460-(coord_t)(volts20*100)),295,(460-(coord_t)(volts21*100)),Red);
     gdispDrawLine(295,(460-(coord_t)(volts21*100)),300,(460-(coord_t)(volts22*100)),Red);
     gdispDrawLine(300,(460-(coord_t)(volts22*100)),305,(460-(coord_t)(volts23*100)),Red);
     gdispDrawLine(305,(460-(coord_t)(volts23*100)),310,(460-(coord_t)(volts24*100)),Red);
     gdispDrawLine(310,(460-(coord_t)(volts24*100)),315,(460-(coord_t)(volts25*100)),Red);
     gdispDrawLine(315,(460-(coord_t)(volts25*100)),320,(460-(coord_t)(volts26*100)),Red);
     gdispDrawLine(320,(460-(coord_t)(volts26*100)),325,(460-(coord_t)(volts27*100)),Red);
     gdispDrawLine(325,(460-(coord_t)(volts27*100)),330,(460-(coord_t)(volts28*100)),Red);
     gdispDrawLine(330,(460-(coord_t)(volts28*100)),335,(460-(coord_t)(volts29*100)),Red);
     gdispDrawLine(335,(460-(coord_t)(volts29*100)),340,(460-(coord_t)(volts30*100)),Red);
     gdispDrawLine(340,(460-(coord_t)(volts30*100)),345,(460-(coord_t)(volts31*100)),Red);
     gdispDrawLine(345,(460-(coord_t)(volts31*100)),350,(460-(coord_t)(volts32*100)),Red);
     gdispDrawLine(350,(460-(coord_t)(volts32*100)),355,(460-(coord_t)(volts33*100)),Red);
     gdispDrawLine(355,(460-(coord_t)(volts33*100)),360,(460-(coord_t)(volts34*100)),Red);
     gdispDrawLine(360,(460-(coord_t)(volts34*100)),365,(460-(coord_t)(volts35*100)),Red);
     gdispDrawLine(365,(460-(coord_t)(volts35*100)),370,(460-(coord_t)(volts36*100)),Red);
     gdispDrawLine(370,(460-(coord_t)(volts36*100)),375,(460-(coord_t)(volts37*100)),Red);
     gdispDrawLine(375,(460-(coord_t)(volts37*100)),380,(460-(coord_t)(volts38*100)),Red);
     gdispDrawLine(380,(460-(coord_t)(volts38*100)),385,(460-(coord_t)(volts39*100)),Red);
     gdispDrawLine(385,(460-(coord_t)(volts39*100)),390,(460-(coord_t)(volts40*100)),Red);
     gdispDrawLine(390,(460-(coord_t)(volts40*100)),395,(460-(coord_t)(volts41*100)),Red);
     gdispDrawLine(395,(460-(coord_t)(volts41*100)),400,(460-(coord_t)(volts42*100)),Red);
// Display Start and End Voltage
     gdispFillArea(10, 130, 150, 25, Black);
      sprintf(buffer, "Start V: %.4fV", volts2);
      gdispDrawString(10, 130, buffer, font1, White);
      sprintf(buffer1, "End V: %.4fV", volts42);
      gdispDrawString(10, 142, buffer1, font1, White);
      chThdSleepMicroseconds(3);

}



      while(TRUE) {
                     chThdSleepMilliseconds(500);
                 }

    }


Video of above code and object been passed over coil:
http://youtu.be/a7HBg8r467A
Video of my video benchmark:
http://youtu.be/24daiA2mIKI
Last edited by daviddawe1982 on Fri May 10, 2013 8:46 am, edited 1 time in total.

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Fri May 10, 2013 8:45 am

Files:
Attachments
SSD1963_7inch_STM32F4_Dis.zip
7" Ebay lcd with SSD1963 Controller Panel and Board Files for STM32F4 Discovery
(3.98 KiB) Downloaded 95 times

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Fri May 10, 2013 12:13 pm

That's pretty cool! Do you have a blog or something of your project we could link to from the GFX webpage?


~ Tectu

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Fri May 10, 2013 1:10 pm

no web site yet i will build one as the project advances.
just a quick question is the thread sleep function any good as when i was playing around i found that trying to sleep for 1 micro second worked in code but on the board it took way longer i think around 20 micro seconds for a 1 micro second sleep..
thats why i used the draw pixel

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Fri May 10, 2013 1:33 pm

When you use chThdSleepMilliseconds() you just make the current thread to sleep. This means that the task scheduler will move on to the next thread. When you do something time intensive there it will take longer than just that 1ms to resume the other thread. A quick work around can be setting the thread priority higher.

Would it be possible that you make an even nicer video showing how you move different metals over your detector and so on? It would be a nice piece for our blog and the twitter account. It's really a nice project you're doing there!


~ Tectu

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Fri May 10, 2013 1:36 pm

ok i will do a new video with different camera and better light tomorrow
thanks :D

jscott
Posts: 124
Joined: Tue Jul 03, 2012 3:50 pm
Location: Middle Georgia, USA
Contact:

Re: Modifying GADC example board file.

Postby jscott » Fri May 10, 2013 1:37 pm

I can't look it up right now, but i think 1uS is too short of a delay in this case.

when you put a thread to sleep, you are going to cause a reschedule.
then after the delay, another reschedule is going to happen to turn
to your thread.

Now you have at least two reschedules happening. I don't remember how
long a reschedule takes on the stmf4 but you are going to be saving and
restoring all the registers for each one, plus other tasks of the same or
higher priority will get a chance to run.

There is a busy loop delay function that uses the timers that you can use
for very short delays like this. You can look for it in the docs, it is clearly
marked that is should only be used for short delays.

Very nice demo!! Can you give us more details on the lcd panel you are using?

-John Scott
http://www.atl123.com

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Fri May 10, 2013 4:16 pm

Thank you i will look it up here is a link to the panel on ebay
http://www.ebay.com/itm/111006253453


Return to “LCD Driver and Graphic Framework”

Who is online

Users browsing this forum: No registered users and 2 guests