V0 is required for the contrast adjustment:
(Source: https://www.mikrocontroller.net/attachment/69907/Zwischenablage02.jpg)
Oliver
V0 is required for the contrast adjustment:
(Source: https://www.mikrocontroller.net/attachment/69907/Zwischenablage02.jpg)
Oliver
sorry I forgot to attch the datasheet!
and which is vout here?
At Vo I am getting 5V when I am keeping it open and measure it with ground!
lcd 240128d.pdf (256 KB)
Ok after reading few threads I connected pot of 50K between VCC and VEE(-12V) to VO but now on hello world program I am only getting a black line for 1/2 sec and it gets disappear again same for the rotation example!
I dont understand where I am doing wrong!
What happens, if you move the pot. You should be able to turn on and off all pixels just by moving the wiper.
Oliver
Ok thanks I got it it is just to set pot to proper position thats all!
Hey thanks for the support!
I just want to ask you that I want to print one continuous wave form so can we shift our entire selected pixels towards right or left? or do we have to re print entire data again pixel by pixel
Hi
You have to store the values of the waveform (array). And indeed, you have to redraw the complete waveform.
Oliver
hello I have a problem communicating with the Winstar wg240128a with the parent tb6963 inm U8glib .
I compiled and loaded the program but only lcd appears two random lines if possible to verify what I am doing wrong in the program.
I'm trying to one helloword but so far nothing
#include "U8glib.h"
U8GLIB_T6963_240X128 u8g(49, 48, 47, 46, 45, 44, 43, 42, 37, 36, 35, 34, 33);
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(u8g_font_unifont);
//u8g.setFont(u8g_font_osb21);
u8g.drawStr( 0, 22, "Hello World!");
}
void setup(void) {
// flip screen, if required
u8g.setRot180();
// set SPI backup if required
//u8g.setHardwareBackup(u8g_backup_avr_spi);
// assign default color value
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255, 255, 255);
}
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while ( u8g.nextPage() );
// rebuild the picture after some delay
delay(500);
}
.
Random line? Sounds like the negative LCD voltage is missing.
Oliver
conection arduino mega/winstar wg240128A
1 GND
2 GND
3 5V
4 CONTRAST
5 wr 35
6 rd 34
7 cs 37
8 CD 36
9 VEE No conection
10 resset 33
11 D0 49
12 D1 48
13 D2 47
14 D3 46
15 D4 45
16 D5 44
17 D6 43
18 D7 42
19 FS1 GND
20 gnd signal low
I guess, this confirms my previous asumption: How is CONTRAST connected? Why is VEE not connected? You need to connect both as described in the datasheet of your display module.
Oliver
The contrast is connected to a potentiometer functioning as the linhs that appear can change the display contrast.
The VEE in this datasheet in conection / negative output voltage
Datasheet of http://www.winstar.com.tw/UserFiles/File/How-to-Use-a-Graphic-LCD.pdf display.
Better visualized the lines are not aleotrias but always appear when I turn on the Arduino in the same position
hey thanks for this library ,
But now I am stuck as I want to use this display for my product where i have a long flowchart and I dont understand how I could use this display with it!
Means I have a home screen which I could create but then I have to take numeric value fro keypad and want to put those no on display so user could get what he is typing then again if he select diff mode the home screen should change to that particular function's home screen!
The main problem is that I don't understand how to make use of display option repetadly in same loop with different input from user!
If any one who could provide me code sample like if I press 1 then print 1 and then I press two then print 12 that's all what I am not understanding!
Here is one code I m trying with U8G lib I wanted to print the keypad button so I was trying to modify FPS example in that lib to print it and I am getting @@@@@ all over the screen, I am confused where I am doing wrong!
#include "U8glib.h"
U8GLIB_T6963_240X128 u8g(2, 3, 4, 5, 6, 7, 8, 9, 10, A5, 12, 14, 13); // 8Bit Com: D0..D7: 2,3,4,5,6,7,8,9, C/D=A5, wr=12, rd=14, cs=10,FS=Gnd, reset=13
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','<'}
};
byte rowPins[ROWS] = {42, 44, 46, 48}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {43, 45, 47, 49}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup() {
Serial.begin(57600);
/*****************display***************************/
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
}
void show_result(const char *s) {
// assign default color value
if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
else {
// u8g.setColorIndex(draw_color);
}
u8g.setFont(u8g_font_8x13B);
u8g.firstPage();
do {
u8g.drawStr(0,12, s);
// u8g.drawStr(0,24, convert_FPS(fps));
} while( u8g.nextPage() );
}
void loop() {
char key = keypad.getKey();
//if (key){
Serial.println(key);
uint16_t fps;
switch(key){
case 1:
// fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 1");
delay(2000);
break;
case 2:
//fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 2");
delay(2000);
break;
case 3:
//fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 3");
delay(2000);
break;
case 4:
// fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 4");
delay(2000);
break;
case 5:
//fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 5");
delay(2000);
break;
//}
}
}
The "Keypad.h" library returns ascii values from the keypad.getKey() method.
e.g. if you press the "*" key you get the printable ascii value of an asterisk.
So your loop() should be:
void loop() {
char key = keypad.getKey();
if (key) { //only when there is a keypress
Serial.println(key); //this will show printable character
uint16_t fps;
switch (key) {
case '1': //use ascii value
// fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 1");
delay(2000);
break;
case '2':
//fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 2");
delay(2000);
break;
case '3':
//fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 3");
delay(2000);
break;
case '4':
// fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 4");
delay(2000);
break;
case '5':
//fps = picture_loop_with_fps(draw_clip_test);
show_result("KEY: 5");
delay(2000);
break;
}
}
}
Note that the switch cases are '1' (0x31) and not integer 1.
Likewise, the keypad.getKey() returns 0 when there is no key.
So you should only print to the Serial terminal if there is a key press.
There is nothing too complicated with either Keypad.h or ug8lib.h
However you should test small snippets at a time. e.g. the CustomKeypad example
David.
Thanks for help david!
I tried with custom keypad earlier with success! but forgot about askii value thanks for guidance!
Secondly as I want to print many things I want to make a background logos and screen which i want to keep const and just want to change the other data, but I dont want to reconfig all screen as this will consume a lot ram of my uc so is there any way to generate or edit only specific loop with keeping other as it is means in above ex. how can i keep key word on lcd and just write 1/2/3.. as per keypad input? means I dont want to reconstruct entire screen to save space!
As a general rule, you draw the whole screen once. Then only redraw small areas as they change.
You can see how to do most things by studying the example sketches. Modify small sections at a time until you get the functionality that you want for your app. You can use Serial for input and debug output.
When you are happy with the display, you do the same exercise with the Keypad examples.
Then add the keypad to your sketch.
Arduino is very simple to use but you should do it in small steps. Testing as you proceed.
David.
Thanks for help,
I am trying to understand the concept of current page() and next page(); If there is any link or something available to get a brief explanation? I tried with documentation but didnt got my concepts clear!
I need to understand those concept of function pointer and all to understand that FPS example of this library!
Guys, I am facing a programming problem which I am unable to identify!
I am doing a code for my project as U mentioned above I am going good in it!
But a strange unexpected output arrivese, dont understand why that happening so I need help from forum over it!
#include "U8glib.h"
U8GLIB_T6963_240X128 u8g(2, 3, 4, 5, 6, 7, 8, 9, 10, A5, 12, 14, 13); // 8Bit Com: D0..D7: 2,3,4,5,6,7,8,9, C/D=A5, wr=12, rd=14, cs=10,FS=Gnd, reset=13
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','>'},
{'*','0','#','<'}
};
byte rowPins[ROWS] = {42, 44, 46, 48}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {43, 45, 47, 49}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int Switch_position=0;
int Variable_Switch_A=0;
int Variable_Switch_B=0;
int Variable_Switch_C=0;
//char a='2',b='0',c='0',d='0',e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;
char ab;
int i,j;
int error_flag=0,votage_selected;
char keypad_value[4]={0,0,0,0};
#define Switch_Position_A 22
#define Switch_Position_B 23
#define Switch_Position_C 24
void setup() {
Serial.begin(57600);
pinMode(Switch_Position_A,INPUT);
pinMode(Switch_Position_B,INPUT);
pinMode(Switch_Position_C,INPUT);
/*****************display***************************/
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
}
void IR(void){
u8g.setFont(u8g_font_ncenR12r);
//u8g.setFont(u8g_font_4x6);
u8g.drawStr( 200, 12, "IR");
u8g.drawStr( 10, 32, "1] SETTINGS");
u8g.drawStr( 10, 62, "2] RUN TEST");
//Serial.println("IR");
}
void IR_SETTINGS(void){
u8g.setFont(u8g_font_ncenR12r);
//u8g.setFont(u8g_font_4x6);
u8g.drawStr( 200, 12, "IR");
u8g.drawStr( 10, 32, "1] VOLTAGE");
u8g.drawStr( 10, 62, "2] TIME");
u8g.setFont(u8g_font_4x6);
u8g.drawStr( 0, 12, "Settings->voltage");
}
void IR_SETTINGS_VOLTAGE(void){
u8g.setFont(u8g_font_ncenR12r);
u8g.drawStr( 200, 12, "IR");
u8g.setFont(u8g_font_4x6);
u8g.drawStr( 0, 12, "Settings->voltage");
u8g.setFont(u8g_font_ncenR08r);
u8g.drawStr( 5, 30, "PLEASE ENTER TEST VOLTAGE VALUE");
u8g.drawStr( 5, 50, "FROM 10V-9999V ");
u8g.drawStr( 5, 70, "RESOLUTION WILL BE IN 10V STEPS");
u8g.setFont(u8g_font_ncenR12r);
u8g.drawStr( 5, 100, "TEST VOLTAGE=");
{
u8g.drawStr(160,100,&keypad_value[j]);
}
//}
}
void IR_SETTINGS_VOLTAGE_SELECTED_DISPLAY(void)
{
Serial.println("I am in IR_SETTINGS_VOLTAGE_SELECTED_DISPLAY");
u8g.setFont(u8g_font_ncenR12r);
u8g.drawStr( 200, 12, "IR");
u8g.setFont(u8g_font_4x6);
u8g.drawStr( 0, 12, "Settings->voltage");
u8g.setFont(u8g_font_ncenR08r);
u8g.drawStr( 0, 52,"U SELECTED VOLTAGE VALUE");
char buffer[4];
sprintf(buffer,"%d",votage_selected);
Serial.println(buffer);
u8g.drawStr( 0, 72,&buffer[j]);
Serial.println(buffer[j]);
}
void DM(void){
}
void SV(void){
}
void DD(void){
}
void VM(void){
}
uint16_t picture_loop_with_fps(void (*draw_fn)(void)) {
u8g.firstPage();
do {
draw_fn();
} while( u8g.nextPage() );
//error_flag=0;
}
int z=0;////////////////////initial flag
void loop() {
char key = keypad.getKey();
Switch_position=0;
Variable_Switch_A=0;
Variable_Switch_B=0;
Variable_Switch_C=0;
if(digitalRead(Switch_Position_C)==1)
{
Variable_Switch_C=1;
}
if(digitalRead(Switch_Position_B)==1)
{
Variable_Switch_B=1;
}
if(digitalRead(Switch_Position_A)==1)
{
Variable_Switch_A=1;
}
Switch_position=Variable_Switch_A+Variable_Switch_B+Variable_Switch_C;
switch (Switch_position){
case 1:
if(z==0){ //////for initial display call
picture_loop_with_fps(IR);
Serial.println("IR");
Serial.println("I am ready");
key = keypad.getKey();
if (key=='1'){
z=1; /////to direct it to settings of IR mode
}
}
if(z==1){ /////for going in setting option
Serial.print("key 1,z=");
Serial.println(z);
picture_loop_with_fps(IR_SETTINGS);
key = keypad.getKey();
if (key=='1'){
z=2; /////to direct it to IR-setting-voltage mode
delay(200);
}
}
if(z==2){ /////for going in IR-setting-voltage option
Serial.print("key 1,z=");
Serial.println(z);
for(i=0;i<4;i++)
{
key=0;
delay(100);
picture_loop_with_fps(IR_SETTINGS_VOLTAGE);
while(!key){
key = keypad.getKey();
}
Serial.print("key");
Serial.println(key);
if(key=='>')
{
i=4;
z=3;
}
else{
keypad_value[i]=key;
z=3;
}
}
i=4;
z=3;
}
if(z==3)
{
Serial.print("z=:");
Serial.println(z);
picture_loop_with_fps(IR_SETTINGS_VOLTAGE);
votage_selected = atoi(keypad_value);
Serial.print("votage_selected");
Serial.println(votage_selected);
picture_loop_with_fps(IR_SETTINGS_VOLTAGE_SELECTED_DISPLAY);
delay(2000);
z=4;
}
break;
case 2:
picture_loop_with_fps(DM);
break;
case 3:
picture_loop_with_fps(SV);
break;
case 4:
picture_loop_with_fps(DD);
break;
case 5:
picture_loop_with_fps(VM);
break;
}
}
This is my whole program but I know it is too big to read and understand so just posting where I am facing problem!
if(z==2){ /////for going in IR-setting-voltage option
Serial.print("key 1,z=");
Serial.println(z);
for(i=0;i<4;i++)
{
key=0;
delay(100);
picture_loop_with_fps(IR_SETTINGS_VOLTAGE);
while(!key){
key = keypad.getKey();
}
Serial.print("key");
Serial.println(key);
if(key=='>')
{
i=4;
z=3;
}
else{
keypad_value[i]=key;
z=3;
}
}
i=4;
z=3;
}
if(z==3)
{
Serial.print("z=:");
Serial.println(z);
picture_loop_with_fps(IR_SETTINGS_VOLTAGE);
votage_selected = atoi(keypad_value);
Serial.print("votage_selected");
Serial.println(votage_selected);
picture_loop_with_fps(IR_SETTINGS_VOLTAGE_SELECTED_DISPLAY);
delay(2000);
z=4;
}
In this loop my expectation is if i press '>' or enter 4 digit value this program should execute following loop
void IR_SETTINGS_VOLTAGE_SELECTED_DISPLAY(void)
{
Serial.println("I am in IR_SETTINGS_VOLTAGE_SELECTED_DISPLAY");
u8g.setFont(u8g_font_ncenR12r);
u8g.drawStr( 200, 12, "IR");
u8g.setFont(u8g_font_4x6);
u8g.drawStr( 0, 12, "Settings->voltage");
u8g.setFont(u8g_font_ncenR08r);
u8g.drawStr( 0, 52,"U SELECTED VOLTAGE VALUE");
char buffer[4];
sprintf(buffer,"%d",votage_selected);
Serial.println(buffer);
u8g.drawStr( 0, 72,&buffer[j]);
Serial.println(buffer[j]);
}
but strange thing is if I press '>' then it executes this code and print the display on lcd properly on country if i enter 4 digit value without pressing '>' so then z becomes three value goes in votage_selected and also get seria printed
Serial.println("I am in IR_SETTINGS_VOLTAGE_SELECTED_DISPLAY");
...
sprintf(buffer,"%d",votage_selected);
Serial.println(buffer);
u8g.drawStr( 0, 72,&buffer[j]);
Serial.println(buffer[j]);
but again immediately my z becmes 0 and start executing my this loop
if(z==0){ //////for initial display call
picture_loop_with_fps(IR);
Serial.println("IR");
Serial.println("I am ready");
...
And this only happens with 4 value i/p not with '>' input?
I am not getting where I am doing wrong can any one could help me?
Also i would like to know can we print int value on display like we print string by using u8g.drawStr()?