Show Posts
Pages: 1 ... 50 51 [52] 53 54 ... 102
766  Using Arduino / Displays / Re: glcd from dx.com on: April 11, 2013, 05:49:49 am
Ok, i see your problem. Nevertheless: Please measure the voltage at Vout. If it is negative you will probably need two suitable resistors to get the correct negative voltage which must be applied to v0.

In general: By applying some different voltage, you must be able to see and not see all the pixel.

If all this is ok, then another idea is to send a picture of your setup, so we can have a look at it.

Oliver
767  Using Arduino / Displays / Re: glcd from dx.com on: April 10, 2013, 11:53:15 pm
Quote
Am I right with the 52, 51, 53 pins ?
I did not see a mistake here.

Quote
analogWrite(3, brightness);
I do not think that this will work at all. The contrast pin of the LCD often requires a voltage outside the range of 0..5V. This can not be generated by analogWrite(). Use a var. pot. instead!

Oliver
768  Using Arduino / Displays / Re: Simple menu m2tklib with example. on: April 10, 2013, 05:07:40 pm
Hi

All good questions. Let me try to explain some of these m2tklib things.

I decided to let users define a static menu structure, which is located in flash-rom area at startup. Basically the menues are just global variables. To hide the complexity of these data structures, I invented macros (usually called elements in m2tklib).
Such a global variable is:

Code:
M2_LABEL(el_a0_label, NULL, "A0");

This macro gets expanded and will look like this:

Code:
label_strcture el_a0_label = { magic_argument, NULL, "A0" } PROGMEM_BLABLA;

So, el_a0_label is a variable name (in fact it is a structure). It will represent an element within m2tklib, which just displays a text ("A0" in this example). Usually you will need the address of this "element". In fact all other procedures or elements just expect the address:
Code:
M2_LIST(list_a0) = { &el_a0_label, &el_a0_u32, &el_a0_ok };
This defines a group of three elements (the label is the first element of that group) and calls this group "list_a0". So list_a0 is another variable name.

Conclusion: The first argument to any of the M2_xxx macros is a variable name.
For elements like M2_LABEL, use &<variablename>, for M2_LIST variables just use the name without "&".

Please also have look here: http://code.google.com/p/m2tklib/wiki/elref#Use_of_Elements

Quote
So I was figuring that the menu would at some point execute a loop to keep filling the display wit the mesurement data.

You can let m2tklib display the content of a global variable. Whenever you refresh the menu (m2.draw()), then m2tklib will take the value from that global variable. It is really like connecting your menu with some outside data: Whenever the value somewhere in the memory changes, m2tlib will display the current value (once updated with m2.draw())

Let us have a look at your example:
Code:
M2_U32NUM(el_a0_u32, "c4r1", &value_from_A0);
The menu will display the value of variable "value_from_A0". "value_from_A0" is a global variable. Whenever you put data into it, it will get displayed. For example like this:
Code:
void loop(void)
{
  value_from_A0 = get_adc_value_from_a0();
  m2.draw();
}
Whatever is measured via ADC gets shown in the menu.

Quote
Exept for the callback function in the MenuX2L example I have not found a way to do that yet. Is the callback the best way or is there a better way to execute code that is not part of the menu?

Another good question and i do not know the answer. It depends on your personal preference. There are two ways to display measured data:
- global variables (as discussed above)
- callback procedures

MenuX2L is not the only element which provides callback procedures. For example also all elements ending with M2_...FN() get their values from callback procedures. But also other elements like M2_COMBO expect a callback procedure. Let us solve the same problem from above with a callback procedure. We need to use M2_U32NUMFN (http://code.google.com/p/m2tklib/wiki/elref#U32NUMFN). It expects a callback procedure:

Code:
uint32_t u32numcb(m2_rom_void_p element, uint8_t msg, uint32_t val) {
  if ( msg == M2_U32_MSG_GET_VALUE )
   return get_adc_value_from_a0();
  return 0;
}
M2_U32NUM(el_a0_u32, "c4r1", u32numcb);

And the main loop will look like this:
Code:
void loop(void)
{
  m2.draw();
}

Might look simpler, but there is a drawback with the callback procedure: They might get called more than once during one call to "m2.draw()". For that reason i would suggest to start with the "global variable" approach.

Conclusion: There are two ways to display data in a menu:
- connected global variables (prefered method)
- values returned from global variables (optional, if you accept the drawbacks)

Quote
Then I would like a status bar on top of the display. It wil show waht tle last received navtex message type is and should be visible in all menus. Is there a way to do that?
No, there is not only one way but probably a many ways to do this  smiley-wink

1. Method: M2_COMBO
M2_COMBO will display a string, given by an index number from a list of strings (here: navtex messages types). Mark this element as read-only ("r1" format option)
Place this element at the beginning of each menu. Please note that you can reuse elements. Define it once , use it oftern.
Also note, that you usuallly will need a "container" element like XYLIST. XYLIST will allow you to place M2_COMBO at specific xy position on the screen.

2. Method: M2_LABELPTR
Similar to M2_COMBO, but you have to copy the type name into a string buffer. M2_LABELPTR is already read-only, so "r1" is not required.

3. Method: GLCD low level graphics commands
You can always draw a string directly to the screen. Just ensure that menu and your low level output do not overlap. In this case you would use the GLCD string draw procedure to output the navtex message type. A tutorial on this topic is here: http://code.google.com/p/m2tklib/wiki/t06glcd

4. Method: M2_X2LMENU
Thinkable, if you intend to build all menus just with X2LMENU (but this will restrict you a lot). In this case, just make the toplevel menu line of X2LMENU a callback procedure which returns a string with the name of the message type.

So, i will finish for now and I hope that i was able to clarify things a little bit.

Oliver






769  Using Arduino / Displays / Re: glcd from dx.com on: April 10, 2013, 04:14:34 pm
I did a small review on the wiring. It seems to be ok. However, as mentioned in the previos comment, there could be a contrast issue: I suggest to use a variable potentiometer.

One end to VOUT
Other end to VSS (GND)
Wiper to V0

Oliver
770  Using Arduino / Displays / Re: LCD ST7565 on: April 10, 2013, 03:49:09 pm
ok, great i just was about to post another comment.

Oliver
771  Using Arduino / Displays / Re: LCD ST7565 on: April 10, 2013, 11:44:38 am
Hi

The related code and the current output would help a lot.

You could also use http://code.google.com/p/u8glib/ which is derived from the Aruduino print class (you can use everything described here: http://arduino.cc/en/Serial/Print).

Oliver
772  Using Arduino / Displays / Re: Simple menu m2tklib with example. on: April 09, 2013, 01:44:40 pm
Great, let me know, if you have run into any other problems.

Oliver
773  Using Arduino / Displays / Re: 4-Wire SPI Graphic Display W/ Arduino Mini on: April 08, 2013, 11:51:36 pm
I am very confident that the display, mentioned at the beginning of the thread, will work with U8glib.

Oliver
774  Using Arduino / Displays / Re: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware on: April 08, 2013, 04:47:08 pm
Hi Jelbert

I have added the mentioned code for the keypad support. See http://code.google.com/p/m2tklib/issues/detail?id=108.
Instead of extending the existing handlers, i have introduced m2_eh_4bks and m2_eh_6bks (and extended m2_eh_4bsts and m2_eh_6bsts) to support the keypad values.

Just for reference, the new code in the event handler was wrong. Correct code is:
Code:
  case M2_EP_MSG_KEY_1:
    m2_nav_prepare_fn_arg_current_element(nav);
    m2_fn_arg_call(M2_EL_MSG_KEY_1); // assign the char
    return m2_nav_user_next(nav); // go to next position

I have introduced the following constants (which can be used with setKey or as return value of the event source):
#define M2_KEY_HASH 35
#define M2_KEY_STAR 42
#define M2_KEY_0 48
#define M2_KEY_1 49
#define M2_KEY_2 50
#define M2_KEY_3 51
#define M2_KEY_4 52
#define M2_KEY_5 53
#define M2_KEY_6 54
#define M2_KEY_7 55
#define M2_KEY_8 56
#define M2_KEY_9 57

Additionally you can use any other ASCII code like 'a', 'b', 'c', etc.., so m2.setKey('B') will send the ASCII B to the element. At the moment only M2_TEXT will be able to handle these new codes.

Let me know your variant of m2tklib, then i will upload a prerelease of m2tklib including keypad support.

Oliver
775  Using Arduino / Displays / Re: M2TKLIB - A User-Interface-Toolkit for the Arduino Hardware on: April 08, 2013, 02:14:48 pm
Yes, it should be possible to use setKey() if you do not want to rewrite the event source.

Oliver
776  Using Arduino / Displays / Re: 4-Wire SPI Graphic Display W/ Arduino Mini on: April 08, 2013, 02:09:50 pm
Hi

Graphics display do not have a standard interface. The electrical interface is different and also set of commands are specific to the controller. So things like 4-wire or 3-wire SPI, I2C, 4/8 Bit parallel are very specific to the controller (of course I2C should follow some standards).

But at the end, you have a specifc display in mind. This display has a UC1701 controller (compatible with ST7565). The 3-wire SPI is not HW compatible with AVR chips, but the 4-wire SPI interface works very well with the Arduino.

From my work with U8glib i can say, that supporting a specific controller is a challenging task, but supporting different displays with same controller is a time consuming task because of the different electrical characteristics and the individual memory mapping.

Here is my suggestion (unless you want to program this display from scretch):
Download http://code.google.com/p/u8glib/ and check all UC1701 and ST7565 constructors with 128x64 dimension one by one (uncomment them in the HelloWorld example). Hopefully you will find a fitting device (http://code.google.com/p/u8glib/wiki/device). Especially look at a constructor where the display content is shown correctly (contrast issues can be adjusted with setContrast). If you do not find a fitting device for u8glib, please contact me and we will add a new u8glib device for your display.

Oliver



777  International / Deutsch / Re: Displaynutzung mit Lilypad? on: April 08, 2013, 12:53:29 pm
Bezüglich monochromer graphischer OLED: Die meisten dieser OLEDs (beispielsweise von Adafruit oder Newhavendisplay) werden von http://code.google.com/p/u8glib/ unterstützt. Da der Stromverbrauch linear von den eingeschalteten "Pixel" abhängt, läßt sich der Verbrauch auch über den Inhalt steuern. Zusätzlich haben OLEDs üblicherweise einen elektronischen Helligkeitsregler (setContrast() in U8glib).

Für E-Paper sieht die Versorgung mit fertigen Libs schon etwas schlechter aus: Mir ist keine fertige Arduino Lib für E-Paper Displays bekannt.

Oliver
778  Using Arduino / Displays / Re: Simple menu m2tklib with example. on: April 08, 2013, 11:54:11 am
Hi

I think the first thing to do is to run one of the M2tklib examples (Ensure to use M2tklib for U8glib).
Use the same U8glib constructor call as for the U8glib Hello World example.
Then add pin numbers to M2tklib.

Oliver
779  Products / Arduino Due / Re: Scheduler and U8glib on DUE on: April 07, 2013, 04:13:09 pm
Hi cmaglie

Regarding your link to the LiquidCrystal lib: I had a similar problem with init of the display within u8glib.
After constructor calls, the Arduino Due will reset all I/O pins. This problem still exists in 1.5.2.

Oliver

 
780  Products / Arduino Due / Re: Scheduler and U8glib on DUE on: April 07, 2013, 03:16:32 pm
Well, yes, and indeed the modification of u8g_Delay() is more a workaround (or hack) instead of a good solution. To excause the current situation a little bit: I never read in the Arduino documentation that some of the procedures are not valid to be called during constructor time. And on the ATMEGA it was never a problem to call digitalWrite() or delay() in the constructor.

For the port to the Arduino Due i also had to deal with this problem because of some other conflicts. U8glib already has a begin() procedure. But u8glib has not been completly redesigned for it. So to say, i am on the half way of a complete redesign of the internal architecture without changing much of the existing API.

So to conclude this:
I was not aware of this problem in the past, but now i do my very best to update U8glib.

My suggestion to the Arduino Project: Please clearly state that delay() and digitalWrite() must not be used in any construtor calls.

Oliver


Pages: 1 ... 50 51 [52] 53 54 ... 102