Announcement

Collapse
No announcement yet.

How to detect visi genie display is thier or not.

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

  • How to detect visi genie display is thier or not.

    Hi all,
    I am trying to do some application using visi genie with dspic33ep512mu810. Now i want to detect display is their or not, for that any command is their. Please help me.

    Regards
    Manjunath N N

  • #2
    In Genie the best command is to query the form, It will either respond with the current form or timeout
    Mark

    Comment


    • #3
      Thanks for fast replay,

      can you share any sample code for respond with form or timeout. It will helps me lot.

      Regards
      Manjunath N N

      Comment


      • #4
        Hi Manjunath,

        I think the codebase example

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

        http://forum.4dsystems.com.au/forum/...equest-arduino

        best illustrates the idea. You can use the same logic when writing the code for your dspic33ep512mu810 host processor.

        Hope this helps and Regards.
        Doff

        Comment


        • #5
          Hi Doff thanks for reply,

          I go through the code, same way i implemented here is code.
          main()
          {
          // i am not added all part, i think this is only important.
          A_LED = 0;
          genieReadObject(GENIE_OBJ_FORM, 0x00);

          while(1)
          {

          // The main state machine for the display event handler
          genieDoEvents();

          }
          }

          void uLCDEventHandler()
          {
          //static int DS_val,slider_val=0;
          genieFrame Event;
          genieDequeueEvent(&Event);
          //abm
          //If the cmd received is from a Reported Object, which occurs if a Read Object (genie.ReadOject) is requested in the main code, reply processed here.
          if (Event.reportObject.cmd == GENIE_REPORT_OBJ){
          if (Event.reportObject.object == GENIE_OBJ_FORM){

          A_LED = 1; // led is not glowing
          }
          }

          But it not going to glow led.

          I am not touching the screen but also it should glow i think so. Please help me.

          Regards
          Manjunath N N
          Last edited by Manjunath N N; 3 June 2015, 08:04 PM.

          Comment


          • #6
            Hi Manjunath,

            I am trying to do some application using visi genie with dspic33ep512mu810.
            What IDE are you using and were you able to try the library used in the application note

            ViSi-Genie Interfacing a PICASO Display to a PIC micro Controller

            http://www.4dsystems.com.au/appnote/4D-AN-00021/

            Or did you write your own library?

            Also, were you able to confirm if the host controller was sending the correct READ_OBJ message?

            Regards.
            Doff

            Comment


            • #7
              Hi Doff thanks for reply,

              Sorry at late night it is working, but did not posted.

              Currently application is working like this:
              First time power on application able to detect the LCD present or not.
              after some time when i removed and re-connect it back at that time it is not detecting. Means on fly detect is not working.
              main()
              {
              A_LED = 0;
              genieReadObject(GENIE_OBJ_FORM, 0x00);

              while(1)
              {
              if(Lcd_Present == 0)
              genieReadObject(GENIE_OBJ_FORM, 0x00);
              // The main state machine for the display event handler
              genieDoEvents();
              // genieReadObject(GENIE_OBJ_FORM, 0x00);
              // The main state machine for the motor controller
              // tmclDoEvents();
              // The main state machine for the SD Card
              // SDCardDoEvents();
              }
              }

              void uLCDEventHandler()
              {
              //static int DS_val,slider_val=0;
              genieFrame Event;
              genieDequeueEvent(&Event);
              //abm
              //If the cmd received is from a Reported Object, which occurs if a Read Object (genie.ReadOject) is requested in the main code, reply processed here.
              if (Event.reportObject.cmd == GENIE_REPORT_OBJ){
              if (Event.reportObject.object == GENIE_OBJ_FORM){
              Lcd_Present = 1;
              A_LED = 1;
              }
              }
              // up to here
              }

              for this i need to initialize display again.

              help me how to detect on fly.

              Regards
              Manjunath N N

              Comment


              • #8
                Hi Manjunath,

                First time power on application able to detect the LCD present or not.
                after some time when i removed and re-connect it back at that time it is not detecting. Means on fly detect is not working.
                ok, you will have to consider the importance of the display reset-and-delay routine at the start of your host program. In the example sketches for the ViSi-Genie-Arduino library, the reset routine is:

                Code:
                  // Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor)
                  // THIS IS IMPORTANT AND CAN PREVENT OUT OF SYNC ISSUES, SLOW SPEED RESPONSE ETC
                  // If NOT using a 4D Arduino Adaptor, digitalWrites must be reversed as Display Reset is Active Low, and
                  // the 4D Arduino Adaptors invert this signal so must be Active High.  
                  pinMode(RESETLINE, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
                  digitalWrite(RESETLINE, 1);  // Reset the Display via D4
                  delay(100);
                  digitalWrite(RESETLINE, 0);  // unReset the Display via D4
                
                  delay (3500); //let the display start up after the reset (This is important)
                This routine ensures that the display is properly initialized before the host starts sending messages to it.

                So, if you disconnect and connect the display module from and back to the host and the display module is powered off in the process, a delay would be needed for the display to properly initialize.

                If in case that the display was not powered off in the process, then I would think that the host can reestablish the communication. Of course you will have to ensure that all library errors that may arise when the display is disconnected and connected from and to the host are handled, eg the display is in the process of sending a message or an acknowledgment byte and it is disconnected form the host, etc.

                Looking at the code you posted, I would do it this way:

                Code:
                main()
                {
                  A_LED = 0;
                  Lcd_Present = 0;
                  genieReadObject(GENIE_OBJ_FORM, 0x00);
                
                  while(1)
                  {
                    if(Lcd_Present == 0)
                      genieReadObject(GENIE_OBJ_FORM, 0x00);
                    // The main state machine for the display event handler
                    genieDoEvents();
                    // genieReadObject(GENIE_OBJ_FORM, 0x00);
                    // The main state machine for the motor controller
                    // tmclDoEvents();
                    // The main state machine for the SD Card
                    // SDCardDoEvents();
                  }
                }
                
                void uLCDEventHandler()
                {
                  //static int DS_val,slider_val=0;
                 Lcd_Present = 0;  // reset the flag
                  A_LED = 0;         // reset the flag
                  genieFrame Event;
                  genieDequeueEvent(&Event);
                  //abm
                  //If the cmd received is from a Reported Object, which occurs if a Read Object (genie.ReadOject) is requested in the main code, reply processed here.
                  if (Event.reportObject.cmd == GENIE_REPORT_OBJ){
                    if (Event.reportObject.object == GENIE_OBJ_FORM){
                      Lcd_Present = 1;
                      A_LED = 1;
                    }
                  }
                  // up to here
                }

                Essentially, you would be polling the display very frequently.

                Hope this helps somehow and Regards.
                Doff

                Comment


                • #9
                  Hi Doff thanks for your valuable reply and support ,

                  I changed the logic in the code and i am trying to detect display on fly. but with this logic also is not possible.
                  main()
                  {
                  A_LED = 0;
                  uint8_t lcd=1;
                  uint16_t i;
                  Init_Timer_1();

                  Check_DISPLAY_COM();

                  T1CONbits.TON = 1; // Start Timer
                  while(1)
                  {
                  if(Incr_time > Total_time)
                  {
                  if(Lcd_Presense_check == 1)
                  {
                  PR1 = 6555;
                  Lcd_Presense_check=0;
                  }
                  else
                  {
                  A_LED=0;
                  lcd=0;
                  Lcd_Presense_check=0;
                  Lcd_Present=0;
                  PR1 = 6555;

                  }
                  Check_DISPLAY_COM();
                  Incr_time=0;
                  }
                  // The main state machine for the display event handler
                  genieDoEvents();


                  }
                  }


                  void Init_Timer_1()
                  {
                  T1CONbits.TON = 0; // Disable Timer
                  T1CONbits.TCS = 1; // Select external clock
                  T1CONbits.TSYNC = 0; // Disable Synchronization
                  T1CONbits.TCKPS = 0b00; // Select 1:1 Prescaler
                  TMR1 = 0x00; // Clear timer register
                  PR1 = 6550; // Load the period value
                  IPC0bits.T1IP = 0x01; // Set Timer 1 Interrupt Priority Level
                  IFS0bits.T1IF = 0; // Clear Timer 1 Interrupt Flag
                  IEC0bits.T1IE = 1; // Enable Timer1 interrupt

                  }


                  void Check_DISPLAY_COM(){
                  uint8_t i;
                  // Reset the display present flag
                  displayPresent = false;
                  // Request the current form
                  genieReadObject(GENIE_OBJ_FORM, 0x00);
                  delay_ms(200);
                  // Go through the display state machine several times to get the response from the display
                  for(i = 0; i < 2000; i ++){
                  genieDoEvents();
                  if(Lcd_Present == 1)
                  break;
                  delay_ms(1);
                  }
                  // The displayPresent flag is set if the display is present if not nothing happens
                  }

                  void __attribute__((__interrupt__, no_auto_psv)) _T1Interrupt(void)
                  {
                  Incr_time++;
                  IFS0bits.T1IF = 0;
                  }

                  I tried lot it is not working can you please help please give more information on visi genie display. please check this code if their any mistakes let Know.

                  Any of your R&D team did on fly detect code for visi genie display, please share me. it will helps me lot.

                  Regards
                  Manjunath N N


                  Comment


                  • #10
                    Hi Doff,

                    This is my new query, i want to do screen saver. it is working fine but the thing is when i came out of screen saver mode it has to got to previous or last screen.

                    For that i used the newForm = genieGetEventData(&Event); with this i can able to get which screen. But it is going some wrong screen.

                    Here is my code.
                    main()
                    {
                    uint8_t newForm;
                    bool prev_screen = 1;
                    Init_Timer_1();
                    T1CONbits.TON = 1;

                    while(1)
                    {

                    if(lcd_touch == 1)
                    {
                    //T1CONbits.TON = 0;
                    Incr_time = 0;
                    lcd_touch = 0;
                    if(Lcd_Not_Touch == true)
                    genieWriteObject(GENIE_OBJ_FORM, newForm, 0); // with this command it should go to previous screen but it is going wrong screen.
                    Lcd_Not_Touch = false;
                    prev_screen = 1;
                    Screen_time = 20;

                    }

                    if(Incr_time > Total_time)
                    {
                    if(lcd_touch == 0)
                    {
                    if(prev_screen == 1)
                    {
                    newForm = genieGetEventData(&Event);
                    prev_screen=0;
                    }
                    Lcd_Not_Touch = true;
                    }


                    Incr_time=0;


                    }
                    // The main state machine for the display event handler
                    genieDoEvents();


                    }
                    }


                    void Init_Timer_1()
                    {
                    T1CONbits.TON = 0; // Disable Timer
                    T1CONbits.TCS = 0; // Select internal instruction cycle clock
                    T1CONbits.TGATE = 0; // disable Gated Timer mode
                    T1CONbits.TCKPS = 0b111; // Select 1:8 Prescaler
                    TMR1 = 0x00; // Clear timer register
                    PR1 =60000; // Load the period value
                    IPC0bits.T1IP = 0x01; // Set Timer 1 Interrupt Priority Level
                    IFS0bits.T1IF = 0; // Clear Timer 1 Interrupt Flag
                    IEC0bits.T1IE = 1; // Enable Timer1 in

                    }




                    void __attribute__((__interrupt__, no_auto_psv)) _T1Interrupt(void)
                    {
                    Incr_time++;
                    A_LED = A_LED ^ 1;
                    if(Lcd_Not_Touch == true )
                    {
                    if((Screen_time%20) == 0)
                    {
                    i++;
                    if(i == 1)
                    {
                    //switch to screen 4
                    genieWriteObject(GENIE_OBJ_FORM, 4, 0); // Change to Form 4
                    }
                    if(i == 2)
                    {
                    // switch to screen 5
                    genieWriteObject(GENIE_OBJ_FORM, 5, 0); // Change to Form 4
                    i=0;
                    }
                    }
                    ++Screen_time;
                    if(Screen_time == 40)
                    Screen_time=20;
                    }

                    IFS0bits.T1IF = 0;

                    }


                    help me if you have any ideas.

                    Regards
                    Manjunath N N

                    Comment


                    • #11
                      Hi,

                      I can't seem to deduce the whole logic of your screensaver implementation from the given code.

                      Code:
                          genieWriteObject(GENIE_OBJ_FORM, newForm, 0); // with this command it should go to previous screen but it is going wrong screen.
                      ...
                      
                      
                          if(Incr_time > Total_time)
                          {
                            if(lcd_touch == 0)
                            {
                              if(prev_screen == 1)
                              {
                                newForm = genieGetEventData(&Event);
                                prev_screen=0;
                              }
                              Lcd_Not_Touch = true;
                            }
                      Are the forms in your Genie project configured to report a message when activated? The only line where the value of the variable "newForm" is modified in your code is

                      Code:
                                newForm = genieGetEventData(&Event);
                      Which is executed only when three nested if conditions are met. Were you trying to catch a REPORT_EVENT message from a form that has just been activated on the display module?

                      There is already a codebase example for a screensaver application. It is for the Arduino platform however, but I trust that you can implement it on your project.

                      4D-CD-00008 Genie - Screen Saver - Arduino

                      http://forum.4dsystems.com.au/forum/...-saver-arduino


                      By the way I think your previous inquiries were answered in a support ticket.

                      Hope this helps and regards.
                      Doff

                      Comment


                      • #12
                        Hi Doff,

                        I have one more query that is, in interrupt handler function (genic.c file ) it is function pointer but i need that interrupt function as general interrupt function. Because in bootloader code it giving some issue. So i need that function as interrupt function not as function pointer.
                        OR
                        can i read the status of the 4dbutton without interrupt handler, if it is possible please let me know how can i do this without interrupt.

                        Please Help me.

                        Regards
                        Manjunath N N

                        Comment


                        • #13
                          Hi Manjunath N N,

                          I have forwarded your inquiry to a colleague. He is asking what bootloader was used in your setup. My colleague developed the library without the use of a bootloader and he did not encounter any problem.

                          Regards.

                          Doff

                          Comment


                          • #14
                            Hi Doff Thanks for replay,

                            In my hardware i do not have button, i am trying to create button in display for jump to boot loader mode.

                            But in host code i need to read status of button, for that how can read the status of button without going to interrupt. Is their any option, if it is their please let me know.

                            Because in my code this function pointer (interrupt function) giving memory issues. So i need this function without pointer type, is it possible. If it is please let me know.

                            I hope you understand my query.

                            Regards
                            Manjunath N N

                            Comment


                            • #15
                              Hi Manjunath N N,

                              Ok, I forwarded your query again. It seems that the issue is more on the programming of the external host. He suggests that perhaps you could use polling mode for your serial comms.

                              Regards.
                              Doff

                              Comment

                              Working...
                              X