No announcement yet.

Visi code generation

  • Filter
  • Time
  • Show
Clear All
new posts

  • Visi code generation

    If I use Visi (Picaso) and design a screen by placing a few objects on it, compile and save to SD card and then click on "Paste code" for each of the objects that I created on the screen can I then use that code that creates the objects and call them in an external program?

    To understand what I'm thinking here:

    I have a display (uLCD43-PCT) configured as serial slave using SPE.
    I design a page or screen with some objects / widgets using Visi.
    I compile and save it to SD card.
    I "Paste all Code" to see the code calls on the code screen.
    Can I use the code that is generated for each object / widget- for instance "img_show(hndl, iWinbutton1) and call it from my code and send that command via serial and it will find it on the SD card?

    If so then this would save me a bunch of time manually making boxes, buttons, text, etc.

    What am I missing here in this logic?

  • #2

    What am I missing here in this logic?
    Nothing much.

    That will work fine.

    After you generate the otherwise unworkable ViSi code, you will need to 'copy' the file to your external program.


    • #3

      So if I were to design a panel with Visi Genie does it create the same type of files that I can look at and disect? What are they named and where would I find them?


      • #4

        The image type files it creates are the same as those created by ViSi and Graphics composer. The can be viewed, in sorts, by

        The 'text' files are 'simply' any text turned into fixed length records, so the individual strings can be located as quickly as possible.


        • #5

          What I am wondering is where to find the individual commands that are created in Visi Genie to find the files on the SD card etc.


          • #6

            You mean what you get when you click 'paste code'?

            You need to click on them to generate the code as the the code generated is dependant on the contents and settings withing the objects


            • #7

              To give you an idea of why I'm asking- by using just Visi and creating texts , buttons, etc I can click on the "paste code" and it will paste it into the code window. The problem is I don't know where to paste it into that code to make a working program that I can try and follow.

              So I thought if I were to use Visi Genie and create the same buttons, text, etc. that Visi Genie would generate working code and I could then look at it to follow. But I don't know what files it creates that I can look at to see other than the ones on the SD card. And yes I know I can see the graphics by using the GCI2BMP program.

              I'm trying to create the look and feel using the Visi tools and store the graphics on the SD card but I want to use SPE from my processor to access them but I need to know the specific command sequence used to display those graphics.


              • #8

                No sure why it doesn't 'just work'.

                open up the Picaso Visi Sample 'ANGULAR'
                Compile and run it as it is to see what it does.
                Copy and paste the code between func and endfuc into your 'system'
                Copy the constants in "" into your 'system'
                'Masage' everything into what your system understands
                (I'm assuming here that there is a library available for your 'system' of you have converted one of the available ones)
                ANGULAR should now work using SPE on your 'system'.


                • #9

                  Ok that helps.

                  So in this line: img_Show(hndl, iAngularmeter1);

                  the only way to know the "index" (iAngularmeter1) word value is to look at the file in particular this: iAngularmeter1 // offset 0x0 ?

                  So I added some static text. Compiled and see that it does work on the display.

                  Here's the code it "pasted":

                  // Statictext1 1.0 generated 3/5/2013 7:00:16 AM
                  img_Show(hndl,iStatictext1) ;

                  Now when I look at file I see this addition: iStatictext1 // offset 0x595A800

                  How do I go about getting an index "word" out of this- 0x595A800 ?

                  Another question- Where is "IMAGE_INDEX" from this line img_SetWord(hndl, iAngularmeter1, IMAGE_INDEX, numx); derived from? How do I find its value?


                  • #10
                    iStatictext1 // offset 0x595A800
                    // indicates the start of a comment, the 0x595A800 is actually the offset of statictext1 from the start of the GCI, but you don't need to know about that here.

                    The #CONST statement you are looking at is using enumerated constants, eg.
                    would set A=0, B=1, C=2

                    Hope that makes sense.

                    IMAGE_INDEX is defined in the PICASO_CONST4D.H file in

                    C:\Users\Public\Documents\4D Labs\Picaso Serial\C\Include
                    C:\Users\Public\Documents\4D Labs\Picaso Serial\Pascal\Include
                    C:\Users\Public\Documents\4D Labs\Picaso Serial\PicAxe\Include
                    Refer to which ever one you find easier to follow


                    • #11

                      Ok. Thanks for that. I was able to display the angular meter and the static text that I added. So just to make sure I understand, if I look at the *.dat file on the sd card, the order in which the images are listed counts from 0 to x starting at the beginning for the image index correct?

                      My next feat was to try and figure out this part of the code:

                      img_SetWord(hndl, iAngularmeter1, IMAGE_INDEX, numx); // where numx is 0 to 1000

                      I know how to get hndl and use it.
                      I now know what iAngularmeter1 (the index) is and where to get it and use it.

                      The next variable IMAGE_INDEX was my stumper. I looked at the C library file you mentioned and found this:

                      #define ALL 0xFFFF // argument for img_xxx functions to update all images

                      // image control entry offsets
                      #define IMAGE_LOWORD 0 // WORD image address LO
                      #define IMAGE_HIWORD 1 // WORD image address HI
                      #define IMAGE_XPOS 2 // WORD image location X
                      #define IMAGE_YPOS 3 // WORD image location Y
                      #define IMAGE_WIDTH 4 // WORD image width
                      #define IMAGE_HEIGHT 5 // WORD image height
                      #define IMAGE_FLAGS 6 // WORD image flags
                      #define IMAGE_DELAY 7 // WORD inter frame delay
                      #define IMAGE_FRAMES 8 // WORD number of frames
                      #define IMAGE_INDEX 9 // WORD current frame
                      #define IMAGE_CLUSTER 10 // WORD image start cluster pos (for FAT16 only)
                      #define IMAGE_SECTOR 11 // WORD image start sector in cluster pos (for FAT16 only)
                      #define IMAGE_TAG 12 // WORD user variable #1
                      #define IMAGE_TAG2 13 // WORD user variable #2

                      so I entered the value of $0009 for IMAGE_INDEX. Next I entered the hex value for 500 ($01F4) for numx hoping to see the meter go to half scale. And it worked!

                      What is confusing to me is the defines for img_SetWord (the listing above) and what I read in the Picaso Serial manual on page 147:


                      cmibri">d(word), handle(word), index (word), offset (word), value(word)



                      haPAN style="LETTER-SPACING: 0.05pt">ndle



                      Index oftheimagesinthelist.

                      : 0.2pt 0in 0pt; mso-pagination: none; mso-layout-grid-align: none; mso-line-height-rule: exactly" class=MsoNormal>


                      Offset ofthe requiredword intheimage entry.


                      : none" class=MsoNormal>2IMAGE_XPOS






                      id; PADDING-TOP: 0in; mso-height-rule: exactly; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-border-top-alt: solid black .5pt" vAlign=top width=389>
                      Theword tobewrittentotheentry.


                      img_Se; TOP: -0.5pt; mso-bidi-font-family: Calibri; mso-text-raise: .5pt">tWord
                      It doesn't go beyond 7. Am I looking at the right thing?


                      • #12

                        Hmm, that section had bits removed if they were read only, but it seems to have ended up wrong, will get it fixed.


                        • #13

                          So is my other logic correct?


                          • #14

                            Yeah, sorry, didn't notice anything that needed commenting on


                            • #15

                              So I was able to make one static menu screen on Form 1. How do I add another Form to make another screen?

                              Or do I just have to make a new "project" that generates another set of *.dat and *.gci files and then reference them in my program?