Citat:
jozimir:
Verujem da će ovaj izvod iz datasheet kontrolera malo pomoći i razjasniti stvari.
The sequence is initiated with a START condition (S) from the I2C Interface master, which is followed by the slave address.
.....
After acknowledgement, one or more command words follow which define the status of the addressed slaves.
A command word consists of a control byte, which defines Co and RS, plus a data byte.
The last control byte is tagged with a cleared most significant bit (i.e. the continuation bit Co).
After a control byte with a cleared Co bit, only data bytes will follow.
The state of the RS bit defines whether the data byte is interpreted as a command or as RAM data.
Mislim da je ovo sporno:
Code:
.
.
.
}
i da bi trebalo da stoji ovako:
Code:
void setup ()
{
lcd.init ();
//lcd.setContrast(0);
Wire.begin(); // Initialise I2C communication as MASTER
Wire.beginTransmission(0x78); // Start I2C Transmission
Wire.write ( 0b11011100 ); // ICON disp on, Booster on, Contrast high byte (2)
Wire.write ( 0b11101000 ); // Follower circuit internal ON, Amplifier follower ratio
Wire.write ( 0b01110000 ); // Contrast low byte (6)
Wire.endTransmission();
}
Dobro jutro i hvala na korisnoj sugestiji (Scepo, ne mislim na tebe :-P )
Nazalost, ni ovo nije pokazalo neki vidljiv efekat. Evo testiranog koda. Ubacena je i linija koja je trebalo da ugasi displej ali bez efekta.
Code:
#include <Arduino.h>
#include "ST7036.h"
#include <Wire.h>
ST7036 lcd = ST7036 ( 2, 20, 0x78 ); //adresa displeja je 0x78
void setup ()
{
lcd.init ();
//lcd.setContrast(0);
Wire.begin(); // Initialise I2C communication as MASTER
Wire.beginTransmission(0x78); // Start I2C Transmission
Wire.write ( 0b11011100 ); // ICON disp on, Booster on, Contrast high byte (2)
Wire.write ( 0b11011100 ); // ICON disp on, Booster on, Contrast high byte (2)
Wire.write ( 0b11101000 ); // Follower circuit internal ON, Amplifier follower ratio
Wire.write ( 0b10001000 ); // Display off **************************************
Wire.write ( 0b01110000 ); // Contrast low byte (6)
Wire.endTransmission();
}
void loop ()
{
lcd.print ("8");
Serial.print ("A");
delay(500);
}
Probacu, kad stignem, da usnifam ziv saobracaj i vidim sta se desava kod lcd.init komande, i sta displej detektuje kao validnu komandu, posto ovde ocigledno ignorise ovo sto je dodato... Sudeci prema ST7036.cpp, inicijalizacija se ne razlikuje mnogo od onog sto sam/smo dodali, osim u ovim Func_set_tbl0/1 upisima.
Code:
const uint8_t FUNC_SET_TBL0 = 0x38; // Function set - 8 bit, 2 line display 5x8, inst table 0
const uint8_t FUNC_SET_TBL1 = 0x39; // Function set - 8 bit, 2 line display 5x8, inst table 1
Code:
void ST7036::init ()
{
size_t retVal;
// Initialise the Wire library.
Wire.begin();
Wire.beginTransmission ( _i2cAddress );
Wire.write ( (byte)0x0 ); // Send command to the display
Wire.write ( FUNC_SET_TBL0 );
delay (10);
Wire.write ( FUNC_SET_TBL1 );
delay (10);
Wire.write ( 0x14 ); // Set BIAS - 1/5
Wire.write ( 0x73 ); // Set contrast low byte
Wire.write ( 0x5E ); // ICON disp on, Booster on, Contrast high byte
Wire.write ( 0x6D ); // Follower circuit (internal), amp ratio (6)
Wire.write ( 0x0C ); // Display on
Wire.write ( 0x01 ); // Clear display
Wire.write ( 0x06 ); // Entry mode set - increment
_status = Wire.endTransmission ();
if ( _status == 0 )
{
_initialised = true;
}
}
Ono sto primecujem je da je, npr kod komande (a i kod svih ostalih)
Code:
Wire.write ( 0x6D ); // Follower circuit (internal), amp ratio (6)
MSB bit i dalje 0, a ne jedinica, kako ste sugerisali. (0b
01101101)
U svakom slucaju, hvala za ulozeni trud i dobru volju.
[Ovu poruku je menjao DSL dana 31.08.2020. u 07:59 GMT+1]