8-bit data bus setting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-21 12:34 PM
#include <
stm32f10x.h > #include < stm32f10x_conf.h > #include < stm32f10x_rcc.h > #include < stm32f10x_gpio.h > #include ''fonts.h'' #include < stdio.h > #include < string.h > #define Set_CS GPIO_SetBits(GPIOC,GPIO_Pin_1); #define Clr_CS GPIO_ResetBits(GPIOC,GPIO_Pin_1); #define Set_RS GPIO_SetBits(GPIOB,GPIO_Pin_9); #define Clr_RS GPIO_ResetBits(GPIOB,GPIO_Pin_9); #define Set_WR GPIO_SetBits(GPIOB,GPIO_Pin_8); #define Clr_WR GPIO_ResetBits(GPIOB,GPIO_Pin_8); #define Set_RST GPIO_SetBits(GPIOC,GPIO_Pin_0); #define Clr_RST GPIO_ResetBits(GPIOC,GPIO_Pin_0); #define Set_LED GPIO_SetBits(GPIOB,GPIO_Pin_11); #define Clr_LED GPIO_ResetBits(GPIOB,GPIO_Pin_11); GPIO_InitTypeDef GPIO_InitStructure; //************************************************************************ void LCD_InitializePorts(void); void Write_Data(unsigned char data); void Delay(volatile uint32_t nCount); //************************************************************************* void Delay(volatile uint32_t nCount) { for (; nCount != 0; nCount--); } //************************************************************************* void Write_Data(unsigned char data) { Set_RS; Clr_CS; GPIOB->ODR = (GPIOB->ODR&0xff00)|(data&0x00ff); //PIN_0 1.2.3.4.5.6.7 Clr_WR; Set_WR; Set_CS; LCD_Delay(); } //************************************************************************* void LCD_InitializePorts(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); GPIO_StructInit(&GPIO_InitStructure); //PIN_0 1.2.3.4.5.6.7 LCD DATA PORT// //WR PIN 8 // RS PIN 9 // //LED PIN 11// GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_11; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;//RST pin //CS pin GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); } //************************************************************************* int main(void) { Delay(0XF111F); LCD_InitializePorts(); while(1) { Set_LED ; Delay(0XF111F); Clr_LED ; Delay(0XF111F); } } //*************************************************************************- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-21 1:17 PM
Where is my error check this code?
How do I make an 8-bit data bus?
Lost something in the translation there.
The way you have the code set up the data bus is using PB0..PB7
Provide some context to your question, for example by diagramming how the LCD has been connected.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-21 2:58 PM
http://www.lovbuy.com/arduino2560-supporting-35-lcd-screenili-9327-p-7html?language=en
I first started The series stm32f I do not know how stm32f series data port. Is this code correct?GPIOB->ODR = (GPIOB->ODR&0xff00)|(data&0x00ff); //DATA BUSPORTB connected //PINS_0 1.2.3.4.5.6.7
thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-21 3:11 PM
Yes, that would mask on the low order 8-bits to the Output Data Register (ODR)
The B Bank has 16 bits reflected on PB0 thru PB15Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-21 4:16 PM
thanks
You're
my brother
