I am trying to make my 3310 Display to work... but every piece of code I try is in vain...
Here´s what I am trying:
Code:
#include <MC68HC908QT2.h>
#pragma DATA_SEG SHORT ZEROPAGE
#include "prototypes.h"
void main(void) {
lcd_init();
spi(0x1F,1);
spi(0x05,1);
spi(0x07,1);
spi(0x00,1);
spi(0x1F,1);
spi(0x04,1);
spi(0x1F,1);
spi(0x0D,0);
spi(0x80,0);
spi(0x00,1);
for(;;) {
};
}
void lcd_init(void) {
unsigned char tmp;
RES_1;
RES_0;
for (tmp=0;tmp<255;tmp++);
RES_1;
//extended instruction set 0010.0001b
spi(0x21,0);
spi(0x80|20,0); //set Vop;Vop is set to a +16xb[V]
//switch to normal instruction set
spi(0x20,0);
//display control set (normal mode)
spi(0x0c,0);
//switch to data-mode
//DC_1;
}
void spi(unsigned char dat, unsigned char tipo)
{
unsigned char i;
SCE_1;
DelayMs(1);
SCE_0;
if (tipo==0) DC_0;else DC_1;
SCK_0;
for (i = 0; i < 8; i ++) // followed by the 8 bits of data
{
SCK_0;
if((dat << i) & 0x80)
SDI_1;
else
SDI_0;
SCK_1;
}
SCK_0;
SCE_1;
}
The code is an old Freescale´s HC908QT2. It runs on 4MHz.
I have a 7805 regulator connected to a Zener 3.3V which feeds the whole circuit, even the processor.
I am using 2 capacitors. 1 for the Display Vout (2.2uF) to the ground and another (1uF) from Display Vcc to ground.
Any ideas?
Thank you![/code]