In certain situations, my LCD will not power up.
I am using an Infineon XC-888 micro driving a 16x4 LCD in 4-bit mode.
The LCD is based on the ST7066U IC, the c-code is based on the DAvE structure.
LCD Datasheet: www.sitronix.com.tw/.../ST7066Uv22.pdf
I have been playing around with software delays and timing, but in certain situations, the LCD will power up and others not.
Here are my observations so far:
When I re-program the device, there are no problems, it is always when power is removed... and then re-applied. I have previously tried inserting a really long SW delay to give the lcd time to power up, but that doesn't work.
The "line LCD_init4bit();" is in 2 places in the code below, when the one inside the "while(1){...}" loop is removed, it will not power up when power is applied. When the one outside the while loop is removed/commented out, and the one inside enabled, it works. This also leads me to believe that there is nothing wrong with the function itself, but like I previously said, I have already tried long SW delays to give the LCD time to power up.
I am not sure about reset vectors or the compiler, but any suggestions would be muchly appreciated.
Thanks
void main(void) { // USER CODE BEGIN (MAIN_Main,2) // USER CODE END MAIN_vInit(); // USER CODE BEGIN (MAIN_Main,3) //INT_vDisableAll(); setOutputBits(PASS_LED + FAIL_LED); delay(1000); resetOutputBits(FAIL_LED); delay(100); LCD_init4bit(); //INT_vEnableAll(); // USER CODE END while(1) { // USER CODE BEGIN (MAIN_Main,4) LCD_init4bit(); resetOutputBits(PASS_LED); delay(10000); LCD_instruction4bit(CLEAR_DISPLAY); delay(1); LCD_sendstring4bit("Hello World"); delay(1); setOutputBits(PASS_LED); delay(1); // USER CODE END } } // End of function main
Sam; I'm not at all familiar with your device but I would first suspect a bad reset from power up. The fact that you can run from a re-program start and not from a power up situation points to a reset problem. What type of reset do you have on your target board? Bradford
It can't be that...
I have checked the MBC, TMS, RESET pins with a logic analyser and they appear to be OK.
In addittion, I have used the 'PASS_LED' and 'FAIL_LED' to indicate where in the program the MCU is.
I have set this up so that the FAIL_LED toggles several times before the code enters the "while(1) {}" part. Then I put "LCD_init4bit();" as the very last thing before the while loop and the LCD doesn't power up.
As soon as I put "LCD_init4bit();" inside the loop it works.
Another thing, I was wrong, the LCD won't power up with the programmer either now!!
I'm not at all familiar with your device but I would first suspect a bad reset from power up. It can't be that...
sure it can, if you are using RC reset you will, in effect depend on the Vcc risetime for proper operation AND you will have NO reset at power down which is known to cause (albeit rare) flash losses. What reset do you have
As soon as I put "LCD_init4bit();" inside the loop it works. a well known 'feature' of many LCDs is that they need be initialized twice, try it.
Erik
Yes I have a RC on the reset pin, don't have reset IC.
If I change the R or C to make the time constant larger, will this reduce the chance of glitches when powering up???
it will still not be safe
get a supervisor, "tripods" can be had for less than $0.50
Erik,
You appear as "ISerik malund".
which means???
Ah, so it's intentional. OK.
"which means???"
That you started to write text just before the page was 100% loaded. Then your browser moved the focus to the "First Name" field, which got augmented.
Happens regularly to me.
en.wikipedia.org/wiki/Laurel_and_Hardy
jumpy pages which turned out to be a bad optical mouse