hello everyone I am trying to use a LCD 20x4 ( 4 bits ) with a lm3s328 , but have not found a proper lib , can someone give me a hand . Thank you .
6-Jan-2015 18:59 GMT: "I am trying to use a LCD 20x4 ( 4 bits ) with a lm3s328"
9-Jan-2015 09:29 GMT: "I am using an LPC1343"
So what chip are you really using??
Again, leave the LCD part alone until you mastered driving the point pins with specific timing.
Learn to walk before trying to run.
Sorry personal now that I realized . But I am using LPC1343 . Sorry, sorry . It was bad.
Right. So get down to learning how to set & clear its pins with defined timing...
I believe that this is the problem. On and off the pins have learned and fix what was wrong . But I have questions about this delay . If I leave without "return" it is locked as in an infinite loop and does not pursue the code. I also noticed that the variable msticks does not increase . How come?
///LCD.c void lcd_delay(int msec) { volatile uint32_t done = msTicks + msec; while (msTicks != done) ; } ///VTABLE.c void SysTick_Handler(void) { msTicks++; }
Have you forgotten to make msTicks volatile? Making done volatile is not necessary because it doesn't get changed elsewhere.
All these variables are declared. As said above , I am studying the systicks , delay ... Below is the code of main.c. Operating at 72Mhz.
Grateful.
#include <stdio.h> #include <stdint.h> #include "../cmsis/device/lpc134x.h" #include "../core/gpio/gpio.h" int main(void) { SystemCoreClockUpdate(); // 72Mhz SysTick_Config(SystemCoreClock / 100); // 1 = 1us / 10 = 1ms / 100 = 10ms / 1000 = 100ms gpioSetDir(GPIO_GPIO1_BASE, GPIO_PIN3, gpioDirection_Output); while (1) { gpioSetValue(GPIO_GPIO1_BASE, GPIO_PIN3, GPIO_PIN3); systickDelay(10000); gpioSetValue(GPIO_GPIO1_BASE, GPIO_PIN3, 0x00); systickDelay(10000); } }
All these variables are declared.
Yes, but as I asked:
Have you forgotten to make msTicks volatile?
If you don't, then it's unlikely to work with an optimizing compiler.
//LCD.c void lcd_delay(int msec) { volatile uint32_t done = msTicks + msec; while (msTicks != done) ; } //LCD.h volatile uint32_t msTicks; //... //VTABLE.c void SysTick_Handler(void) { msTicks++; }
So it would make sense to check whether you're actually executing SysTick_Handler.