Show Posts
Pages: 1 ... 50 51 [52] 53 54 ... 97
766  Using Arduino / Displays / Re: I2C 0.91" 128x32 Monochrome OLED display module on: March 02, 2013, 12:56:15 pm
This might work, but it has not been tested with your display.

Code:
#include "U8glib.h"

U8GLIB_SSD1306_128X32 u8g();

void draw(void) {
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {
}

void loop(void) {
  u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() );
 
  // rebuild the picture after some delay
  delay(500);
}

Oliver

EDIT: Fixed constructor call.
767  Using Arduino / Displays / Re: I2C 0.91" 128x32 Monochrome OLED display module on: March 02, 2013, 11:34:45 am
1. Locate SDA and SCL pins for your board: http://www.arduino.cc/en/Reference/Wire
2. Locate SDA and SCL pins for your display (see ebay link)
3. Connect display with board
4. Find and install a library which supports the SSD1306 OLED (u8glib might work)

Oliver
768  Using Arduino / Displays / Re: U8glib: Graphics Lib for LCDs and OLEDs on: March 02, 2013, 11:18:08 am
Hi

Can you provide a link to the display? This would help a lot.

In general displays with SPI interface are usually connected like this:




Oliver
769  Using Arduino / Displays / Re: U8GLIB and bitmap creation/display on: March 02, 2013, 09:32:04 am
You could try PROGMEM instead of U8G_PROGMEM.

Methods to move data from RAM to FLASHROM do not work that well with the g++ compiler (the one used by Arduino IDE).
Additionally behavior has changed during versions of g++.
U8G_PROGMEM is a little bit different to PROGMEM and was optimized for the gcc compiler. Maybe this has caused the problem.

Oliver


770  Using Arduino / Displays / Re: U8GLIB and bitmap creation/display on: March 01, 2013, 02:10:48 pm
Hi

Here is the procedure, which was successful at least for me:

1. Load your picture into gimp
2. Convert it into a indexed bitmap, 2 levels, black & white, maybe use dithering
3. Export as XBM (.xbm extension)

Result will be something like this. Copy the content of the .xbm file into your .ino file:
Code:
#define u8g_logo_width 38
#define u8g_logo_height 24
static unsigned char u8g_logo_bits[] = {
   0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xe0,
   0xff, 0xff, 0x3f, 0xe3, 0xe1, 0xff, 0xff, 0x3f, 0xf3, 0xf1, 0xff, 0xff,
   0x3f, 0xf3, 0xf1, 0xfe, 0xbf, 0x37, 0xf3, 0x11, 0x1c, 0x1f, 0x30, 0xf3,
   0x01, 0x08, 0x8c, 0x20, 0xf3, 0x01, 0x00, 0xc0, 0x39, 0xf3, 0x81, 0xc7,
   0xc1, 0x39, 0xf3, 0xc1, 0xc7, 0xc9, 0x38, 0xf3, 0xc1, 0xc3, 0x19, 0x3c,
   0xe3, 0x89, 0x01, 0x98, 0x3f, 0xc7, 0x18, 0x00, 0x08, 0x3e, 0x0f, 0x3c,
   0x70, 0x1c, 0x30, 0x3f, 0xff, 0xfc, 0x87, 0x31, 0xff, 0xff, 0xbf, 0xc7,
   0x23, 0x01, 0x00, 0x00, 0xc6, 0x23, 0x03, 0x00, 0x00, 0x0e, 0x30, 0xff,
   0xff, 0x3f, 0x1f, 0x3c, 0xff, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0xff, 0x3f,
   0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f };

4. Add the PROGMEM statement to move the picture into flash rom:

Code:
#define u8g_logo_width 38
#define u8g_logo_height 24
static unsigned char u8g_logo_bits[] U8G_PROGMEM = {
   0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xe0,
   0xff, 0xff, 0x3f, 0xe3, 0xe1, 0xff, 0xff, 0x3f, 0xf3, 0xf1, 0xff, 0xff,
   0x3f, 0xf3, 0xf1, 0xfe, 0xbf, 0x37, 0xf3, 0x11, 0x1c, 0x1f, 0x30, 0xf3,
   0x01, 0x08, 0x8c, 0x20, 0xf3, 0x01, 0x00, 0xc0, 0x39, 0xf3, 0x81, 0xc7,
   0xc1, 0x39, 0xf3, 0xc1, 0xc7, 0xc9, 0x38, 0xf3, 0xc1, 0xc3, 0x19, 0x3c,
   0xe3, 0x89, 0x01, 0x98, 0x3f, 0xc7, 0x18, 0x00, 0x08, 0x3e, 0x0f, 0x3c,
   0x70, 0x1c, 0x30, 0x3f, 0xff, 0xfc, 0x87, 0x31, 0xff, 0xff, 0xbf, 0xc7,
   0x23, 0x01, 0x00, 0x00, 0xc6, 0x23, 0x03, 0x00, 0x00, 0x0e, 0x30, 0xff,
   0xff, 0x3f, 0x1f, 0x3c, 0xff, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0xff, 0x3f,
   0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f };

5. Then use the following code:
Code:
u8g.drawXBMP( 0, 0, u8g_logo_width, u8g_logo_height, u8g_logo_bits);

