Drawing Scope on Eve2-50G

FTDI/Bridgetek EVE2 & EVE3 & EVE4 SPI TFT Series by Matrix Orbital

Moderator: Mods

Post Reply
ChrisBack
LCD?
Posts: 5
Joined: Wed Jun 19, 2019 2:22 am

Drawing Scope on Eve2-50G

Post by ChrisBack »

Dear sir,
i woudl like to draw a scope on the screen and display an incoming value continuously. Normally the old point or line should still be displayed after swapping the display list but it disappears. When i store the old value into an array and display all the values in a for loop before i swap the display it slows down the display.
My hardware:
-Arduino Uno
-EVE2-Shield
-EVE2-50G-BLM-TPC

thank you for any help
cheers,
Chris

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: Drawing Scope on Eve2-50G

Post by Daniel Divino »

Hi Chris,

Are you looking to create somthing similar to an oscilloscope screen, or an ECG meter?

Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital

ChrisBack
LCD?
Posts: 5
Joined: Wed Jun 19, 2019 2:22 am

Re: Drawing Scope on Eve2-50G

Post by ChrisBack »

Hi Daniel,
I would like to build something like an oscilloscope screen but just the value which will be drawn on the screen as a line.
My problem is that the old line disappears and when is store the value into an array and draw it with a for loop the display drawing speed goes down
after a couple of lines.

Thank you.
Chris

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: Drawing Scope on Eve2-50G

Post by Daniel Divino »

Hi Chris,

Take a look at the Signals example that FTDI posted on their site. The Signals demo uses stored data to recreate sine, triangle, and ECG heartbeat waveforms on screen. You may be able to modify one of the waveform functions that they use for your own application. It isn't quite the same as taking in new data every second, but at the very least it should demonstrate how you can update the screen with new data without old data disappearing.

https://www.ftdichip.com/Support/Softwa ... #Example13

I have attached the Signals example, modified to work with our hardware (EVE2 and Scoodo shield) using the EVE2 library. This should help you get started. Note that you will need an SD card to run this project. Simply copy over the Cap_Cal.bin from the "Images for SD card folder" file to the root directory of your SD card, and you should be on your way.

The demo is currently configured to run on a Capacitive touch 5 inch EVE2.

Cheers,
Daniel
Attachments
Heart_Signals.zip
(27.56 KiB) Downloaded 466 times
Daniel Divino
Technical Support
Matrix Orbital

ChrisBack
LCD?
Posts: 5
Joined: Wed Jun 19, 2019 2:22 am

Re: Drawing Scope on Eve2-50G

Post by ChrisBack »

Hey Daniel,
Thank a lot this will let me out.
I tried this example before but i could not bring it into function. Now i will look for the differences in our codes.

Thank you again for the superb support.

Cheers,
Chris

Rudolph
LCD Guru
Posts: 67
Joined: Wed Feb 28, 2018 11:09 am

Re: Drawing Scope on Eve2-50G

Post by Rudolph »

Without even looking at the example, the easy way to do this is with a LINE_STRIP primitive.
Just loop thru an array and use the counter for X and the array value for Y in the VERTEX2F() commands.
The way VERTEX2F() works though with 15 bits for X and Y, it comes with a cost, this requires a little time to compute, nothing serious but definately something to keep in mind, expecially on 8 bit controllers, the X value needs to be shifted into position, the compiler can not just copy the value.

#define VERTEX2F(x,y) ((1UL<<30)|(((x)&32767UL)<<15)|(((y)&32767UL)<<0))

EVE_cmd_dl(VERTEX2F(xcounter+xoffset, myarray[ycounter]+yoffset));

One way to optimise this would be to not use the VERTEX2F() macro.

EVE_cmd_dl( (1UL<<30) | (((xcounter+yoffset)&0x3ff) << 16) | ((myarray[ycounter]+yoffset) & 0x7ff) );

The result is that the LSB of X is always 0 so the result is to plot on only every second pixel.
But in return the whole shift operation for X is optimised by the compiler with a simple copy operation.

One step further is to pre-compute an array of VERTEX2F() 32 bit values for all the X coordinates and add the Y value.

EVE_cmd_dl(vertex2f_x_array[xcounter] | ((myarray[ycounter]+yoffset) & 0x7ff) );

And of course not calculating the final values for Y on the spot but when adding the values to the array helps.

EVE_cmd_dl(vertex2f_x_array[xcounter] | myarray[ycounter] );

No, I did not just try all of this and measured what difference it actually makes.
I did encounter this to be an issue when I implemented an "animated" scope like display with 64 points a good while back
on an AVR.

Post Reply