Announcement

Collapse
No announcement yet.

microOLED-128-G1 ACK and NAK

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

  • microOLED-128-G1 ACK and NAK

    All,



    I am currently using the microOLED-128-G1 with a Microchip PIC24F32KA301 microcontroller. I have written many functions in C in order to output formatted strings, circles, triangles, erase screen, autobaud, etc.



    When I first ran my program, I had many display glitches (i.e. garbage showing up on the screen). I figured out that I needed to place short delays on the order of 50ms after each command in order to resolve the garbage problem. Now my program works, but the refresh rates are very slow due to all of the delays adding up.



    A typical function in my C code looks like:



    void drawCircle(int x,int y,int radius,int colorMsb,int colorLsb)
    {
    putch('C');
    putch(x);
    putch(y);
    putch(radius);
    putch(colorMsb);
    putch(colorLsb);
    delay_ms(50);
    }



    Notice the 50ms delay in the last line of the function.



    So when I have about 20 items to update, it takes about 1 sec for all of the data to disappear and then reappear on the screen.



    One of the things I have in my code is a compass needle that I want to appear on the microOLED. But with each cycle of my main loop, I erase the screen and then output the updated information. This makes for a very jumpy needle.



    I do not use the ACK and NAK responses from the microOLED in my code. I just send data to the microOLED and don't look for any replies. I am already using the other UART Rx pins on the PIC for GPS receivers, and so I do not poll for the ACK/NAK after transmitting data to the microOLED. If I did poll for the ACK/NAK, then I could probably eliminate the delays. Would this speed up the refresh rates?



    What do you think?



    TIA.
    TIA,

    Neal

  • #2


    If I did poll for the ACK/NAK, then I could probably eliminate the delays. Would this speed up the refresh rates?
    Sure would.

    Take, for example, your circle, if it had a radius of 64 pixels and was filled it would take a bit under 50ms.

    An empty circle, roughly half that.

    A smaller circle, less again.

    A 10 pixel filled circle comes in at less than 15ms (These times came out of FatController and it's timing is limited to the 15ms of the 'standard' timer).

    Of course whilst this may not completely solve your problem, there's a lot of 'perception' involved.

    Avoid erasing the display, try rewriting the background and then the needle, then make sure there is a pause before writing again.

    You could also make a series of images on uSD of the meter in its various positions as well as being able to make a fancier looking meter it will also look much smoother.
    Mark

    Comment


    • #3


      Dear Moderator,

      I thinned out my triangular compass needle. It is an isosceles triangle with a base of 8 and a height of 60. I have tried this in both wireframe and solid. I did not notice any huge improvements with wireframe vs. solid, but I will take your advice and go wireframe. Every bit helps.

      In regards to erasing the display (I am using a white background), I just transmit the strings to the display first in red, pause, then transmit the same strings in white. I do the same for the triangles , circles, and whatever else I am transmitting to the display. So you are saying that this is much faster than an ERASE display. Please confirm.

      My last question deals with the ACK/NAK issue. Is the function of ACK/NAK for the host controller to determine when the transmission has been received? In other words, if the host controller waits to receive an ACK on the Rx pin (of the host controller) and only then proceeds with the next instruction, will this speed up the runtime of the program? Will this manage the timing issues that I am having?

      Or should I just continue with the delays?

      TIA.

      --Neal
      TIA,

      Neal

      Comment


      • #4


        An erase doesn't take long, it's just the eye perceives the screen to go blank and then be rewritten making the screen updating more obvious, that's all.



        The ACK/NAK is not sent until the command is complete, as soon as you get the ACK you can start sending the next command, your screen will be updated much quicker than using delays.



        I presume you are already using the fastest baud rate you can
        Mark

        Comment


        • #5


          Dear Moderator,

          One more thing. You mentioned creating a bunch of images and saving them to the uSD card. Please see the attached JPEG's of a compass with not much in the way of graphics.

          So lets say that I save 72 images (i.e. every 5 degrees). Are you saying that when I rotate the actual magnetic compass module and open each subsequent image that the transition will appear smoother? Do images from the uSD card appear faster than triangles and circles created using the command set?

          What is the best format in which to save the images: png, jpeg, tif, etc.?

          How do I open each new subsequent image and refresh the display.

          Any help is greatly appreciated. Thank you.
          Attached files
          TIA,

          Neal

          Comment


          • #6


            You need to use Graphics Composer to convert jpegs, pngs, gifs, whatever, into the format required by the display and write them on the card.



            You could put a series of images on the card and use media_Image, but the handling would be a bit messy.



            It would be neater to create a movie / gif, etc. and use media_VideoFrame to display the required angle (i.e. make a movie with 72 images, image 0 is 0 degrees, image 1 is 5, etc.).



            AN1006 shows the basic for an image http://www.4dsystems.com.au/appnotes.php
            Mark

            Comment


            • #7


              Dear Moderator,

              I have written all of my other code in C. How do I integrate media_Videoframe into my C code?

              Do I need a programming cable? Probably yes.

              Can you provide any examples whatsoever of a short video and show how the video is integrated into a simple C program that controls the uOLED.

              Thank you.
              TIA,

              Neal

              Comment


              • #8


                Duh, getting lost, trying to do too many things at once.



                You will need to put it into Graphics Composer as separate images and then use "Display Image-Icon from Memory Card"
                Mark

                Comment


                • #9


                  Dear Moderator,



                  Is media_VideoFrame part of media_Image? If I can do the video route with 72 frames, this sounds like it would be easier...but what do I know.



                  Can you please provide a simple example that is managed in Graphics Composer?



                  Tell me whatever other software I have to download. I probably need to purchase a cable. What else do I need?



                  By the way, the baud rate of the UART on my PIC24F microcontroller is 4800. This is because I share the U2RX pin of the UART with a GPS module that operates at 4800 baud by default. I then use the U2TX pin to send text and triangles to the microOLED-128-G1. I then have another GPS module wirelessly connected to the U1RX pin of the UART.



                  I think that I am going to have to place both GPS modules on the same pin and switch between modules with a CD4066 analog switch and then I can TX and RX (i.e. receive the ACK/NAK) with the microOLED-128-G1. As you stated, this should speed things up a bit.
                  TIA,

                  Neal

                  Comment


                  • #10


                    The media stuff is part of GFX, you are using SGC, so forget about it.

                    You just need Graphics Composer http://www.4dsystems.com.au/prod.php?id=50 download the manual whilst you are there. It has some examples, try them first.

                    You shouldn't need a cable to do this, just a uSD card and a way of pluggin it into your computer.
                    Mark

                    Comment

                    Working...
                    X