In the arm development board you are learning, I use fm3 (Fujitsu mb9b series). If the example shows a picture, use for(i=0;i
{
Write_data(tupian[i];)
}
We all know that colors are defined in double bytes, for example, 0x0000 represents black;
If your routine is not write_data(high, low); (I remember that the stm32 series is written like this). Then the i above is required to be represented by a double-byte array such as 0xxxxx. There is no need to change the bus and shift the array. I think if the routine is not written by you, don't change it back and forth. It's unnecessary.
Let's take a look at my routine first, as follows
#define black 0x0000
#define blue 0x001F
#define green 0x07E0
#define cyan 0x07FF
#define red 0xF800
#define yellow 0xFFE0
#define white 0xFFFF
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
*************************************************** ************************
void DrawPicture(uint xs,uint xe,uint ys,uint ye)
{
unsigned long int i;
SetWindow(xs, xe, ys, ye);
SetWindow_xy(xs,ys);
write_command(0x0022);
for (i=0;i<(xe*ye);i++)
{
write_data(qq[i]);
// ili9320_Delay(50);
}
//Set_Cs;
}
void write_command(uint16_t cmd)
{
LCD_RS = 0;
*(LCD_BASE) = cmd;
}
//------------------------LCD write data -------------------- -----
void write_data(uint16_t data)
{
LCD_RS = 1;
__no_operation();
__no_operation();
//*(LCD_BASE) =(uint8_t)data;
//*(LCD_BASE) =(uint8_t)data<<8;
*(LCD_BASE) =data;
}
int32_t main(void)
{
FM3_GPIO->PFR4 = 0x0000; // Poart4 for gpio
FM3_GPIO->PDOR4 = 0x003C; // P42-P45 output 1
FM3_GPIO->DDR4 = 0x003C; // P42-P45: LED1-LED4, output;
// P40,P41,P48:key2,key3,key4, input
FM3_GPIO->PFR7 = 0x0000; // Poart7 for gpio
FM3_GPIO->DDR7 = 0x0008; // P73, output;
FM3_GPIO->PFR6 = 0x0000; // Poart6 for gpio
FM3_GPIO->DDR6 = 0x0024; // P64:key1, input; P65 LCD back light, output
// P62, LCD RS select, output
init_extbus(); // Initialize the external bus
delay(10);
LCD_BKLIGHT = 1;
delay(5);
TM280_HX8347G_Initial_code(); //Initialize LCD screen, clear to white
delay(10);
clr_lcd();
DrawPicture(0,239,0,319); //Start and end of x-axis: start and end of y-axis
As mentioned above, according to my routine, the problem arises when displaying the picture on the screen. If you use image2lcd directly, I regret to tell you that the picture array it generates is a single byte (0xxx), so it is impossible to display it on the screen. If you have a picture, but you find that when you use bmp2rgb software to convert it, the array is empty after the conversion, do you start to doubt that the software is really bad? Try it again and the result is still the same. If you specifically find a 24-bit bitmap (bmp) picture, you use bmp2rgb to convert it and find that it is successful, and it is all double-byte arrays, then start to study why?
Actually, in my opinion, the bmp2rgb software can only convert 24-bit BMP format arrays and is single-byte. If we need double-byte, but only have a 16-bit image (open it with bmp2rg). Well, if you have both software, first open this 16-bit image with image2lcd as shown in the figure
Then convert it into a 24-bit bmp format image, and then open the generated image with bmp2rgb software
Set the width and height to the screen size in pixels, click convert, and you're done!
Previous article:How to get a picture that fits your screen size?
Next article:Analysis of Stm32 matrix keyboard scanning program
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- Free application: RTT & Renesas ultra-low power MCU RA2L1 development board
- Where to go during the May Day holiday?
- The 5G era is within reach! Qorvo RF Fusion has been successfully applied to many new smartphone designs
- I want to make a game console recently, but in order to prevent others from copying it, what is the best way to do it?
- The firmware development kit has been upgraded, ONSemiconductor.BDK.1.18.0.pack
- Linux builds RVB2601 development environment
- Wi-Fi 6 and Wi-Fi 6E: The key to the Internet of Things
- Two boards can be cascaded, but not placed on the same layout.
- [ATmega4809 Curiosity Nano Review] How to use RTC
- EEWORLD University Hall----Set up UCD3138 for JTAG communication