Announcement

Collapse
No announcement yet.

uVGAII serial command issue.

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

  • uVGAII serial command issue.

    I am using the new uVGA2 to try and display a bitmap using serial commands from a basic stamp. I have been able to draw circles and lines with no issues. My problem comes with displaying a bitmap from the uSD card.

    SEROUT 0, 84, [$40, $6D, EPS.jpg, $00, $00, $00, $00, $00, $01, $00]

    This is the serial command sent by the basic stamp. it seems like everything is ok except maybe the sector address. The image was loaded to the uSD card with graphics composer. It says that the sector address is

    File "EPS.jpg"
    Sector Address 0x001000

    This sector address is only 3 bytes and the uVGA2 requires 4 bytes for the sector address so I added another zero byte to the front of it. Is this correct? I only get a blank screen with this.

    Thanks

  • #2


    You are using the FAT bitmap display command.

    The filename makes it look like you have put your original graphic on the card, 'Sector Address 0x001000' makes it look like you have used the serial command platform output option.

    Try it this way
    Save the graphic using the '4DGL Platform', 'GCI file' optionFormat your uSD card as FAT16Copy the .GCI file created in 1 onto the cardView the .GC file created in 1 and find the sector offset into the GCI file containing your image (if there is only 1 image it will be 0)Construct your command like this SEROUT 0, 84, [$40, $6D, EPS.GCI, $00, $00, $00, $00, $00, $00, $00, $00, $00] i.e. ext_cmd, cmd, “file_name”, terminator, x(msb:lsb), y(msb:lsb), imagePos(msw:lsw)
    Mark

    Comment


    • #3


      Ok, that worked. The serial command below displayed the first picture. What I dont understand is why the extra bytes in the command. Where does the sector address go to display the second picture? This code below doesnt work.

      'Displays the first picture fine'

      SEROUT 0, 84, [$40, $6D, untitled.gci, $00, $00, $00, $00, $00, $00, $00, $00, $00]


      'Does not display the second picture'

      SEROUT 0, 84, [$40, $6D, untitled.gci, $00, $00, $00, $00, $00, $2E, $00, $00, $02]


      'From the dat file'

      "EPS.jpg" 0000 0000
      "afrcell.jpg" 2E00 0002

      Comment


      • #4


        The .DAT file is low word BYTE offset and is not needed for SGC, or some implementations in 4DGL

        The .GC file is high word first SECTOR offset, this is what you should use.

        I would thus expect this to be correct in your case:-

        SEROUT 0, 84, [$40, $6D, untitled.gci, $00, $00, $00, $00, $00, $00, $00, $01, $17]
        Mark

        Comment


        • #5


          Ok, now I see what you mean with the GC file. The output from that is below, so you are correct with the 0x0117. However the serial command shows a garbled picture. The first one shows fine. I even added a clear screen just in case. Ideas?


          // Image - "EPS.jpg" Size 320x240
          // Width = 320
          // Height = 240
          // Usage: eps_jpg(x, y);
          #constant eps_jpg $uSD_SetSector(0x0000, 0x0000); uSD_Image
          // Image - "EPS.jpg" Size 320x240
          // Width = 320
          // Height = 240
          // Usage: eps_jpg(x, y);
          #constant eps_jpg $uSD_SetSector(0x0000, 0x0117); uSD_Image


          SEROUT 0, 84, [$40, $6D, untitled.gci, $00, $00, $00, $00, $00, $00, $00, $00, $00]
          PAUSE 3000
          SEROUT 0, 84, [$45]
          PAUSE 3000
          SEROUT 0, 84, [$40, $6D, untitled.gci, $00, $00, $00, $00, $00, $00, $00, $01, $17]

          Comment


          • #6


            Well you can get garbled pictues when you send one command before receiving the ACK to the previous one, so it's important to get that bit of code there. Although 3 seconds would seem to be heaps, for now.

            The other 'easy' way to get a garbled picture is to specify a size in GC larger than the display size (in either direction) (or try to position it such that display height or width is exceeded).

            If you still can't fix it email me [email protected] everything associated with the GC project and I'll have a look
            Mark

            Comment


            • #7


              I am so sorry, the manual is wrong, the imagePos parameter is the BYTE offset, so using the DAT file and reversing the order is what you need to do.

              SEROUT 0, 84, [$40, $6D, untitled.gci, $00, $00, $00, $00, $00, $00, $00, $7C, $00]

              Displays the second image.
              Mark

              Comment

              Working...
              X