Announcement

Collapse
No announcement yet.

Best application architecture with 4D displays

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

  • Best application architecture with 4D displays

    I've been using the 4D displays with an Arduino for a while now starting with the 4Duino, then a 3.5" CT Diablo connected to a Mega and now a 5" CT Diablo connected to a 32 bit Due. I now have two stepper motors, two small DC motors, one servo motor, one serial input, a couple of digital I/O's and a serial I/O to the Diablo. I have been using the standard Workshop Arduino projects with fairly good results but there are a couple of issues:
    1. The polling architecture of the diablo interface requires dropping in event checks for button pushes all over the code if you want to be able to change things on the fly.
    2. If I use a stepper/motor/servo driver that uses PWM I/O pins for control, the display or motor will hang up at some point. If I use I2C drivers for the motors it never seems to hang. The I2C drivers are not very common (Adafruit has the only ones I know of) and are much more expensive.
    So is there a better way to do this by moving the display processing code to the Diablo itself with an event driven handler on the Arduino side using Visi, Visi Genie or something else like I2C ? If so is there a way to convert the Arduino C code to 4DGL easily? Would this eliminate interference with the PWM I/O?

    Click image for larger version

Name:	loader screen.jpg
Views:	1
Size:	1.45 MB
ID:	64029

  • #2
    Hello,

    You can move display processing to the display and program the display in Visi, converting from the Arduino to 4DGL is quite straight forward as 4DGL is like a mixture of C, Basic and Pascal and the graphics code can be generated easily by clicking the paste code button. The Arduino can then be responsible for handling your stepper/motor/servo and the display left to process graphics. You will have to create a serial routine to pass data back and forth to the Arduino but you can make this as simple as you need. You can even use I2C or SPI as a master on the display as long as the Arduino will accept this as a slave device

    The Diablo internal functions manual will help https://www.4dsystems.com.au/product...ions_R_2_0.pdf

    I hope this helps

    Best regards

    Paul

    Comment


    • #3
      Thanks for the info. I looked at the documentation and played around in the editor and the code is pretty similar although I'm not sure why you didn't pick one syntax (C, Basic or Pascal ). A simple serial interface would be the easiest as long as it did not have the same issue of periodically hanging up the display or PWM (# 2 above).

      Comment


      • #4
        Hi,

        It's not normal behaviour for the display to hang using when using a microntroller with PWM so there will be something causing this problem. Firstly it needs to be established which is failing. The display is not known to hang so it could likely be a problem on the Arduino. If you would like to send us your Arduino code we could examine it to see where the problem may be.

        Best regards

        Paul

        Comment


        • #5
          It doesn't happen often but when it does the Arduino continues working but the screen stops sending touch inputs or the Arduino misses them if it does. The code is over 1K lines so is probably too much to review. I will experiment with splitting the UI code out and loading on the display and see how that goes.

          Comment


          • #6
            I put together a prototype splitting the UI (Diablo) and application (Arduino) with a serial interface sending messages back and forth. It works well and the UI is much more responsive to touch inputs and the serial interface can easily handle the data back and forth (using buffered I/O). The only issues are I have a lot of code to convert (moving back and forth between 'C' and 4DGL syntax is a pain) and lack of a byte/char data type. It's been 20+years since I had to pack chars into words and vice versa. I can live without floats but no bytes?

            Comment

            Working...
            X