I tried sampling adc and storing then displaying but at 3KHz it was 6 samples per wave cycle. I put an increaseing delay before each sample after a sync trigger idea to capture different parts of the wave form and it displays 50KHz as is. ie a sine wave looks like one. https://youtu.be/Y3QTnrOUeHQ
ps .97 bog standard version so should be ok
;displayrepeatativewaveformsonILI9341displaywithvectors...Higherthanadcsamplerate;)#chip mega328p,16#option explicit#include<glcd.h>;Displaysetup#define GLCD_TYPE GLCD_TYPE_ILI9341#define GLCD_DC portb.2 ; DIGITAL_10 'HW Data command line DC#define GLCD_CS portd.7 ; DIGITAL_7 ' Chip select line CS#define GLCD_RESET portd.4 ; DIGITAL_4 ' Reset line Tie high..not needed#define GLCD_DO portb.3 ; DIGITAL 11 'HW Data out | MOSI SDI#define GLCD_SCK portb.5 ; DIGITAL_13 'HW Clock Line SCK;#define ILI9341_HardwareSPI ' remove/comment out if you want to use software SPI.'GLCDselectedextensionfontset.ASCIIcharacters31-254,theextendedfontuses1358bytesofprogrammemory#define GLCD_EXTENDEDFONTSET1GLCDfntDefaultsize=1#define AD_Delay 2 10us ;dunno why;;#defineanalogue_inportc.0;unoA0;diranalogue_inindirportc.0indimvolt,ptr1,ptr2asbyte;bufferstoholdoldandnewsamplesforfastdrawingwaveformdimbuffer1(238),buffer2(238)asbyte;screenXis238pixelsinboarder;start/end--new/oldlinesbetweennew/oldsamplesvariablesdimxpos_newasbytedimypos_newasbytedimxpos_oldasbytedimypos_oldasbytedimxpos1_newasbytedimypos1_newasbytedimxpos1_oldasbytedimypos1_oldasbyte;dimxdivasbyte;xpixelsbetweenplotsdimxsamplesasbytedimtmpasbytexdiv=1;1pixelXtonextsampleasdefaultxsamples=238;238pixelsinbox;GLCDRotate(portrait_Rev);portraitgivesa0-255displayheightGLCDfntDefaultsize=3;ifIwanttextoutputGLCDCLSILI9341_BLUEfilledbox0,0,239,257,ILI9341_BLACKbox0,0,239,257,ILI9341_YELLOW;forptr1=1toxsamples;readsamples;get1stsamplessotheycanbeerased?yeahgotto;waituntilanalogue_inoff;waituntilanalogue_inonwaituntilportc.0offwaituntilportc.0on;trigerlevelto"sync":)fortmp=1toptr1nexttmp;delaytocatchdifferentpointinwave;volt=READAD(analogue_in)volt=READAD(an0)buffer1(ptr1)=255-volt;fittoscreen0,0buffer2(ptr1)=buffer1(ptr1)nextptr1;do;startofmainloopptr1=1ptr2=1dountilptr1=xsamples-2;eraseoldscreendataandredrawnewypos_old=buffer2(ptr1);olddataypos_new=buffer2(ptr1+1)xpos_new=ptr2+xdiv;ypos1_old=buffer1(ptr1);newdataypos1_new=buffer1(ptr1+1)xpos1_new=ptr2+xdiv;thisupdatesdisplaysampletosampleeraseinglastsample...lookssteadier,lessflickerlineptr2,ypos_old+1,xpos_new,ypos_new+1,ILI9341_BLACK;eraselastdatalineptr2,ypos1_old+1,xpos1_new,ypos1_new+1,ILI9341_WHITE;drawnewdata;ptr1=ptr1+1;datapointerptr2=ptr2+xdiv;xpositionforstartandendlinexpositionsloop;plotingdonenowredrawcursorthatgoterasedbydrawingtraceline1,127,239,127,ILI9341_GREEN;Xaxisline119,1,119,254,ILI9341_GREEN;Yaxis;---getnewsamplesforptr1=1toxsamples;waituntilanalogue_inoff;waituntilanalogue_inonwaituntilportc.0offwaituntilportc.0on;triggernextsamplesameaslastie"sync"fortmp=1toptr1nexttmp;delaytocatchdifferentpointinwavevolt=READAD(an0)buffer2(ptr1)=buffer1(ptr1);newdatatoolddatabuffer1(ptr1)=255-volt;set0,0topleftscreenandupdatenewdatanextptr1;loop;endofmain
Last edit: stan cartwright 2017-07-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If readad starts on a leading edge, where is the leading edge on a not a square wave,eg sine wave?
When readad is used does it turn off the digital part of the pin or do I do through registers?
Sorry 2 questions. I can't keep up with readad improvements and so waiting for next release and data sheets in the mean time.
Having googled "diy oscillocope", I haven't found this display idea used. It's not really real..or is it, on a repeated, unchanging waveform?
With a quad op amp front end for dc off set for ac and volt range maybe little handythingamy. Could measure voltage and GCB is fast enough to do capacitance ESR. PWM sine wave through low pass r/c. Less extra hard ware the better.
Ideas for ranges on a post card please to here ie could it be a useful project or academic demo?
I can't think off a reason to build anything cos it's so cheap on ebay.
Again, google diy oscilloscope. Lets do a GCB Swiss navy knife thingamyjig.
...and my robot is behaving tidy to :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried sampling adc and storing then displaying but at 3KHz it was 6 samples per wave cycle. I put an increaseing delay before each sample after a sync trigger idea to capture different parts of the wave form and it displays 50KHz as is. ie a sine wave looks like one. https://youtu.be/Y3QTnrOUeHQ
ps .97 bog standard version so should be ok
Last edit: stan cartwright 2017-07-22
I put a frquency counter on it. I could use it to change display x range maybe. https://youtu.be/hhTC8z1GIaI
If readad starts on a leading edge, where is the leading edge on a not a square wave,eg sine wave?
When readad is used does it turn off the digital part of the pin or do I do through registers?
Sorry 2 questions. I can't keep up with readad improvements and so waiting for next release and data sheets in the mean time.
Having googled "diy oscillocope", I haven't found this display idea used. It's not really real..or is it, on a repeated, unchanging waveform?
With a quad op amp front end for dc off set for ac and volt range maybe little handythingamy. Could measure voltage and GCB is fast enough to do capacitance ESR. PWM sine wave through low pass r/c. Less extra hard ware the better.
Ideas for ranges on a post card please to here ie could it be a useful project or academic demo?
I can't think off a reason to build anything cos it's so cheap on ebay.
Again, google diy oscilloscope. Lets do a GCB Swiss navy knife thingamyjig.
...and my robot is behaving tidy to :)