The SSD1306 OLED display library can be downloaded from the link below:
C file named SSD306OLED.C which can be installed by adding it to project folder or CCS C compiler drivers folder (for example: C:\Program Files\CCS\Drivers)
This small SSD1306 OLED driver and graphics library allows us to print texts, draw lines, circles and many other function (listed below). The DC pin (same as D/C) of the SSD1306 OLED display is connected to +VCC which means the I2C slave address of the device is: 0x7A. There are 3 wires connected between the two devices: RESET, SDA and SCL. The PIC microcontroller as well as SSD1306 OLED display are supplied with 5V or 3.3V depending on the microcontroller operating voltage. General circuit schematic diagram of the MCU and the display is shown by the image below, it shows an example for a display of 128×64 Pixel. The default address of the SSD1306 OLED is 0x7A or 0x78 depending on connection of pin D/C (data/command) which acts as a slave address bit (SA0) in I2C mode, if this pin is connected to +VCC the address is 0x7A and if it is connected to the ground the address becomes 0x78. It does not matter if the microcontroller has a hardware I2C module or not because the CCS C compiler can use software I2C instead of it.Īs any I2C device, the SSD1306 OLED display has an I2C address, this address is used by the microcontroller (master) to start talking to the display (slave). The I2C bus uses two lines SDA and SCL, an other line is connected between the MCU and the display which is used as a hardware reset line, this line is optional because some displays come with no reset pin. With this driver the SSD1306 OLED display communicates with the PIC microcontroller over I2C protocol which needs two data lines: SDA (serial data) and SCL (serial clock), an additional reset pin can be used between the microcontroller and the display (optional), some SSD1306 OLED displays does not have the reset pin.Ĭonnecting the SSD1306 OLED with PIC microcontroller:Īs mentioned above, the microcontroller uses I2C protocol to send and receive data to and from the SSD1306 OLED display. The library is based on Adafruit SSD1306 OLED driver and Adafruit graphics library. The driver is for I2C mode only, normally it supports three types: 128×64, 128×32 and 96×16.
This topic shows how to use the SSD1306 OLED driver (& library) for CCS C compiler and how to connect it with Microchip PIC microcontroller.
The SSD1306 OLED display contains a driver chip with the same name ( SSD1306), it can communicate with the master device (microcontroller, microprocessor …) over I2C protocol, SPI protocol or 8-bit parallel protocol.