Announcement

Collapse
No announcement yet.

Scope Update Rate

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scope Update Rate

    Hi,

    I'm using a Gen4-uLCD-50D to plot an ECG acquired through an Arduino Mega.

    The data acquisition from the Arduino works fine, with the right frequency for a proper visualization of the ECG wave (~30Hz).

    When I send the data to the scope object, it slows all my program to a level that I can't even visualize the ECG.

    Is there a way to increase the scope refresh rate?

    Thanks

  • #2
    Hello renandelima,

    How are you sending your data through the Gen4-uLCD-50D? Are you using the genieArduino library?
    If the data sending is not handled correctly it may cause some conflicts on your other codes.
    Can you provide me a sample of your code so I can try and implement it.

    Best Regards,
    Kevin

    Comment


    • #3
      Yes, I`m using the genieArduino library.

      So far, its`s a very straight forward code:

      Code:
      void loop(){
      i = map(analogRead(A3), 0, 1023, 0, 180);  
      genie.WriteObject(GENIE_OBJ_SCOPE, 0x00, i );
      Serial.println(i); //debugging 
      }
      Thanks

      Comment


      • #4
        Hello renandelima,

        There is no problem on sending the data, but some code might prevent you from constantly sending your analog reading (your other existing codes).
        Still if you want to send a data to the display, it is best to put it on a non-blocking delay so it will run along with your program,
        thus preventing the other codes to put it on a deadlock. You can use the millis() function available in the arduino.

        This is a sample code for sending data.
        Code:
        #include<genieArduino.h>
        #include<SoftwareSerial.h>
        
        Genie genie;
        SoftwareSerial SoftSer(2,3);
        
        static long int current;
        static long int previous=0;
        const int interval = 10;
        int i;
        int contrast = 0;
        #define RESETLINE 4
        
        void setup(){
        
          Serial.begin(9600);
          SoftSer.begin(9600);
          genie.Begin(Serial);
          genie.Begin(SoftSer);
        
          genie.AttachEventHandler(myGenieEventHandler);
         
          pinMode(RESETLINE,OUTPUT);
          digitalWrite(RESETLINE,1);
          delay(100);
          pinMode(RESETLINE,0);
          delay(3500);
          pinMode(A0,INPUT);
        }
        
        void loop(){
          if(current - previous >= interval){
            previous=current;
            i = map(analogRead(A3), 0, 1023, 0, 180);  
            genie.WriteObject(GENIE_OBJ_SCOPE, 0x00, i );
            Serial.println(i); //debugging
          }
          genie.DoEvents();
        }
        
        void myGenieEventHandler(){
          genieFrame Event;
          genie.DequeueEvent(&Event);
        }
        Best Regards,
        Kevin

        Comment

        Working...
        X