Loading...
  Show Posts
Pages: 1 ... 31 32 [33] 34 35 ... 56
481  Using Arduino / Displays / Re: Graphic Display LCD4884 on: June 29, 2012, 05:46:54 pm
Hi
At least one problem is the string size:
Instead of
{{{
static char dataString[0];
}}}
use
{{{
static char dataString[32];
}}}
which should be enough for the result of sprintf.

BTW: This display should also be supported by u8glib, which implements also the "print" statement (http://code.google.com/p/u8glib/wiki/userreference#print) from the serial interface.

Oliver
482  Using Arduino / Programming Questions / Re: Interpolation: 12-bit DAC with 8-bit tables on: June 27, 2012, 06:07:01 pm
Assumption:
You have an arrray "uint8_t a[10]", which contains values of a signal at t = 0ms, 100ms, 200ms, 300ms ... 900ms.
Assumed problem:
You want to know the signal value (12 bit) at u = 123ms (or any other value between 0 and 1000)

Algorithm:
1) Search for the index values, where t1 <= u <= t2
For x = 123 this is t1=100 (with index i1=1 and t2=200 with index i2=i1+1)

2) do a linear interpolation between a[i1] and a[i2]
in general this is:
a[i1]+(a[i2]-a[i2])*(u-t1)/(t2-t1)
to get the increased 12 bit resolution, do a shift by 4 bit.. at the right places  smiley-wink
(a[i1]<<4)+((a[i2]-a[i2])<<4)*(u-t1)/(t2-t1)
Still, types are not assigned. Probably the simplest solution is to use int32_t for the multiplication:
(((int16_t)a[i1])<<4)+(int16_t)((((int32_t)a[i2]-(int32_t)a[i2])<<4)*(int32_t)(u-t1)/(int32_t)(t2-t1))

Oliver
483  Using Arduino / Displays / Re: OLED Recommendations on: June 27, 2012, 12:03:28 am
The SSD1325 based display from NHD (http://www.newhavendisplay.com/nhd2712864ucy3-p-3621.html) is supported by http://code.google.com/p/u8glib/.

Oliver
484  International / Deutsch / Re: GPS-Modul an Arduino mit Optokoppler on: June 25, 2012, 01:16:00 pm
Hi
Du hast zwar nicht begründet, warum Du einen Optokoppler brauchst, aber bezüglich Pegelwandlung war die folgende Seite immer ganz hilfreich:

http://www.mikrocontroller.net/articles/Pegelwandler

Grüße,
Oliver
485  Using Arduino / Displays / Re: [Nokia 5110] Blink Black Screen on: June 24, 2012, 04:09:27 pm
... what i noticed...
1) There is no level shifter. The PCD8544 expects 3.3 logic. Not sure if the sparkfun has a level shifter
2) Choose a longer reset (20-30 ms)
3) Try some different values for Vop (see also the comments for the product on the sparkfun page)

Also compare with init sequence in u8glib: https://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_pcd8544_84x48.c

Oliver
486  Using Arduino / Displays / Re: Screen Recommendations on: June 22, 2012, 02:10:07 pm
What about OLEDs? I have this one: http://www.newhavendisplay.com/nhd2712864ucy3-p-3621.html
It has a really good contrast.

