Nokia 3510i lcd (S1D15G14) arayüz hitech pic16f628

| Mayıs 28, 2023 Tarihinde güncellendi
Nokia 3510i lcd (S1D15G14) arayüz hitech pic16f628

Epson S1D15G14 entegresini kullanan Nokia 3510i grafik lcd kullanımı için hazırlanmış bir devre projenin yazılımı Hi-tech C ile hazırlanmış mikro denetleyici ise pic16f628.

This example shows how the Nokia 3510i color LCD can be interfaced and driven using the PIC16F628 microcontroller. The code is written in Hi-Tech C.The Nokia LCD has 96×65 pixels. Software : This project uses Hi-Tech C compiler available from www.htsoft.com . I used Ic-prog to program the 16F628 using the ProPic-2 Programmer

nokia 3510i hitech pic16f628

colorlcd.c içeriği


//_______________________________________________________________________________________________________
//		PIC to Nokia color LCD (type Epson S1D15G14) driving routines written Hi-Tech C	
//		written by Ramandeep Singh ©2004                               				
//		www.spiralbrain.tk or  http://67.15.78.55/~spiral/    	    		
//		[email protected]							
//		Date: 21 Nov 2004							
//		main file.	
//											
//_______________________________________________________________________________________________________

#include "pic.h"		
#include "delay.h"		
#include "delay.c"

__CONFIG(0x3f10);				
 
void send(unsigned char data, unsigned char cd);
void cs(void);

#define SCLK	RB0
#define SDATA	RB1
#define CS		RB2
#define RESET	RB3

#define CMD		0
#define DATA	1
	
	unsigned char c;
void main(void)
	{
	unsigned int i;
	unsigned char  s,a;

	TRISB = 0x00;		// portB is output; (NOKIA LCD = portB)
	TRISA = 0x00;
	CMCON = 0b00000111;	// disable comparators
	PORTB = 0x00;		// all low
	PORTA = 0x00;

		DelayMs(250);
	
	// LCD Hardware Reset
	RESET=0;
	DelayMs(5);
	RESET=1;
	
	CS=1;
	SCLK=1;
	SDATA=1;
	
	send(0x01, CMD);		// LCD Software Reset
	cs();
	DelayMs(5);
	
	send(0xC6, CMD);		// Initial Escape
	cs();
	
	send(0xB9, CMD);		// Refresh set
	send(0x00, DATA);
	cs();
	
	send(0xB6, CMD);		// Display Control
	send(128, DATA);
	send(128, DATA);
	send(129, DATA);
	send(84, DATA);
	send(69, DATA);
	send(82, DATA);
	send(67, DATA);
	cs();
	
	send(0xB3, CMD);		// Gray Scale Position
	send(1, DATA);
	send(2, DATA);
	send(4, DATA);
	send(8, DATA);
	send(16, DATA);
	send(30, DATA);
	send(40, DATA);
	send(50, DATA);
	send(60, DATA);
	send(70, DATA);
	send(80, DATA);
	send(90, DATA);
	send(100, DATA);
	send(110, DATA);
	send(127, DATA);
	cs();
	
	send(0xB5, CMD);		// Gamma Curve Set
	send(1, DATA);
	cs();
	
	send(0xBE, CMD);		// Power Control
	send(4, DATA);
	cs();
	
	send(0x11, CMD);		// Sleep out
	cs();
	
	send(0xB7, CMD);		// Temperature gradient set
	for(i=0; i<14; i++) {
		send(0, DATA);
	}
	cs();
	
	send(0x03, CMD);		// Booster Voltage ON
	cs();
	
		DelayMs(40);

	
	send(0x20, CMD);		// Inversion control
	cs();
	
	send(0x25, CMD);		// Write contrast
	send(75, DATA);  //was 63
	cs();

	send(0x29, CMD);		// Display On
	cs();

	send(0x2C, CMD);		// Memory Write
	
for(a=0;a<4;a++)
{

	s=0;
	for(i=0; i<294; i++) {
		if(s == 0) send(15, DATA);			//	15
		else if(s == 1) send(240, DATA);	//  240
		else if(s == 2) send(255, DATA);	//	255
		
		if(++s == 3)
			s = 0;
	}
	

	s=0;
	for(i=0; i<294; i++) {
		if(s == 0) send(240, DATA);
		else if(s == 1) send(255, DATA);
		else if(s == 2) send(15, DATA);
		
		if(++s == 3)
			s = 0;
	}
	

	s=0;
	for(i=0; i<294; i++) {
		if(s == 0) send(255, DATA);
		else if(s == 1) send(15, DATA);
		else if(s == 2) send(240, DATA);
		if(++s == 3)
			s = 0;
	}
	

	s=0;
	for(i=0; i<294; i++) {
		if(s == 0) send(0, DATA);
		else if(s == 1) send(240, DATA);
		else if(s == 2) send(15, DATA);
		
		if(++s == 3)
			s = 0;
	}
	
				
	s=0;
	for(i=0; i<294; i++) {
		if(s == 0) send(15, DATA);  
		else if(s == 1) send(0, DATA);
		else if(s == 2) send(240, DATA);
		
		if(++s == 3)
			s = 0;
	}
	

	s=0;
	for(i=0; i<294; i++) {
		if(s == 0) send(240, DATA);
		else if(s == 1) send(15, DATA);
		else if(s == 2) send(0, DATA);
		
		if(++s == 3)
			s = 0;
	}
	

	for(i=0; i<294; i++) {
		send(0, DATA);
	}
	

	for(i=0; i<294; i++) {
		send(255, DATA);
	}
	cs();
	}
	send(0x29, CMD);		// Display On
	cs();
	
	while(1) {


	send(0x21, CMD);		// Initial Escape
	cs();

DelayMs(250);
DelayMs(250);
	send(0x20, CMD);		// Initial Escape
	cs();
DelayMs(250);
DelayMs(250);
}

		}
void send(unsigned char data, unsigned char cd) {
	
	CS=0;


	SCLK=0;
	if(cd == CMD)
		SDATA=0;
	else
		SDATA=1;
	SCLK=1;

	for (c=8;c>0;c--) {
		SCLK=0;
		if ((data&0x80)==0){
		SDATA=0;
		 							}
		else {
		SDATA=1;
				}
		SCLK=1;
		data=data<<1;
					}

}

void cs(void) {
	CS=1;	// CS = 1
}


Kaynak: sunbizhosting.com/~spiral/colorlcd/ (kapalı)

nokia-3510i-lcd-s1d15g14-arayuz-hitech-pic16f628

Şifre-Pass: 320volt.com

Yayım tarihi: 2009/10/16 Etiketler: , , , , , ,



Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir