Announcement

Collapse
No announcement yet.

Call Picture depending on Pininputs

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

  • Call Picture depending on Pininputs

    Hey guys,

    so I'm new here and to 4D systems screens.

    I need some advice / help (however you want to call it) with a project of mine.
    My biggest problem is, that this has to be done until February the 9th and my screens (gen4-uLCD-35D-CLB) still have not arrived yet.

    So i have 5x 5V inputs, each representing a piece of a BCD.
    I planned to use P4-P8 as 1, 2, 4, 8 and 16.
    Depending on which pins are high, the display should call up a picture.

    I have not been able to find a way to do that yet though.
    Can anyone help me out or send me in the right direction please?

    I've attached an example of the pictures (the pics have the same name)

    I'd be willing to donate towards coffee or a beer if needed!

    In hopes of a positive feedback,
    Hans
    Attached Files
    Last edited by hans_meier; 31st January 2017, 12:16 AM. Reason: Forgot to tell the model.

  • #2
    Something similar has been done in the past but that example only used a pin to identify an image, not 5 pins as a binary number http://forum.4dsystems.com.au/forum/...-display-image

    What you want is very easy to do in ViSi, less than 20 lines beyond the template!

    Have a look at the attached
    Attached Files
    Mark

    Comment


    • #3
      Thanks so much!
      It's not possible for me to try it out yet (hopefully my display will arrive next week), but I'll give feedback asap.

      Comment


      • #4
        Hi,

        so I've been finally able to give it a try, but got hit by the problem that the display shows "Mounting..." the whole time.
        I've attached the contents of my card in the .zip as I have them on the card and the data of the card itself.
        Attached Files
        Last edited by hans_meier; 13th February 2017, 06:59 PM.

        Comment


        • #5
          Dear hans,

          Attached is the modified Zip file of the project. The problem is that the filename in the code is

          not the same as the filename in your uSD Card.

          The code should read hndl := file_LoadImageControl("PINSTOIM.dat", "PINSTOIM.gci", 1);

          This usually happens you you compiled your code using an older verson of 4D Workshop and then

          Compile it to a new version.

          Please use RMPET to format your uSD card.

          Best regards,
          Attached Files

          Comment


          • #6
            Dear hans,

            Our Senior Software Engineer pointed out that the difference in the filenames is caused by
            the setting of the short file names in Windows. When it is disabled, the file names are 8 characters long followed
            by the three character extension. When enabled it displays 6 characters with a ~1 and then the
            three character extension.

            You can determine if it is enabled by typing in CMD in administrator mode (type CMD, on search program and files
            right click, run as administrator) then type:
            fsutil 8dot3name query drive: where drive is the location of your 4D workshop code.

            This link will help you change the setting:
            --> https://technet.microsoft.com/en-us/...(v=ws.11).aspx

            Best regards,

            Comment


            • #7
              ok, thanks for that

              Next problem accured though ...
              It's showing the picture 31.png all the time.
              I'm using the gen4 PA.

              This happens when connected to the PC via USB and also when just powered with a normal 230V to 5V.

              I'm using exactly the programm Noel supplied (just switched back to #platform "Gen4-uLCD-35D-CLB").

              I have connected the pins as following:
              1 = GPIO 10
              2 = GPIO 9
              4 = GPIO 8
              8 = GPIO 7
              16 = GPIO 6

              Do I have to conect all the other pins to 0V?

              Some more tests:

              I have 1, 4 and 16 on HIGH now, but the command "print([HEX4] pins, "\r") ;" prints me 001F with and without any HIGH signals.

              So I think I got it :D

              Changed following lines of code:

              pin_Set(PIN_INP_LO,PA4) ;
              pin_Set(PIN_INP_LO,PA5) ;
              pin_Set(PIN_INP_LO,PA6) ;
              pin_Set(PIN_INP_LO,PA7) ;
              pin_Set(PIN_INP_LO,PA8) ;
              and finally
              pins := bus_Read8() - 0xE0; // read bus and mask off unwanted bits
              Last edited by hans_meier; 21st February 2017, 06:47 AM. Reason: Did it!

              Comment


              • #8
                Dear hans,
                You cannot use bus_read8() since it gives the value of the 8 bit BUS pins 0 to 7 which are are PA4 to PA11. Unless you also set PA9 to PA11 as inputs also and ground them or use pin_Set(PIN_INP_LO,PA9) etc.
                Another thing you can do is you can use bus_read8() and AND it with 0x1F to mask unwanted bits.

                Best regards,
                Last edited by Noel; 21st February 2017, 06:40 PM.

                Comment


                • #9
                  Well the AND 0x1F killed everything when I bad that. Apparently it works now, so I am happy
                  my current problem is the o e display only glowing white tho ... but I think a colleague stepped on it q.q

                  Comment

                  Working...
                  X