Go Down

Topic: MENWIZ: yet another character lcd menu wizard library (Read 78 times) previous topic - next topic

Khalid

#265
Dec 24, 2012, 08:19 pm Last Edit: Dec 24, 2012, 08:29 pm by Khalid Reason: 1
Thanks brunialti Roberto,
I shall check and tell you tommorrow..
I am stuck here , i have defined M_PWM as a byte variable. This store motor PWM value in the range 0~100 in the EEPROM. I was unable to make user screen in MENWIZ.. you can see following code, especially below the  //2nd LCD Line:
Code: [Select]
void msc(){
 static  char buf[7];
 int Diff=0;
 //1st lcd line
 strcpy(menu.sbuf,"E:"); strcat(menu.sbuf,itoa((int)(READ_RIGHT_LDR),buf,10)); strcat(menu.sbuf,"W:"); strcat(menu.sbuf,itoa((int)(READ_LEFT_LDR),buf,10));  //integer variable READ_RIGHT_LDR and READ_LEFT_LDR getting values from Analog pins (1~1023)
 if (READ_RIGHT_LDR>READ_LEFT_LDR)
 {
   Diff=READ_RIGHT_LDR-READ_LEFT_LDR;
  }
  else {
    Diff=READ_LEFT_LDR-READ_RIGHT_LDR;
    }  
 strcat(menu.sbuf,"Diff:"); strcat(menu.sbuf,itoa((int)(Diff),buf,10));
 //2nd LCD Line
 strcat(menu.sbuf,"\nMpwm:");strcat(menu.sbuf,itoa(M_PWM,buf,10));  //M_PWM is a byte range any value  from 0 to 100. Here i am stuck....how can i use strcat??

// CALCULATING MINUTES AND SECOND
 int seconds = (int) ( CountdownTime/ 1000) % 60 ;  //CountdownTime is unsigned long  and a global variable suppose its getting values from Millis()
 int minutes = (int) ((CountdownTime / (1000*60)) % 60);
 strcat(menu.sbuf," CNTD:");strcat(menu.sbuf,itoa((int)(minutes),buf,10)); strcat(menu.sbuf,":");strcat(menu.sbuf,itoa((int)(seconds),buf,10));
 //3rd LCD Line
 strcat(menu.sbuf,"\nSamplingTime: ");strcat(menu.sbuf,itoa((int)(SampleTime),buf,10));//SampleTime is integer variable
   //4th LCDLine
 strcat(menu.sbuf,"\nSensitivity: ");strcat(menu.sbuf,itoa((int)(Sensitivity),buf,10));//Sensitivity is also integer
 menu.drawUsrScreen(menu.sbuf);
 }

brunialti

I have not enough information, Anyway the following code (extracted by your example) works correctly.
Check actual values of your variable in msc....

Code: [Select]
byte M_PWM=78; //is it correc?t

void setup(){
 static  char buf[7],sbuf[25];
 int Diff=0;
 Serial.begin(19200);
 
 //2nd LCD Line
 strcat(sbuf,"Mpwm:");  strcat(sbuf,itoa(M_PWM,buf,10));  
 Serial.println(sbuf);
}
void loop() {}

Khalid

#267
Dec 25, 2012, 06:18 am Last Edit: Dec 25, 2012, 07:53 am by Khalid Reason: 1
Okay Brunalti,
I tested the new functionalities and here is my review:
GOOD THING:
1- Menu index (MW_MENU_INDEX) appears on the LCD screen and looks good
2- The new library function good when serial.println function is not in use in the USER DISPLAY SCREEN.
BAD THING:
1- The new library is unstable, if the serial monitor is ON and Serial.Println function working in the USER DISPLAY SCREEN:

 a)I have 04 nodes in the MAIN MENU,  If the Serial.Println(); i.e. serial communication is on then when i reach to 4/4, the arduino reset itself and shows weired characters on LCD. It always reset..

Just see the MenuStructure:
MAIN MENU
 Basic Parameters
 Move East
 Save
 Load

   Basic Parameters have terminal nodes like following
   Basic Parameters
        Manual   (This is List of 5)
        Motor PWM
        Sensitivity
        NightRetHr
        RTimeSec
        LightPoint
        SampleTimein

b) if the serial communication is on, When i go to Node 3 of the Menu (Save), and press the confirm button, the next screen appears but all things are mixed up and nothing happen.
c)if the serial communication is on, I can't go to Node-4 (Load) of the menu, the LCD shows weired character and hang..

Previously all working fine for me....

Regards


Khalid

I disabled the Serial function in USER DISPLAY SCREEN and all things are working fine to me. Have few questions:
1- How can i display the following two cutom characters on my USER DISPLAY SCREEN:
Code: [Select]
//MOON
byte  Moon[8] = {
B00100,
B01000,
B11000,
B11001,
B11001,
B11111,
B01110,
B00000
};

byte Sun[8] = {
B00000,
B00100,
B10101,
B01010,
B11111,
B11111,
B11111,
B11111
};


2- How can i increase the delay time in USER DISPLAY SCREEN. actually my analog sensors readings are too fast on USER SCREEN unable to read.

brunialti

#269
Dec 25, 2012, 10:43 am Last Edit: Dec 25, 2012, 10:54 am by brunialti Reason: 1
About Serial problems in user screen It is obscure for me. I'll try to replicate. Maybe serial connection introduces a delay time and/or has conflicts with your current arduino attached sensors/devices.

About characters, you can use createChar (this is not a MENWIZ char, it is a LiquidCrystal method instead, look at menwiz.cpp). Be carefull: it may conflict with MEWNWIZ, as it also create characters. Use char indexes higher than 3.

The user display elapsed time (the idle time before user screen appears) is the last parameter of addusrscreen. But perhaps I did not uderstand your problem.
If you refer to rapidly changes to values in user screen ... there are no  ways other than to introduce a delay ... but it will slow down the interface responsivity. Try values around max 100 millis ... It sound quite strange as in my experience sensors values never changed at such a dramatic pace to let them unreadable on a LCD ... You can also and preferably set a user software implemented delay time before refresh values: store the latest read time and let the value be refreshed after that value (I suggest 500 millis).

Go Up