Announcement

Collapse
No announcement yet.

general way to debug your code?

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

  • general way to debug your code?

    Hi guys.

    I'm having a setup with a arduino mega + uLCD-32PTU.

    If I would like to investigate /debug my code, what options do I have?

    Is there a way read out some error via the serial communication from the LCD to arduino?

    Or how do know that there no faults ?

    these errors are defined in the Header file:
    #define ERROR_NONE 0
    #define ERROR_TIMEOUT -1 // 255 0xFF
    #define ERROR_NOHANDLER -2 // 254 0xFE
    #define ERROR_NOCHAR -3 // 253 0xFD
    #define ERROR_NAK -4 // 252 0xFC
    #define ERROR_REPLY_OVR -5 // 251 0xFB
    #define ERROR_RESYNC -6 // 250 0xFA
    #define ERROR_NODISPLAY -7 // 249 0xF9
    #define ERROR_BAD_CS -8 // 248 0xF8

    can I read theese errors fro the arduino?


    /Kasper.



  • #2
    Hello Kasper,

    Those error defined in the Header file is used to detect serial communication errors. If you wish to establish a serial communication debugging you cannot directly used those variables as to it is private not accesible by default. Though you can move it to public but this is unnecessary because the library handles these automatically.


    Is there any specific error that you are having on your setup?


    Best regards,
    Bern

    Comment


    • #3
      Originally posted by bernadette View Post
      Hello Kasper,

      Those error defined in the Header file is used to detect serial communication errors. If you wish to establish a serial communication debugging you cannot directly used those variables as to it is private not accesible by default. Though you can move it to public but this is unnecessary because the library handles these automatically.


      Is there any specific error that you are having on your setup?


      Best regards,
      Bern
      Hi Bern.

      I have a process machine where i use an arduino mega and the uLCD-32PTU. the arduino send status of different kind (variables and strings) to the display and the display is used to setup parameters for the machine.

      once the machine has been startup and idling for several hours its like the it freeze, then I need to shift to another form/screen and back again. even that is not always enough. the a reboot is necessary. Also when changing FORMS, the display graphic is not loaded so several FORM shift is necessary before the graphics is loaded.

      I got 6 forms and from the arduino i do read the actual form number and only send variables on that specific screen, to minimize the communication.

      I would like to know if I got lots og NAK's or other failures and therefore Im looking for a way to get informed about the system behavior?
      Last edited by kaspervissing; 6th January 2019, 05:02 AM.

      Comment


      • #4
        Hello Kasper,

        You can try to serial print the information that the arduino is sending and receiving. Possible that you are experiencing a read disturb, for further reference to this you can check out this thread: https://forum.4dsystems.com.au/node/66428

        Add this routine on your arduino code..

        //-START- CODE HERE

        void setup() {
        Serial.begin(9600);
        Serial1.begin(9600);
        }

        void loop() {
        if (Serial.available()) { // If anything comes in Serial (USB),
        Serial1.write(Serial.read()); // read it and send it out Serial1 (pins 0 & 1)
        }

        if (Serial1.available()) { // If anything comes in Serial1 (pins 0 & 1)
        Serial.write(Serial1.read()); // read it and send it out Serial (USB)
        }
        }

        //-END-

        More likely that there is an overflow of command that the display is receiving. Also if it's possible for you to send us the file project, for us to check.

        Best regards,
        Bern

        Comment

        Working...
        X