Oliver
771  Using Arduino / Programming Questions / Re: Menu for Display on: March 01, 2013, 01:58:48 pm
If i understand you correctly, then your question is, how to save memory?

Regarding m2tklib, here are some ideas:

- Format string
  * use NULL instead of ""
  * reuse format strings:
     instead of M2_ALIGN(top_el_sisu_m1, "W64H64", &el_sisu_grid_m1);
     do this:
Code:
char fmt_W64H64[] = "W64H64";
M2_ALIGN(top_el_sisu_m1, fmt_W64H64, &el_sisu_grid_m1);
 
     reuse the format string as often as possible
- Reuse elements: Once you have definde a BUTTON, you can reuse the button everywhere
  See also here: http://code.google.com/p/m2tklib/issues/detail?id=89
- Limit the number of different elements.

Maybe this gives some ideas. Please note, that a graphics library, such as u8glib will probably require more space than a LiquidCrystal

Oliver
 
772  Using Arduino / Programming Questions / Re: Menu for Display on: February 27, 2013, 01:57:55 pm
3v3 displays not only require 3v3 power supply, but also need logic levels, that do not exceed 3v3.
This means, you need a level translation on each communication pin

Oliver
773  Using Arduino / Programming Questions / Re: Menu for Display on: February 26, 2013, 12:15:13 pm
Which display? Well i like graphics displays. ST7565 based display are usually a good choice, because you can use 4 wire SPI. Unfortunately they can not be connected directly to a 5V board like the Arduino Uno or Mega (level translation needed).

Oliver

774  Using Arduino / Displays / Re: u8glib 1.11 function SleepOn don't work. on: February 24, 2013, 03:17:18 pm
Release 1.11 is not yet out. But I have just put another prerelease on the download page.
Let me know if the sleep function works. I added it some hours ago.

Oliver
775  Using Arduino / Programming Questions / Re: Menu for Display on: February 24, 2013, 02:52:02 am
Hi

We are leaving the area of menu programming, my knowledge is not that good here, but i do my best to answer this question.

Quote
a) .text: is said the Software Code without Variable (function, case, loop,setup, cicles etc etc) - Maximum
     size - 32.000 byte
Flash-ROM is the code size including variables which have none-zero init values.
.text is the value for the the pure code


Quote
b) .data: is said the space for variable (SRAM) that the maximum size is ?
.data is the size of the variables which have none-zero default value such as "int x = 4;"
This value counts against flash-rom AND ram (SRAM) area size.

Quote
c) .bss: is said the space for variable (SRAM) that the maximum size is ?
This is the size of those variables, which have a zero default value, such as "int y = 0;"

The stack size is not listed here, because it grows during runtime.
Conclusion for overall memory consumption:
Flash-Rom = .text + .data
SRAM = .data + .bss + stack

Quote
SRAM for Atmega328 is 2000 bytes --> correct ?
Well yes, the datasheet will be a more reliable source, but if i remember correctly then it is 2048.

Quote
Flash-ROM(PROGMEM) size = text + bss = 27502 + 698 = 28.200 bytes must be < 2^15 = 28.200 < 32.000 --> it's ok
You took the right numbers, but your text is wrong: "size = text + data"

Quote
Required SRAM: (.data + .bss + stack) < 2048 = 698 + 1078 + 200 =   1976 < 2048 --> I'm at the limit of Ram used.
Yes, i think so too. Especially i do not know if stack needs 100, 200 or 300 bytes.
If you need a precise answer, you will need tools like this: http://www.absint.com/stackanalyzer/index.htm

You can also do a runtime analysis by your own. I found the following threads also:

This is a nice idea for fully automatic runtime calculation:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=52249

This also has several links and lot of information:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=78518

Have fun,
Oliver











776  Using Arduino / Displays / Re: Small monochrome display? on: February 23, 2013, 06:33:03 pm

The DOGM128 and DOGL128 could be an option:
http://www.lcd-module.com/products/dog.html
Variants, which are readable without backlight should be fine for sunlight:

What does high frame rate mean? About 4 FPS are possible with U8glib.

Oliver
777  Using Arduino / Programming Questions / Re: Menu for Display on: February 23, 2013, 01:34:07 pm
Hi

text    data     bss     dec     hex filename
27502      698     1078    29278    1da5 spacetrash.elf

Flash-ROM (PROGMEM) size: 27502 + 698 : This must be lower than 2^15
Required RAM: 698 + 1078 + stack : This must be lower than 2048

The problem is the required stack size. It can not be calculated, but i guess it is around 200 Bytes or more.

Oliver
778  Using Arduino / Programming Questions / Re: Menu for Display on: February 23, 2013, 10:23:07 am
Hi

avr-size should be part of the Arduino Distribution:
./hardware/tools/avr/bin/avr-size

Oliver
779  Using Arduino / Programming Questions / Re: Menu for Display on: February 23, 2013, 05:51:49 am
Hi

You can not change the prototype for the callback procedure. So, you can not pass additional arguments. You need to use global variables.

Sure, this is not a good programming style...

Oliver
780  Products / Arduino Due / Re: Are pins forced to LOW after constructor calls? on: February 22, 2013, 06:14:38 pm
hmmm... I never had seen this relationship. Thanks for clarification. Karma+

Oliver
Pages: 1 ... 50 51 [52] 53 54 ... 97