Jump to content
ELFORUM - Forumul electronistilor
Sign in to follow this  
MARLANU

Inlocuire display oled SPI Bus cu I2C

Recommended Posts

Guest cobru

DIn cate vad, codul ala foloseste u8glib pentru afisaj, deci linia asta trebuie inlocuita:

U8GLIB_SH1106_128X64 u8g(3, 4, 7, 6 , 5); // SW SPI Com: CLK = 3, MOSI = 4, CS = 7, dc = 6, RES = 5

Din pacate nu ai spus modelul exact de display pe care il ai, aici ai ce suporta libraria (s-ar putea sa nu fie suportat al tau): https://github.com/olikraus/u8glib/wiki/device

Share this post


Link to post
Share on other sites

As dori sa,l inlocuiesc cu display-ul din imaginea atasata,doar modelul acesta il gasesc pe site-urile de vanzari din tara/

 

http://postimg.org/image/p628cifgj/

 

Description:Size: 0.96Resolution: 128X64Color: BlueViewing angle: greater than 160 degreesSupported platforms: for arduino, 51 series, MSP430 series, STIM32 / 2, SCR chipsLow power consumption: 0.04W during normal operationSupport wide voltage: 3.3V-5V DCWorking temperature: -30-80 degreesVolume: 27MM * 27MM * 4.1MMDriver IC: SSD1306Communication: IIC, only two I / O portsNo font: The software takes word moduloBacklight: OLED self light, no backlightInterface:4-pinsVCC: 3.3-5VGND: GroundSCL: Serial ClockSDA: Serial Data

Share this post


Link to post
Share on other sites

Foloseste libraria aferenta (vezi atasament).

In folderul "Examples" gasesti sketch-ul "Hello world" unde indepartezi // la linia:

U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);	// I2C / TWI 

si verifici functionarea afisorului. Restul tine de tine ce si cum vrei sa-ti faci aplicatia dorita.

In sketch-ul postat de tine inlocuiesti:

U8GLIB_SH1106_128X64 u8g(3, 4, 7, 6 , 5); // SW SPI Com: CLK = 3, MOSI = 4, CS = 7, dc = 6, RES = 5

cu linia de mai sus.

U8glib.zip

Share this post


Link to post
Share on other sites

Din pacate nu mai gasesc in tara nici acet model de display.

As putea adapta acest display?

1.8" 128X160 SPI TFT LCD ST7735S
 SPI serial, less I/O port need
Controller: ST7735S
pcb adapter for lcd
one sd card socket
can be driverd by 8051 / AVR / PIC /ARM/STM32 ....
Resolution: QVGA 128*160 Dots

Share this post


Link to post
Share on other sites

In cele din urma am gasit un display de 1.8 128x160 SPI,acum am probleme cu modificarea codului pentru display-u

1.8" 128X160 SPI TFT LCD ST7735S 

,imi da urmatoarele erori:

 

sketch_may12a:33: error: 'Adafruit_ST7735_18x128x160_SWSPI' does not name a type

 Adafruit_ST7735_18x128x160_SWSPI Adafruit_GFX(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);

C:UsersYO2MOPDesktopsketch_may12asketch_may12a.ino: In function 'void setup()':

sketch_may12a:137: error: 'u8g' was not declared in this scope

  u8g.firstPage()

sketch_may12a:140: error: 'u8g_font_unifont' was not declared in this scop

   u8g.setFont(u8g_font_unifont);

sketch_may12a:152: error: 'u8g_font_7x13' was not declared in this scop

u8g.setFont(u8g_font_7x13)

sk.txt

Edited by MARLANU

Share this post


Link to post
Share on other sites

Excelenta este normal sa ai erorile astea. Ai amestecat doua librarii (u8g cu Adafruit). Daca renunti la una dintre ele (de preferat u8g) nu vei mai avea probleme.

Share this post


Link to post
Share on other sites

Multumesc pentru raspuns nico.

Am modificat codu pentru  ucglib acum imi da :error: 'Ucg' was not declared in this scope

SK.txt

Edited by MARLANU

Share this post


Link to post
Share on other sites
Guest

Iti lipseste libraria Ucg asa cum si nico_2010 te-a indrumat sa o folosesti pe cea din postul #7.

 

 

 pe care trebuie sa o download-ezi de aici https://github.com/olikraus/ucglib .

Uitate atent pe pagina, ca vei mai gasi si alte documnete la adresa github wiki .

Edited by Guest

Share this post


Link to post
Share on other sites

Libraria UCG  este instalata,daca nu era buna nu functiona codul cu care am testat display-ul

 

Posted Image

Share this post


Link to post
Share on other sites

Multumesc pentru raspuns nico.

Am modificat codu pentru  ucglib acum imi da :error: 'Ucg' was not declared in this scope

La mine codul din fisierul SK.txt se compileaza fara probleme (dupa ce am instalat biblioteca mentionata de va_cristi)

 

M-am grabit, mai testez.

OK, Ucg not declared e din cauza ca la declararea lui Ucg l-ai scris cu u mic si mai departe l-ai folosit cu U MARE. Trebuie sa fie:

Ucglib_ST7735_18x128x160_SWSPI Ucg(/*sclk=*/ 10, /*data=*/ 11, /*cd=*/ 6 , /*cs=*/ 5, /*reset=*/ 4);

Da' tot nu se compileaza nici asa:

-	 Ucg.firstPage(); 

nu exista. Am comentat cele 3-4 apeluri si trece mai departe pana la fonturile unicode care nici ele nu exista.

'Ucg_font_unifont' was not declared in this scope

moment in care am renuntat. Sorry.

Edited by Liviu M

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines