code-AR 发表于 2014-3-8 23:50:19

本帖最后由 code-AR 于 2014-3-9 00:46 编辑

shihaipeng04 发表于 2014-3-8 16:55 static/image/common/back.gif
有点神奇,覆盖了原来的库,编译新的文件,屏幕啥也木有了。。回复了原来的库,编译旧文件到是还能显示。 ...

可能是例子文件有些问题吧,我再看看。应该不会弄错文件上来了吧?(已更新)

shihaipeng04 发表于 2014-3-9 01:01:26

本帖最后由 shihaipeng04 于 2014-3-9 01:03 编辑

code-AR 发表于 2014-3-8 23:50 static/image/common/back.gif
可能是例子文件有些问题吧,我再看看。应该不会弄错文件上来了吧?(已更新)

噢耶,一切正常。 大字体很漂亮。一会研究研究程序。

看来是过了研究代码的年纪了,看了看,两眼发花,开始打架。拿来主义害死我啊。哈哈

shihaipeng04 发表于 2014-3-9 01:29:03

code-AR 发表于 2014-3-8 23:50 static/image/common/back.gif
可能是例子文件有些问题吧,我再看看。应该不会弄错文件上来了吧?(已更新)

呵呵,又出问题了。 可能是原来程序的根基不太好,要显示的内容,必须以常量的形式做参数。

新程序里如果连续2句 luck。print,第2句显示就乱码了。必须要在第2个print之前再setFont一下才行。

如果想显示变量好像还需要很头疼的改。{:soso_e134:}

Super169 发表于 2014-3-9 02:52:55

已經忍唔住訂了, 一大一細 (0.96雙色 + 1.3白色), 賣家要星期一才發貨, ... 相信要下個周末才到手 (我是經集運再送來).希望到時大家已把問題解決好.

真的不好意思, 有點坐收漁人之利的感覺:$

shihaipeng04 发表于 2014-3-9 04:39:57

code-AR 发表于 2014-3-8 23:50 static/image/common/back.gif
可能是例子文件有些问题吧,我再看看。应该不会弄错文件上来了吧?(已更新)

仔细研究一下,很奇怪,这东西说是iic的链接方式。可是又没有用到wire的库,我一直当iic用的,接的a4 a5,后来发现接到哪里都行。 点亮屏幕上一个点,需要写不少数据过去,所以造成刷新比较慢的问题。 隐约感觉那个占用更多pin的可能刷新会快些。

现在能让屏幕出现雪花了。而且他是从屏幕的左下脚,竖着排列的,很是绕呼人。 睡觉,明天继续。

code-AR 发表于 2014-3-9 11:39:12

shihaipeng04 发表于 2014-3-9 04:39 static/image/common/back.gif
仔细研究一下,很奇怪,这东西说是iic的链接方式。可是又没有用到wire的库,我一直当iic用的,接的a4 a5, ...

我们买的不是标准的iic,只能是软法实现。我改这个库只是基础版,还有些问题。我会继续完善的。

hi55234 发表于 2014-3-9 12:12:26

shihaipeng04 发表于 2014-3-9 04:39 static/image/common/back.gif
仔细研究一下,很奇怪,这东西说是iic的链接方式。可是又没有用到wire的库,我一直当iic用的,接的a4 a5, ...

这个是易趣上产品的介绍:

Note: This item come I2C/IIC interface only.

Because the hardware reasons, resulting IIC/I2C bus no ACK response signal , so IIC IIC communication Whitby automated production of OLED modules instead of the standard version . But this can be solved by software ...... published here for the Arduino library file , you can make this OLED module used in the Arduino system.


Download: http://dl.vmall.com/c0w44zd7r9


File description :

IIC_without_ACK.cpp - SSD1306 drivers ;
IIC_without_ACK.h - SSD1306 driver file header ;
oledfont.c - matrix table ( you need to display the contents of the matrix can be calculated by taking the modulus of software after adding this file , modulo the way " common cathode - out line - Reverse Output" ; font will take up a lot of space FLASH , please comment out the unwanted font , so there will be enough space Arduino tips ) .

Function:
Write_IIC_Byte (unsigned char IIC_Byte); / / by IIC write an 8-bit data ( such as 0xff)
Write_IIC_Command (unsigned char IIC_Command); / / write command to the OLED module through IIC bus
Begin_IIC_Data (); / / write data through the IIC bus open ready ( which would allow a group of data transmission is complete and then turn off IIC, can greatly speed )
IIC_SetPos (unsigned char x, unsigned char y); / / Set the starting point coordinates (x range 0 ~ 128, y ranges from 0 to 7 )
Fill_Screen (unsigned char fill_Data); / / Fill_Screen (0xff) - Full screen lit ; Fill_Screen (0 × 00) - Full screen off ( can be used to clear the screen )
Char_F6x8 (unsigned char x, unsigned char y, const char ch []); / / display the ASCII character 6 × 8
Char_F8x16 (unsigned char x, unsigned char y, const char ch []) ;/ / display the ASCII character 8 × 16
CN_F16x16 (unsigned char x, unsigned char y, unsigned char N); / / display of 16 × 16 characters ( this can be considered for the first time on the Arduino platform to achieve the display of Chinese characters )
Draw_BMP (unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, const char BMP []); / / display BMP images of 128 × 64
The other functions is functional function.

Usage:
Please "IIC_without_ACK" folder to x: \ arduino-1.5.5 \ libraries directory , restart the Arduino IDE;
Demo_IIC is based on the Arduino UNO sample program ...... correct wiring and run.

shihaipeng04 发表于 2014-3-9 12:33:40

code-AR 发表于 2014-3-9 11:39 static/image/common/back.gif
我们买的不是标准的iic,只能是软法实现。我改这个库只是基础版,还有些问题。我会继续完善的。

原来如比啊。目前来看,显示慢了点,其他的到是还好。偶尔也有没反应的情况,需要改程序,重新编译。

shihaipeng04 发表于 2014-3-9 12:40:23

hi55234 发表于 2014-3-9 12:12 static/image/common/back.gif
这个是易趣上产品的介绍:

Note: This item come I2C/IIC interface only.


好似是21楼说的情况,都是用软件实现的,所以比较繁琐,而且速度也比较慢。

swim 发表于 2014-3-10 22:36:25

还是用U8GLIB的库好用

Super169 发表于 2014-3-15 01:42:31

本帖最后由 Super169 于 2014-3-15 01:56 编辑

code-AR 发表于 2014-3-7 18:10 static/image/common/back.gif
改了些的库。

非常好用, 比原來的方便很多.感謝分享.
但有個奇怪問題, 如單獨使用 font8x16, 可正常顯示一行.
但當 font8x16 配合其他 font 一同使用時, 畫面就出現不正常.
單獨用 font8x16, 顯示多過一行也會有花了.

例子中並沒有用到 font8x16, 是否這個 font 有問題呢?
因為要顯示大細的英文字, 所以需要用到 font8x16 及 font6x8, 是否加上extern uint8_t font8x16[];    使用時再 lucky.setFont(font8x16); 就可以呢?

Super169 发表于 2014-3-15 03:35:00

本帖最后由 Super169 于 2014-3-15 03:40 编辑

改用 Mega 就可以用 font8x16 了, 之前用 UNO 應該是記憶體不足.

不過, 大大的 IIC_without_ACK.cpp 中, IIC_without_ACK::print, 結尾的 cfont.font=0; 好像有點問題.
把字型設定清除了, 同時印兩行 8x16 的話, 第二句沒設定 font 就會有問題,我把這個 comment 了就回復正常了.

請問大大呢句是否有特別的意思?是否希望每次 print 之前都要再 setfont 呢?

shihaipeng04 发表于 2014-3-15 03:56:59

本帖最后由 shihaipeng04 于 2014-3-15 04:07 编辑

Super169 发表于 2014-3-15 03:35 static/image/common/back.gif
改用 Mega 就可以用 font8x16 了, 之前用 UNO 應該是記憶體不足.

不過, 大大的 IIC_without_ACK.cpp 中, ...

我也发现花屏的问题了,因为我是内存不够了,2种字体(尤其是小字体字符集比较大,内容多)很容易就崩溃了。 我也给改了一下,可以用变量直接输出了。 今天刚弄好的,结果显示正常了,我的mirco板子又完蛋了。按说不应该是程序把硬件给弄坏了。可的确是在上传程序后他就再也不开机了。 不过用UNO到是一直正常的说。

#include <TheOled.h>

extern uint8_tfontBigNum[];
extern uint8_tfontNum[];
extern uint8_t font6x8[];
extern uint8_tfont8x16[];

#define OLED_SDA 8
#define OLED_SCL 9

TheOled lpc(OLED_SDA,OLED_SCL);

void setup()
{
lpc.OLED_Initial();
lpc.Clr();
delay(10);
}

void loop()
{

long c=0;
char str[]="2468";
lpc.Clr();
lpc.setFont(fontNum);
lpc.print(0,0,str);
lpc.setFont(fontBigNum);
lpc.print(CENTER,3,"12356");
delay(2000);
lpc.Clr();
lpc.setFont(font6x8);
lpc.print(0,0,"abcdefg");
lpc.setFont(fontBigNum);
lpc.print(0,6,"123456");
delay(2000);
lpc.Clr();
while(1)
{
   c++;
   lpc.print(0,3,c);
}
}



还没有完全写完,图像什么的,还都没有弄呢。

Super169 发表于 2014-3-15 23:16:59

很奇怪, 雖然 font8x16 有 4 + 16 x 94 = 1508 bytes, 超過了 UNO 內 SRAM 的 1K 容量.
但 font file 中已加上了 PROGMEM, 應該是可以搬到 flash 中.
做了個非常細小的 sketch, 32K 的 flash memory 肯定足夠有餘 (應該 5K 也足夠了), 但只要一接觸 font8x16 就花了.難道 PROGMEM 並沒有把資料搬到 flash memory ?

Super169 发表于 2014-3-15 23:35:04

把 font8x16 刪去大部份, 只餘下最前 11 個 characters (即 最後為"*"), 是可以在 UNO 上行了 (當然, 只可以用這11個字), 再多一個字也會有問題.
看來, PROGMEM 並未成功把 font 資料搬到 flash.
嘗試在 ino 內定義, 再大的也可以用, 可能是 庫內的資料, 不可以放到 flash 中.....
但如果在 ino 內定義 font, 好像不能送到庫內, setfont 不能指到 ino 內的 fonts.
這真是一個非常頭痛問題, OLED 不帶字庫, 只用 SRAM 的話, 只有 1K, 還有其他 variable 共用, 真的太小了.

希望有朋友可以把字庫搬上 flash.
页: 1 [2] 3
查看完整版本: 搞了2个oled的小屏幕玩玩