No announcement yet.

4D-CD-00007 Genie - Form Request - Arduino

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • 4D-CD-00007 Genie - Form Request - Arduino

    This code presents a working example of how to use the "current form request" functionality in ViSi-Genie. The "current form request" functionality lets the host know which form is currently shown on the display module. This feature is actually a combination of READ_OBJ and REPORT_OBJ messages, such that the host sends a READ_OBJ message for form objects and the display module replies with a REPORT_OBJ message containing the number or index of the active form. This code example contains a ViSi-Genie project and an Arduino sketch. The application works in the following way:
    1. After bootup, the Arduino host sends a READ_OBJ message to the display module, inquiring for the number of the active form.
    2. If no reply is received within the predefined timeout period, the Arduino host sends an error message to the serial monitor.
    3. If a reply is received, the host then constantly writes to the LED digits objects on the display module.
    4. The host also constantly polls the display for the active form number. When a new form has been activated, its number is printed on the serial monitor.
    The following were the steps involved in creating this code example.
    1. Create a ViSi-Genie project with three forms.
    Form0 - has a label and a winbutton for navigating to Form1.
    Form1 - has a label, a LED digits object, and a winbutton for navigating to Form2.
    Form2 - has a label, a LED digits object, and a winbutton for navigating to Form0.

    The winbuttons are configured for form navigation thru the object inspector.
    2. Compile the project and upload the program to a uLCD-32PTU. Copy the supporting files to a uSD card mounted to the PC. Properly unmount the uSD card from the PC and mount it to the uLCD-32PTU.

    3. Compile and upload the attached sketch to an Arduino Uno. The sketch uses a software serial port for the display and the hardware port Serial0 for logging messages to the serial monitor.

    4. Properly connect the Arduino Uno to the uLCD-32PTU. See the application notes for this.

    Besides using READ_OBJ and REPORT_OBJ messages, another way for the host to know which form is active on the display is to use REPORT_EVENT messages. For more information on using REPORT_EVENT messages, see 4D-CD-00013 ViSi-Genie Arduino Form Navigation.
    Attached Files