STM32 C编程问题

const unsigned char gImage_1
uint16_t *p;
p=gImage_1[0];/*这里老是出问题 ..\USER\main.c(6451): error: #513: a value of type "unsigned char" cannot be assigned to an entity of type "uint16_t *"*/
SystemInit();
delay_init();
LCD_Initializtion();
LCD_BackLight_Init();
LCD_Clear(Red);
LCD_DrawPicture(0,0,303,231,p);
//GUI_Text(68,144,"HY-MiniSTM32V",White,Red);
//GUI_Text(52,160,"Development Board",White,Red);
/* Infinite loop */
while (1)
{
char i;
for(i=100; i>0; i--)
{
LCD_BackLight(i*10);
delay_ms(500);
}
}
}

#ifdef USE_FULL_ASSERT

/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
while (1)
{
}
}

第1个回答  2011-08-22
void LCD_DrawPicture(uint16_t StartX,uint16_t StartY,uint16_t EndX,uint16_t EndY,uint16_t *pic)
{
uint16_t i;
LCD_SetCursor(StartX,StartY);
LCD_WriteRAM_Prepare();
for (i=0;i<(EndX*EndY);i++)
{
LCD_WriteRAM(*pic++);
}
}

个人觉得还得加一个set_window的句子。
这个LCD只定义了起始的地址,以及总的像素大小,没有设定显示屏幕范围,还有屏幕白花花原因1,数据没有读取到。原因2,LCD驱动程序有问题。
第2个回答  推荐于2018-05-07
p = (uint16_t *) gImage_1;
或者
p = (uint16_t *) ( &gImage_1[0]);追问

高手你太犀利了 编译毫无任何错误通过了 不过液晶屏上没显示图片 一片茫茫的
是不是要驱动驱动液晶屏??

本回答被提问者和网友采纳
第3个回答  2011-08-17
p是指向16位数据的指针,它本身是32位的一个地址,而gImage_1是无符号8位常量,非常的不匹配啊! gImage_1也不是字符串常量,gImage_1[0]是什么意思?追问

其实还有个void LCD_DrawPicture(uint16_t StartX,uint16_t StartY,uint16_t EndX,uint16_t EndY,uint16_t *pic)
{
uint16_t i;
LCD_SetCursor(StartX,StartY);
LCD_WriteRAM_Prepare();
for (i=0;i<(EndX*EndY);i++)
{
LCD_WriteRAM(*pic++);
}
} 我是想利用指针显示gImage_1这个数组 由于数组太长就没有放上来了 能帮我想想办法吗?

追答

p=gImage_1;或 p=&gImage_1[0]; 都是可以的吧。

追问

其实不可以…………

第4个回答  2017-11-04

网页链接

看这个就知道怎么回事了

第5个回答  2011-08-18
相似回答