hi
i'm still cant make the lcd work
when i'm running the debug everything seems to work
but when i run the program on the chip i don't see any signals being sent to the lcd
is there some special way to wire either?
this is my code...
////Procesorexpert.c
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
//PTK - LCD.BUS
#include "LCDBus.h"
//PTD.6:7 - LCD.RS:ES
#include "LCDControlLines.h"
//PTL.5 - ALV
#include "ALV.h"
/* User includes (#include below this line is not maintained by Processor Expert) */
#include "LCD.h"
/* Global variables*/
void main(void)
{
/* Write your local variable definition here */
char blaf[]= "hello world";
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
initLCD();
sendCharacter(blaf[0]);
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
////LCD.h
void waitu(word n)
{
word x;
ALV_PutVal(FALSE); //this is just to catch on the oscilloscope how many times i enter this routine. alv is normally high
for (x=n ; x >0 ; x--);
for (x=n ; x >0 ; x--);
for (x=n ; x >0 ; x--);
for (x=n ; x >0 ; x--);
ALV_PutVal(TRUE);
}
void sendCommand(char a)
{
LCDBus_PutVal(a); //put data on output Port
LCDControlLines_PutVal(0); // RS=LOW : send instruction
//R/W=LOW : Write by default
LCDControlLines_PutVal(1); // E = 1: enable LCD;
waitu(0x0001); //enable pulse width >= 300ns
LCDControlLines_PutVal(0); // E = 0; Clock enable: falling edge
}
void sendCharacter(char a)
{
LCDBus_PutVal(a); //put data on output Port
LCDControlLines_PutVal(2); // RS=high : send data
//R/W=LOW : Write by default
LCDControlLines_PutVal(3); // E = 1: enable LCD;
waitu(0x0001); //enable pulse width >= 300ns
LCDControlLines_PutVal(2); // E = 0; Clock enable: falling edge
}
void initLCD()
{
LCDControlLines_PutVal(0); // E = 0; Clock enable: falling edge
waitu(0x1000); //48ms //Wait 20 msec after power is applied
sendCommand(0x30); //command 0x30 = Wake up
waitu(0x0110); //must wait 5ms, busy flag not available
sendCommand(0x30); //command 0x30 = Wake up #2
waitu(0x0010); //must wait 160us, busy flag not available
sendCommand(0x30); //command 0x30 = Wake up #3
waitu(0x0010); //must wait 160us, busy flag not available
sendCommand(0x38); //Function set: 8-bit/2-line
sendCommand(0x10); //Set cursor
sendCommand(0x0c); //Display ON; Cursor ON
sendCommand(0x06); //Entry mode set
}
it just ocurred to me... the processor expert turns on the watchdog by default?