Announcement

Collapse
No announcement yet.

XY scope with GOLDELOX uOLED-128G2

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

  • XY scope with GOLDELOX uOLED-128G2

    I am looking to make an XY scope with a uOLED-128G2. I need to stick with this model due to the size. This is my first project...

    The scope will be used to look at AUDIO level signals. Basically 20KhZ max.

    I want to duplicate an XY audio scope wave form as shown in this example video:




















    I have run into a few problems...

    1. I need two analog inputs. I solved this by using a CD4066BE analog switch set up as a multiplexer with an inverter connected between two of the switches gates. The inverter is run by IO2.

    2. The signals that need to be plotted require reading bipolar signals. I was able to solve this with an OP amp set up to run as a bipolar to unipolar converter.

    3. So now I get a scope display but it just looks like lines jumping all over the place that are not connected.



    func main()
    // Read Value Test
    var X_Value, Y_Value,X_Value1, Y_Value1, count;
    pin_Set(OUTPUT, IO2); // set IO2 to be used as an output
    pin_Set(ANALOGUE_8, IO1); // set analog I/O pin to 8 bit mode
    gfx_Set(OUTLINE_COLOUR, BLUE);
    gfx_Contrast(16);
    gfx_Cls();

    repeat
    count := 4;
    while (count--)

    txt_Set(TEXT_WIDTH, 1);
    txt_Set(TEXT_HEIGHT, 1);
    txt_Set(TEXT_COLOUR, GREEN); //txt_Set(TEXT_COLOUR, RED);


    pin_HI(IO2); // output a Logic 1 on IO2 pin
    X_Value := (pin_Read(IO1)/3); // read Y value
    gfx_MoveTo(0,120); // Set Print Position
    print( [DEC4Z] pin_Read(IO1)); // print the raw X value

    pin_LO(IO2); // output a Logic 0 on IO2 pin
    Y_Value := (pin_Read(IO1)/3); // Read X value
    gfx_MoveTo(0,0); // Set Print Position
    print( [DEC4Z] pin_Read(IO1)); // print the raw Y value

    pin_HI(IO2);
    X_Value1 := (pin_Read(IO1)/3);
    pin_LO(IO2);
    Y_Value1 := (pin_Read(IO1)/3);
    gfx_Line(X_Value,Y_Value,X_Value1,Y_Value1, BLUE);

    wend
    gfx_OutlineColour(BLUE);
    gfx_CircleFilled(63,63,63, 0x0000);
    forever


    endfunc

    Is there a way to interconnect the lines and make a continus feed FIFO buffer? It would be great if the lines could bend based on the amplitude of the signal change. Maybe I am asking for too much out of this little processor? I know it's never going to look perfect like the original but anything close would be good.










    Last edited by txturbo; 28th November 2016, 08:39 AM.

  • #2
    Dear txturbo,

    Thank you for using our products. The reason why the lines are discontinuous is that you print the Value of the X and Y along with the gfx_MoveTo command. If it is possible, please try removing the printing of the X and Y values so the gfx_Line command will produce continuous lines.

    Comment


    • #3
      Originally posted by Noel View Post
      Dear txturbo,

      Thank you for using our products. The reason why the lines are discontinuous is that you print the Value of the X and Y along with the gfx_MoveTo command. If it is possible, please try removing the printing of the X and Y values so the gfx_Line command will produce continuous lines.
      Hi Noel,

      Thanks, that helped a bunch! It looks much closer to what I was expecting to see.

      I think it would look a lot cleaner if I could figure out how to make a buffer and basically undraw the lines. Right now I have a circle drawn and every X number of loops through I clear the circle by writing all of the pixels black. This creates flicker and many of the lines displayed are not connected. I tried to replace the circle with a clear screen and it basically looks the same. It still looks way better than it did before.

      I tried to follow the code in the GOLDELOX Big Demo for drawing the random wave form and un drawing the line to reduce the flicker. I am not quite sure how to adapt it to what I want since it seems that the code is designed to write a wave form left to right. I tried to adapt the code but when I run it I just get random lines drawn.


      platform "GOLDELOX"

      #inherit "4DGL_16bitColours.fnc"


      func main()



      //polyline array for scope
      #constant SAMPLES 20
      var ScopeBufX[20];
      var ScopeBufY[20];
      var freq[4];
      var samples, smpl, n;

      repeat

      while (n<samples)
      // undraw the old sample as we create new one (looks better, less flicker)
      gfx_Line(ScopeBufX[n],ScopeBufY[n],ScopeBufX[n+1],ScopeBufY[n+1],BLACK);
      pin_HI(IO2);
      ScopeBufY[n]:= (pin_Read(IO1)-128);
      pin_LO(IO2);
      ScopeBufX[n]:= (pin_Read(IO1)-128);
      n++;
      wend
      gfx_Polyline(samples, ScopeBufX, ScopeBufY, GREEN); // draw the new sample

      forever


      endfunc










      Comment


      • #4
        Dear txturbo,

        Thank you for using our products. I checked the Goldelox Big Demo source and what you placed
        in the repeat forever loop is a function call. The value of n is not re-initialized once it exits the
        loop. Also, the value of the variable n and samples are not initialized.

        Best regards,

        Comment


        • #5
          Originally posted by Noel View Post
          Dear txturbo,

          Thank you for using our products. I checked the Goldelox Big Demo source and what you placed
          in the repeat forever loop is a function call. The value of n is not re-initialized once it exits the
          loop. Also, the value of the variable n and samples are not initialized.

          Best regards,

          Hi Noel,

          I got the code working, thanks.

          Can you tell me what the sampling rate is of the A to D conversion on the GOLDELOX processor?

          Thanks







          Comment

          Working...
          X