Show Posts
Pages: 1 ... 42 43 [44] 45 46 ... 83
646  Using Arduino / Displays / Re: 12864ZW with u8glib - no DI pin?! on: January 26, 2013, 04:19:38 am
I forgot to mention, that there is a pending bug in u8glib where the reset pin is not handled correctly.

You could:
- use a RC network for reset
- switch to SPI interface
- wait for the next official u8glib release (not scheduled yet)
- let me know if you need a prerelease

647  Using Arduino / Displays / Re: 12864ZW with u8glib - no DI pin?! on: January 26, 2013, 12:01:17 am
The data/instruction pin (DI) might have a different name. In your case the corresponding pin is RS (register select).
Also remember to set PSB pin to "high" (connect to 5V)

648  Using Arduino / Programming Questions / Re: Menu for Display on: January 25, 2013, 03:28:53 pm

Maybe i have not yet fully understood your problem. Do you want to program exactly one timer or more than one timer?

In either case, you need to know, what exactly needs to be entered for one timer.
You mention date and time, start and dev.
But it probably needs to be cut down to atomic data times like byte and words.
So this is probably the first step: To break down the required information to small pieces.
For example in this way:
time: hour (byte, 0..23), minute (byte, 0..59), seconds (0..59)
start: could be represented as a status byte: 0 for timer stopped, 1 for time is running. In that sense the variable should be better called "is_running". By the way it is a good practice to have a naming convention for variables. For example if all boolean variables start with "is_" then they are easily seen in the code. You could also do something like
if ( is_running ) ...
which will be executed if the time "runs"
An open question to me is the mentioned "dev" (select dev). What exactly needs to be selected? How much selectable items are there. Can it be mapped to some integer (byte) variable?

So, again, first step is to break down all this to variables. Then write some nice dialog entries for it.

Once done, the question is: Is there only one timer or are there more timers to handle. Of course the existing dialogs should be reused for each different set of timer configuration variables.

if you need to handle more than one timer, i think it will make sense to study tutorial 8: Tutorial 8 has a configuration menu for the PWM output. Compare your timer data with the PWM output in this tutorial. This tutorial also introduces a top level menu. And: The PWM example is also available in the Arduino IDE (if m2tklib is installed correctly)

649  Using Arduino / Displays / Re: 8bit grey scale LCD ? on: January 24, 2013, 03:02:23 pm
I have never seen any 8 Bit grayscale LCDs.
There are some 2 Bit graycale LCDs (DOGXL160) and OLEDs with 4 Bit grayscale (NHD-2.7-12864).

650  Using Arduino / Displays / Re: Powertip PG12864 and Mega 2560 on: January 24, 2013, 02:59:41 pm
The Powertip PG12864 indeed uses the T6963 controller. There is a library mentioned on the Playground.
Pin connections are here:

651  Using Arduino / Programming Questions / Re: Menu for Display on: January 24, 2013, 02:53:42 pm

Excause me for not reading this thread more often.

I do not know much about the timer itself. What i can say: M2tklib will use
- digitalRead
- Serial interface for the Monitor Simulation
Can this do any harm to your system?

What you could do is to comment out
  if ( m2.handleKey() )
and check if things are working again.
Maybe you can also check the timer procedures with some small menu.
If this is working, that it is probably a memory issue.
Which Arduino do you use?

652  Using Arduino / Programming Questions / Re: Menu for Display on: January 24, 2013, 01:59:14 am
After a quick review of your code i do not yet see a big mistake.

Is the Menu working without EEPROM?
Maybe there is a RAM overflow (too much of RAM consumption).

653  Using Arduino / Programming Questions / Re: Menu for Display on: January 23, 2013, 05:34:43 pm

The menu procedures will only provide a small delay. So your Timer() procedure should be called as usual in the loop().

EEPROM and m2tklib.
I do not see the full code, so it is difficult to say why the menu is not working.

654  Using Arduino / Displays / Re: Need Help>> How to display Arabic Character on LCD with Arduino>> on: January 22, 2013, 02:48:46 pm
Unicode has defined chars from 0x0600 to 0x06ff as arabic chars:
Assuming that this is almost complete, then the range from  0x0600 to 0x06ff can be mapped to 0 to 255 (well from 1 to 255, because in C the 0 usually terminates a string).

Unifont claims that the arabic glyphs from 0x0600 to 0x06ff are included:

So, the following steps will provide arabic chars with u8glib

1. Download unifont BDF
2. Download bdf2u8g font converter from here:
3. Create a u8g font with arabic glyphs: bdf2u8g -l 12 -u 13 -b 0 -e 255 <bdf-file> <u8g_font_arabic> <u8g_font_filename>
4. Use the new font in your project

655  Using Arduino / Programming Questions / Re: Menu for Display on: January 20, 2013, 04:44:27 pm
- If i need print something like data and time (now printed in serial) how I can do ? I can print directly on lcd ? this is a general question for example a result of procedure or something else ...

To print the menu on the LCD, just replace the serial graphics handler with the graphics handler for the character lcd. In order to show something, you could design a menu, with read only fields and only one selectable ok button. Any element can made "read only" by adding "r1" to the format string, so

M2_U8NUM(el_dt_year, "c2r1", 0,99,&dt_year);
M2_LABEL(el_dt_sep1, "b1", "-");
M2_U8NUM(el_dt_month, "c2r1", 1,12,&dt_month);
M2_LABEL(el_dt_sep2, "b1", "-");
M2_U8NUM(el_dt_day, "c2r1", 1,31,&dt_day);

