MSP430 G2553 hardware IIC OLED single chip OLED scrolling display

effect:

Insert picture description here
Insert picture description here

Summary:
(1)
Unusable source code on the Internet; (2) SSD1306 address is 0X3C, 7-bit address mode.
(3) The G2553 manual is indeed very good.
(4) SSD1306 write command sequence: start signal -> wait for UCB0TXIFG -> write 0X3C address -> wait for UCB0TXIFG -> write 0X00 control word -> wait for UCB0TXIFG -> write command character -> wait for UCB0TXIFG -> send stop signal.
(5) SSD1306 write data sequence: start signal -> wait for UCB0TXIFG -> write 0X3C address -> wait for UCB0TXIFG -> write 0X40 control word -> wait for UCB0TXIFG -> write data characters -> wait for UCB0TXIFG -> send stop signal.
(6) The USCI module supports different things:
Insert picture description here

Details of IIC communication:
(1) It is a 7-bit address, the last one means read and write, and 0 is the master writes to the slave. Many device addresses have to be considered. This is very different from the software IIC.
Insert picture description here
(2) The data line can redefine the direction of the data flow without a stop signal. Only need to re-send the start signal in the middle, and then give the last bit of the address R/W to determine, the data can flow in any direction. Stop signal after finishing.
Insert picture description here
(3) IIC operation modes are divided into four types: slave sender role, slave receiver role, master sender role, and master receiver role.
In the figure below, UCA10 Own addressing mode select determines whether a 7-bit address or a 10-bit address is selected. UCMST Master decides whether it is a slave or a master. UCMODEx to 11 is IIC mode.
Insert picture description here
In the figure below, UCTR determines the sender or receiver.
Insert picture description here
(4) Internet programs all use interrupts. The advantage is that interrupt processing is conducive to the robustness of the program, but the disadvantage is that it looks a little jumpy, and each has its own advantages.
(5) IIC said that it can achieve 100K HZ clock, but it is also good to make PCB, and the wiring is thick + short, it is best to add a 1K pull-up resistor. The DuPont cable I used for this experiment was made by the DuPont cable. When the clock is high, there will be no response.
(6)
Scroll
http://www.51hei.com/bbs/dpj-180145-1.html
scroll to the right

#include <msp430.h>
#include "oled.h"
#include "bmp.h"
//                  MSP430G2xx3
//                 -----------------
//OLED  |   |   --|RST          XOUT|-
//---   |   |     |                 |
//SDA|<-|---+---->|P1.7/UCB0SDA     |
//   |  |         |                 |
//   |  |         |                 |
//SCL|<-+---------|P1.6/UCB0SCL     |
//   |            |                 |

int main(void)
{
    
    

    WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

    OLED_Init();
    delay_ms(100);
    OLED_DrawBMP(0, 0, 128, 64, BMP1);


    OLED_WrCmd(0x2e);//停止滚动
    OLED_WrCmd(0x26);//0x26向右 0x27向左
    OLED_WrCmd(0x00);//虚拟字节
    OLED_WrCmd(0x00);//起始页
    OLED_WrCmd(0x07);//速度
    OLED_WrCmd(0x07);//中止页
    OLED_WrCmd(0x00);//虚拟字节
    OLED_WrCmd(0xff);//虚拟字节
    OLED_WrCmd(0x2f);//开启滚动

    while (1)
    {
    
    


    }
}

(7) Control pixel display. unsigned char OLED_GRAM[128][8];The memory of G2553 is paralyzed, which needs to be realized by other microcontrollers, such as MSP430F5529. It seems that you can also rely on reading the data in SSD1302, but only 8080 interface or 6800 interface, see the figure below for details, there are R/W options.
The communication method of SSD1306 depends on the hardware selection:
Insert picture description here

Guess you like

Origin blog.csdn.net/x1131230123/article/details/108686377