It is also supported by u8glib (http://code.google.com/p/u8glib/), which has big and small fonts as part of the distribution:

Font list for u8glib is here: http://code.google.com/p/u8glib/wiki/fontsize

Oliver
487  International / Deutsch / Re: SD- µSD Adapter als SD-Sheld verwenden? on: June 19, 2012, 02:38:52 pm
Quote
Es benutzt zur Pegelwandlung nur je zwei Widerstände (siehe Schaltplan).
... je ... pro Signal ...

Technische Wunder kann Seeedstudio wohl auch noch nicht vollbringen  smiley-grin
Aber danke für die Klarstellung.

Oliver
488  International / Deutsch / Re: SD- µSD Adapter als SD-Sheld verwenden? on: June 19, 2012, 02:24:26 pm
Ich bin zwar auch kein Fan von Widerstandsteilern, aber das Shield von Seeedstudio hier funktioniert prima:
http://www.seeedstudio.com/wiki/SD_Card_Shield
Es benutzt zur Pegelwandlung nur je zwei Widerstände (siehe Schaltplan).

Grüße,
Oliver
489  Using Arduino / Programming Questions / Re: Sparkfun GLCD slow toggle pixel on: June 19, 2012, 10:38:24 am
I do see a difference between SPI serial, I2C serial and RS232 serial. GLCDs with SPI should be fast enough. With a Chipkit Uno i got more than 70Hz frame rate with a 102x64 Display.

Oliver
490  Using Arduino / Programming Questions / Re: Seperate delays for LCD and measurement on: June 19, 2012, 10:33:04 am
Additionally you could store the last value, compare the current value with the last value and refresh only the LCD if there is a difference (old != current).

Oliver
491  Using Arduino / Displays / Re: turning a parallel interface lcd into a serial interface? on: June 16, 2012, 04:57:58 pm
Hi
I think the iteadstudio graphics color LCD has a touch screen, at least as an ordering option. Another question is, what is the intended frame rate for the display. With a full color LCD, graphics rendering is slow. Monochrom LCDs are much easier to handle for the Arduino.

For example, almost all the monochrome LCDs from http://www.lcd-module.com/products/dog.html can be equiped with touchscreens.

Oliver


492  Using Arduino / Programming Questions / Re: GLCD menu help...... please on: June 16, 2012, 03:51:37 pm
Indeed, nice buttons.

So, assuming you want to give a try to M2tklib, here is some example.

Let's start with the first menu:
menu 1           
lights on/off     
submenu 1   
light timer   

First, i rename it from "menu 1" to "light"-menu, and i remove the submenu 1.
Then we have:
light menu
lights on/off     
light timer   
 
The basic M2tklib building block is a dialog window. The active dialog window is visible and data can be entered into it by the user. The light control dialog window for your first menu may look like this:
 
Light On: <toggle button>
Timer: <numeric input>
< ok button >

This is the layout. Of course this is only my personal suggestion how to design this.
This layout has to be translated into m2tklib language. More specific, each layout component has to be translated into an m2tklib element. Elements are listed here: http://code.google.com/p/m2tklib/wiki/elref

The translation will have the following result:

<M2_LABEL> <M2_TOGGLE>
<M2_LABEL>  <M2_U8NUM>
<M2_BUTTON>

Before I start to turn this into real code: M2tklib dialog windows interact with the remaing program by variables. This means we have to define variables, which will be filled by M2tklib with the data given by the user:
Code:
// the following variables contain the input values from the user
uint8_t light_timer = 0;
uint8_t light_on = 0;


Let us convert the first label into real code. The label text will be "Light On: "
The code is:
Code:
M2_LABEL(el_light_on_label, NULL, "Light On: ");

The first argument to the element is an element name ("el_light_on_label"). All elements in M2tklib start with their element name.
The second argument to the element is the format string. Also in M2tklib all elements have such a format string. I try to avoid the use of format strings as far as possible in this example, but in principle, a format string provides additional information for the element.
The third argument is the label text itself.
M2_LABEL is also discussed here: http://code.google.com/p/m2tklib/wiki/elref#LABEL

Now I do not discuss all remaining elements, but just give the element translated code here:

Code:

M2_LABEL(el_light_on_label, NULL, "Light On: ");
M2_TOGGLE(el_light_on_toggle, NULL, &light_on);

M2_LABEL(el_light_timer_label, NULL, "Timer: ");
M2_U8NUM(el_light_timer_u8, "c2", 0, 99, &light_timer);

void light_dialog_ok(m2_el_fnarg_p fnarg) {
  /* do something with the values */
  /* ... */
 
  /* go back to main menu */
  m2.setRoot(&el_top_controller_menu); 
}
M2_BUTTON(el_light_ok, "f4", " ok ", light_dialog_ok);

Some notes:
  • M2_U8NUM expects a range (here from 0 to 99 as an example)
  • M2_U8NUM has a format option which limits the number of visible digits to 2
  • M2_BUTTON expects a callback function. This means, a procedure (light_dialog_ok) is called when the button is pressed.
  • Within a callback procedure you can change the complete dialog window by assigning a new dialog (root) elemet. This is el_top_controller_menu in our case.
  • M2_BUTTON option "f4" selects the so called highlighted font 0. This is done by placing a box around the text (see below).
  • Variables are provided as arguments to the related element, with a "&" in front of it
  • The format argument NULL means: No options, use default values.

How does M2tklib know the arrangement of elements? Well, we need to define it. For this reason we have so called container elements. One usefull container is the grid element. M2_GRID expects a list of elements and arranges them in a matrix style:

Code:
M2_LIST(list_light_dialog) = {
    &el_light_on_label, &el_light_on_toggle,
    &el_light_timer_label, &el_light_timer_u8, 
    &el_light_ok
};
M2_GRIDLIST(el_light_grid, "c2", list_light_dialog);
Notes:
  • M2_LIST ist NOT an element. It is a list
  • Elements are always refered by adding a "&" in front of it
  • Lists are always refered without a "&" in front of it
  • Format option "c2" defines two columns for the matrix

At last, we want to center the whole dialog window. This is done by M2_ALIGN. Unfortunately it requires a more complex format option, so this is given here without further explaination:
Code:
M2_ALIGN(el_top_light, "-1|1W64H64", &el_light_grid);

At the end, it will (more or less) look like this:


The actual style will depend on the underlaying graphics engine. Is it a character or graphics LCD? Which font is in use? Which cursor style has been selected? What is the shape of the toggle button?

One good thing on M2tklib is, that your code is portable. You can use the same code with a character display.

Finally let me discuss the main menu: Design could be this:
<Jump to Light Menu>
<Jump to Power Menu>

I already had introduced M2_BUTTON, but if you only want to switch to another dialog window, then M2_ROOT is more easier to use (it avoids the callback procedure):

Code:
M2_ROOT(list_controller_light, NULL, "Light", &el_top_light);
M2_ROOT(list_controller_power, NULL, "Power", &el_top_power);

// all menu lines are grouped by a vlist element
M2_LIST(list_controller_menu) = { &list_controller_light, &list_controller_power};
M2_VLIST(el_controller_menu_vlist, NULL, list_controller_menu);

// center the menu on the display
M2_ALIGN(el_top_controller_menu, "-1|1W64H64", &el_controller_menu_vlist);
Notes:
  • Very similar to the previous dialog window...
  • Instead of M2_GRID, there is M2_VLIST which is a little bit simpler than M2_GRID: It arranges the buttons in a vertical list

I skip the power menu. I am sure you can design it by yourself.

I hope that this introduction was not too complicated and confusing, so if there are more questions, please let me know.

Oliver

493  Using Arduino / Programming Questions / Re: GLCD menu help...... please on: June 16, 2012, 11:03:13 am
Quote
code to make it scroll between the headers
Regarding M2tklib i probably would need a more detailed specification on what you excatly intend todo.
I tried to read your code, but i was not able to derive what menus you need.

However, i noticed, that you include keypad, which is not supported by M2tklib at the moment  smiley-sad

Instead M2tklib assumes two to six buttons directly attached to the Arduino Board.

Oliver
494  Using Arduino / Programming Questions / Re: GLCD menu help...... please on: June 16, 2012, 04:00:35 am
Quote
I thought I downloaded glcd v 3 and was using it??
M2tklib is an addon to GLCDv3.
You need both, GLCDv3 and M2tklib. M2tklib has a lot of examples and tutorials to build menus.

Oliver
495  International / Deutsch / Re: Nokia 3310 Display - Keine Ausgabe, kein gar nix on: June 16, 2012, 12:14:34 am
Hi

Ich hab die Beschaltung des Displays von dieser Seite: http://www.module.ro/nokia_3510.html
Die Pin Nummern sind aber dort anders angegeben. Insofern würde es mich nicht wundern, wenn
es bei Dir nicht funktioniert.

Ausserdem ist mir aufgefallen, dass in dem Code der Resetimpuls recht kurz ist. Das Display
braucht einen recht langen reset Impuls.

Oliver


Pages: 1 ... 31 32 [33] 34 35 ... 56