2012-01-17 07:34 AM
Hi,
I'm using STM32 F103 microcontroller and 2x16 character lcd.I want to display strings on it.(HD 44780 driver)I'm new on ARM microcontrollers and i couldn't find a demo project for this lcd.Who can help me about it ?Is there any demo project in this site ? Can you give me a link or adress ? #character-lcd2012-01-17 09:06 AM
2012-01-17 09:11 AM
Now this is header file to the last source file.
//------------------------------------------------------------/* Includes ------------------------------------------------------------------*/
#include ''stm32f10x_type.h'' #include ''stm32f10x_gpio.h''/* Macro Definitions ---------------------------------------------------------*/
#define SET_RS (GPIO_WriteBit(GPIOC, GPIO_Pin_2, Bit_SET));
#define RESET_RS (GPIO_WriteBit(GPIOC, GPIO_Pin_2, Bit_RESET)); #define SET_ENABLE (GPIO_WriteBit(GPIOC, GPIO_Pin_10, Bit_SET)); #define RESET_ENABLE (GPIO_WriteBit(GPIOC, GPIO_Pin_10, Bit_RESET));/* private define-------------------------------------------------------------*/
#define LINEONE (1)// line one of 16X2 alphanumeric display #define LINETWO (2)// line two of 16X2 alphanumeric display #define LINETWO_HOME (0xc0) #define LINEONE_HOME (0x80) #define START_ONE (0x33) #define START_TWO (0x32) #define FUNCTION_SET (0x38) #define DISPLAY_OFF (0x08) #define DISPLAY_SETTINGS (0x0E) #define ENTRY_MODESET (0x06) #define CLR_DISPLAY (0x01) #define RETURN_HOME (0x02) #define MS_FIVE (0x0032) #define MS_FIFTEEN (0x0096) #define MS_EIGHTY (0x0320) #define VH_OnTime (0x0015) #define VH_OffTime (0x0004) #define FIVE_SEC (0xC350) #define MS_ONE (0x000A) #define ONE_SEC (0x2710) #define TWO_SEC (0x4E20) #define TEN_MILLI_SEC (0x0064) #define MS_P19 (0x0019)/*data line defination--------------------------------------------------------*/
#define DATA_LINE_0 (0x0001)
#define DATA_LINE_1 (0x0002) #define DATA_LINE_2 (0x0004) #define DATA_LINE_3 (0x0008) #define DATA_LINE_4 (0x0010) #define DATA_LINE_5 (0x0020) #define DATA_LINE_6 (0x0040) #define DATA_LINE_7 (0x0080)/* Exported functions ------------------------------------------------------- */
/* LCD functions */ void LCD_Init(void); void ClrDisplay(void); void WriteCommand(u8); void WriteData(u8); void ChangeLine(u8); void WriteString(u8 *); void Delay(u32); //------------------------------------------------------------2012-01-17 12:55 PM
That it is,I hope this work properly !
Thanks alot rosarium.... (:2012-01-17 10:22 PM
You are welcome... :)
Yes it works alright.2012-01-18 12:15 AM
Can you or another people give me the pin assigments
''C:\Program Files\IAR Systems\Embedded Workbench 6.0\arm\examples\ST\STM32F10x\IAR-STM32-SK\LCD_Demo''this program ?This project is working properly but im not sure connecting the LCD to true pins.What is the DB4~DB7 pin assigments ? I couldn't find on the project file ..2012-01-18 09:30 AM
Now which example is this you are talking about??
Is this for the same LCD (16 x 2)???2012-01-18 09:54 AM
Can you or another people give me the pin assigments
''C:\Program Files\IAR Systems\Embedded Workbench 6.0\arm\examples\ST\STM32F10x\IAR-STM32-SK\LCD_Demo''
this program ? You could determine this by inspecting the source code, or a schematic for the IAR-STM32-SK board. The Data pins are PC.0 .. PC.3 From examples\ST\STM32F10x\IAR-STM32-SK\LCD_Demo\modules\drv_hd44780_l.h
#define LCD_LIGHT GPIO_Pin_0
#define LCD_LIGHT_PORT GPIOB
#define LCD_RS GPIO_Pin_8
#define LCD_RS_PORT GPIOC
#define LCD_E GPIO_Pin_12
#define LCD_E_PORT GPIOC
#define LCD_RW GPIO_Pin_9
#define LCD_RW_PORT GPIOC
#define LCD_DATA 0x0FUL
#define LCD_DATA_SHIFT 0
#define LCD_DATA_PORT GPIOC
#define LCD_LIGHT_ON() GPIO_WriteBit(LCD_LIGHT_PORT,LCD_LIGHT,Bit_SET)
#define LCD_LIGHT_OFF() GPIO_WriteBit(LCD_LIGHT_PORT,LCD_LIGHT,Bit_RESET)
2012-11-07 09:40 AM
2012-11-07 12:05 PM
You'd presumably want a shift of 10 to get the bits aligned properly for output on the GPIO port/bus.
#define LCD_DATA_SHIFT 10 #define LCD_DATA (GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13) #define LCD_DATA_PORT GPIOB