2 Replies Latest reply on Apr 9, 2014 9:07 AM by lukwolf

    String in HDMI ZedBoard

    lukwolf

      Hi, I tried the example Zedboard "ZedBoard_HDMI_Display_Tutorial" and it works, showing the color bars on my TV. Is there any way to modify the code to write characters? For example: Display the string "Hello world" etc. ..

        • RE:  String in HDMI ZedBoard
          zedhed

          Hi lukwolf,

          I don't think that is a simple task but it is definelty possible.

          If you are developing using the Standalone application for this reference design as a starting point, there is no exising character drawing API that I am aware of.  However, I can think of two ways that you could implement this support on your own.  You could use a sprite map similar to what was done in the old PC gaming days and simply write image information to the display containing pixel data to form a letter.  You can get pretty fancy with this method by using graphic design software to create the sprite map.  Alternatively, you could write a library of routines to draw characters on the display by plotting pixels and then write some higher level functions to call the letter plot functions.

          Take a look at this function from zed_hdmi_display.c where the colorbars are painted inside of the frambuffer space:

          int zed_hdmi_display_cbars( zed_hdmi_display_t *pDemo, Xuint32 offset )
          {
             Xuint32 frame, row, col;
             Xuint32 cbar, pixel;
             volatile Xuint32 *pStorageMem = (Xuint32 *)pDemo->uBaseAddr_MEM_HdmiDisplay;
             for ( frame = 0; frame < pDemo->uNumFrames_HdmiDisplay; frame++ )
             {
                for ( row = 0; row < pDemo->hdmio_height; row++ )
                {
                   for ( col = 0; col < pDemo->hdmio_width; col++ )
                   {
                      cbar = (col * 8) / pDemo->hdmio_width; // color bar = 0..7
                      cbar = (cbar + offset) % 8;
                      switch ( cbar )
                      {
                      case 0: pixel = 0x00000000; break; // Black
                      case 1: pixel = 0x00FF0000; break; // Red
                      case 2: pixel = 0x0000FF00; break; // Green
                      case 3: pixel = 0x000000FF; break; // Blue
                      case 4: pixel = 0x0000FFFF; break; // Cyan
                      case 5: pixel = 0x00FF00FF; break; // Purple
                      case 6: pixel = 0x00FFFF00; break; // Yellow
                      case 7: pixel = 0x00FFFFFF; break; // White
                      }
                      *pStorageMem++ = pixel;
                   }
                }
             }

             // Wait for DMA to synchronize.
             Xil_DCacheFlush();

             return 0;
          }

          You could do something similar but instead paint pixels to form letters.  One thing I have done in the past is take a graphics image from Protoshop and convert to 24-bit RGB format then write that data into the framebuffer space.  The image should then display on the HDMI display.

          Regards,

          -Kevin

          • Reply
            lukwolf

            Thank you very much for your reply Kevin. I had thought to do something like that but excessively complicate the application I want to develop. I will try to use Petalinux or some variant of Linux to give me support with HDMI and other peripherals.

            Regards,

            -- LuK