-
The 1602 can be operated in direct control mode or buffered operation mode (bus mode). Of course, this is not to say what method you can choose for 1602 programming. 1602 timing is like that, the main direct control method is to hang the 1602 data line on the single-chip microcomputer, and then control (en, rs, rw) is also controlled by three single-chip microcomputer port lines, and then read and write according to the timing of 1602, most of the Internet is this way.
But the better way is the buffering mode, that is, the data line of 1602 is connected with the P0 port of the single-chip microcomputer with 245 isolation, and then the control (EN, RS, RW) line is connected to the chip selection and address line generated by the single-chip microcomputer (such as the three lines of P2 can be controlled, but the P2 here is used as the address line, which can be reused.) Therefore, the buffering method is actually to use P0 as a data port and P2 as an address port, so that the port line is not monopolized, which obviously saves the port line of the single-chip microcomputer. According to what you mentioned and used, it is obvious that you are considering the exclusive way of LCD hanging P1 port, which is not worth it.
The following ** is a screenshot of my circuit diagram for you.,A little bit of electronic foundation can understand it.,A0、A1,Of course, it's P0 through the latch 373 out of the address or you can change it to.,That CS11 is casual.,You use 138 or something to generate.,If your system is copied, it must be used.,Simple systems are used.。 The program is very simple.,Address reading and writing.,If it's not clear, ask me.。
-
MSP430 is rarely used, but I can tell you a way, if you think the pins are not enough, it's actually very simple, add a decoding circuit to the circuit and it's completely done...
-
I've used it for a long time, and I've used it to drive 1602, you can connect it however you want, it's OK according to the 1602 pin definition, but it's best to add a driver, because 430 is generally 1602 for 5V,
-
MSP430 is a single-chip microcomputer for power supply, and naturally all the logic high levels of all his I O ports are. If your LCD1602 is connected with a microcontroller, first of all your LCD screen should support the logic level. If your 1602 is powered by 5V, then his data port generally uses 5V as the logic high level, if the 5V power supply LCD1602 is connected with the single-chip microcomputer, theoretically speaking, the 5V LCD1602 should not be able to recognize the logic high level, the consequence is that the 1602 can not receive the data sent by the single-chip microcomputer.
However, in actual use, the 5V LCD 1602 may occasionally recognize the level for some reason, display garbled characters on the LCD screen or even display it correctly, but it must be very unstable.
There is a logic level 1602 on the market, which can be connected with a single-chip microcomputer like MSP430, if you only have a 1602 with 5V power supply, and you have to connect with MSP430, it is definitely not possible to connect directly. At this time, you can add a level translation chip (such as 74lvc4245) between the two, and you can achieve level translation!
-
It is best to use LM12864E for 1602, this is yes, and MSP430 is just compatible. But if you use 1602, you can add a pull-up resistor, so that the problem can be solved, or you lead the VDD pin to the power inlet (power conversion chip input) of the MSP430 is also a 5V power supply, which is completely fine.
-
Hardware Connection Configuration
Data IO port Select the P2 port as shown below (can be modified according to the hardware connection) define LCD dat dir P2dir define LCD dat in P2in define LCD dat out P2out Control IO port As shown in the figure below, select the P0 port (the attachment program defaults to P6, which can be modified as needed).
#define lcd_con_dir p6dir#define lcd_con_out p6out
-
After the POR (Power On Reset) signal is generated, the initial state of the system is:
1. The RST NMI pin is set to reset mode;
2. The IO pin is converted to input mode;
3. Status register reset;
4. The watchdog timer enters the watchdog mode;
5. The program counter PC points to the address of the reset vector (0FFFFH).
-
It's very simple, just take it out.
For example, if you write the data of the game loss of date=0x11, you can divide the pins at two ends, one with 3 pins (low) and one with 5 pins (high).
Take out the top 5 bits and give the high pin : date1 = date&0xf8;For example, the high 5 bits of the A0 port are connected to the data port, so when assigning a value to the data port or the level that should have been in other positions of the IO port, you can assign the value (for example, the other three IO ports all need high levels, then date1|).0x03 and then assign), or 8 io ports are not continuous, just take apart and assign a value one by one, provide an idea, if you consider the efficiency problem, then consider the best centralized method for a long time.
-
I remember that the 430f5529 has 8 ports in a row, and I just wrote the driver interface of the 1602 during the summer vacation.
-
The bottom layer of the next 1602 on the Internet Change it yourself.
-
The MSP430F149 is available in an LQFP64 package with 64 pins.
-
void lcd_init()
p4out=0x01;//portd=0x1;Clear the display.
lcd_enable();
p4out=0x38;//portd=0x38;8 digits, 2 rows, 5*7 dot matrix.
lcd_enable();
p4out=0x0e;//portd=0x0e;Display on, cursor on, flashing.
lcd_enable();
p4out=0x06;//portd=0x06;The text does not move, and the cursor moves to the right.
lcd_enable();
p4out=0x80;//portd=0x80;The address of the company's web display.
lcd_enable();
void lcd_enable()
clr(rs);This byte of data is a command, not data.
clr(rw);This operation is a write, not a read.
clr(e);Pull down the enable signal.
delay();Keep the enable signal low for a period of time.
set(e);Pull up the enable signal to establish the rising edge required for LCD operation.
When I use it, the MCU io is connected to a 74LS573, and then connected to the LCD. Direct connection has not been tried. But I think it's okay. The power supply voltage of the liquid crystal is required.
Now that you have the foundation of 51, it should be much simpler. If you want to get started quickly, you can skip a lot of aspects. >>>More
According to the incoming interruption time, it is OK to refresh the digital tube.
There are a lot of registers, if you want to learn, you can't ask others like this, because others are not good for you, if you want to study, take a look at this book first, the general book, will introduce its register, has been used. For example, timera has a lot of song registers, tactl, tacctl, tamctl, etc., which are used to configure clock sources, frequency divisions and other configuration information. There are also AD12 registers, door openers, I/O registers, and so on. >>>More
Function selection register pxsel
The function of the interface pins varies depending on the function of the peripheral module. Refer to the device's documentation to determine the function of the pins. >>>More
The single-chip microcomputer generally plays the role of a controller in the electronic design, and can control the operation of the system according to the program in the microcontroller (written by the microcontroller developer according to the control requirements). >>>More