will show the date but will not allow to enter any data (M2_LABEL is always read only).
Of course you can also write directly to the LCD screen, no problem.
Tutorial 6 might give a some ideas here (


656  Using Arduino / Programming Questions / Re: Menu for Display on: January 20, 2013, 10:00:54 am
Code looks quite good now. Let me know if you need more assistance.

657  Using Arduino / Programming Questions / Re: Menu for Display on: January 20, 2013, 07:26:22 am
The hierarchie for the date input is like this:

    U8NUM - year
    U8NUM - month
    U8NUM - day
    ROOT - cancel button
    BUTTON - ok button

|                                       |
|  +-HLIST----------------------------+
|  |  YYYY-MM-DD                      | |
|  +----------------------------------+
|                                       |
|  +-HLIST----------------------------+
|  |  cancel                  ok       | |
|  +----------------------------------+
|                                       |

The hierarchie is important. Nested lists are used to get the layout done. For the time dialog this is almost the same, but the upper HLIST needs to be exchanged (from a layout perspective).

What you did is this:
  U8NUM - hour
  U8NUM - minutes
  ROOT - cancel
  BUTTON - ok

The VLIST element renders everything from top to down. All in all the VLIST has a height of 5 rows, the upper most disapearing, because the LCD simulator only uses 4 rows (like your display also).
You need the same structure with two horizontal lists like in the date dialog.

658  Using Arduino / Programming Questions / Re: Menu for Display on: January 20, 2013, 05:10:38 am

So far your code seems quite ok. The callback procedure will store the date into the RTC once the ok button is pressed.

For the time menu, you probably need to consider which elements are needed on your menu.
If you need only hour and minutes than two U8NUM elements will do the job (similar to the data entry, but different ranges)
Of course you will need again a cancel and an ok button.

You can takeover the date code and transform it like this:
M2_U8NUM(el_dt_hour, "c2", 0,23,&dt_hour);
M2_LABEL(el_dt_c, "b1", ":");
M2_U8NUM(el_dt_min, "c2", 0,59,&dt_min);

M2_LIST(list_time) = { &el_dt_hour, &el_dt_c, &el_dt_min};

The rest should be almost identical to the date menu. Of course element and procedure names need to be renamend.


Edit: Hour and Minute ranges
659  Using Arduino / Programming Questions / Re: Menu for Display on: January 19, 2013, 12:22:59 pm

Well, ".net". You have unlimited memory for data and code. But here on the Arduino... everything has to fit into a very small amount of RAM and ROM. In fact, M2tklib puts all of the elements into PROGMEM to save RAM area. This makes the menu definition look a little bit strange.

void dt_ok_fn(m2_el_fnarg_p fnarg)

"m2_el_fnarg_p fnarg" can be ignored. But it is importent to have a proper function definition for the BUTTON callback, so for the BUTTON callback it must be there. There are some m2tklib procedures, which might get use of the fnarg pointer.
This callback is described here:

"m2_SetRoot(&top_el_expandable_menu);" is the C interface. It is fully equivalent to m2.setRoot(&top_el_expandable_menu).
The set root procedure is described here:

M2_U8NUM(el_dt_year, "c2", 0,99,&dt_year);

"c2" is the so called format string. It is described here:

The format option "c", which is used here depends on the actual element. Overview is given here: But in this case we have a unsigned 8 bit data entry field, which is described (along with the "c2" format option) here: Especially the last link explains "c2": It tells the element to display two digits.
"0,99" is the range (also described in the wiki)
"&dt_year" is a reference to the variable, so that m2tklib can modify the variable directly. Any user input is directly written into this variable.

M2_LIST(list_date) = { &el_dt_year, &el_dt_sep1, &el_dt_month, &el_dt_sep2, &el_dt_day };
M2_HLIST(el_date, NULL, list_date);

M2_LIST is not an element. It defines a list for a container element.
M2_HLIST is a container element. Elements refered in the corresponding list, are shown from left to right in a row. Again full description to gether with example is here:

M2_LIST and all other elements are macros (no function calls). They have all file local scope, but can be made global visible with the extern macro: M2_EXTERN_HLIST

BTW: Is the documentation clearly enough? Or do you see some optimization? For sure there is some optimization possible, but probably i need some advice how to improve the documentation.

M2_ROOT(el_dt_cancel, NULL, "cancel", &top_el_expandable_menu);  --> Call something that bring you to the root ?
M2_ROOT appears as a push button. Once selected by the user it assignes the provided root element to the display. This makes top_el_expandable_menu visible to the user.

M2_BUTTON(el_dt_ok, NULL, "ok", dt_ok_fn);  --> Call something that confirm the date and bring you to root ?
Same as M2_ROOT, but calls a procedure once selected. This is more flexible than M2_ROOT.

Hope this clarifies things a little bit


660  Using Arduino / Displays / Re: Pervasive Displays [no power displays - e-paper] on: January 19, 2013, 10:38:11 am
Under the current conditions it is impossible to add e-paper support to u8glib. Additionally i was told that controlling an e-paper device is very different to OLED or GLCD devices. If the documentation is available to the public, then i need time to get one of these devices, understand the concept and implement something to u8glib. Especially time is a rare resource for me at the moment. So, i would suggest not to wait for u8glib supporting e-paper, but instead look for some different display type.
Oliver (u8glib)
Pages: 1 ... 42 43 [44] 45 46 ... 83