Finally, I have figured out the 12232 microcontroller driver.

Publisher:EtherealGazeLatest update time:2015-07-16 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
It was still the combination of 89C52 and 12232. But there was no datasheet for this 12232. In the end, I relied on my own analytical skills and a little trust in the seller's information (which now seems to be wrong) to get (?) the driver for this.

Now I can't find a way to make this thing show the lower half of the screen. Now whatever is on the upper half of the screen, the lower half of the screen will show the same thing. I'm dizzy...

But at least with the help of the first two programs, recognizable characters are displayed.

But let me say something about this. The pull-up resistor on my P0 port seems to be broken, which results in the Chinese characters always missing strokes. It's very strange. I tried to drive the CLK terminal with the clock signal generated by NE555/4046 but failed. Finally, adding a pull-up resistor made it work.

This is the last driver http://www.51hei.com/mcu/1560.html   , and the effect seems to be better.

The above display effect diagram: The above program (still 3/4 finished, I need to see how to make the lower half of the screen light up): Download the complete source code:  http://www.51hei.com/f/12232de.rar



/*-----
 *FILE main.c
 * Test driver 12232
 */
#include 
#include 
//#define DEBUG
#ifdef DEBUG
#include 
#endif
/*-----DEVICE IO Pin map.
* NMTB-S000389FGHSAY-A
* Let's try it out!!!
* Sequence 68 series */
//Simulated binary assignment
#define HEX__(n) 0x##n##UL
#define B8__(x) ( (x & 0x0000000FUL) ? 1:0 )
    +( (x & 0x000000F0UL) ? 2:0 )
    +( (x & 0x00000F00UL) ? 4:0 )
    +( (x & 0x0000F000UL) ? 8:0 )
    +( (x & 0x000F0000UL) ? 16:0 )
    +( (x & 0x00F00000UL) ? 32:0 )
    +( (x & 0x0F000000UL) ? 64:0 )
    +( (x & 0xF0000000UL) ? 128:0 )
#define B8(x) ((unsigned char)B8__(HEX__(x)))
#define B16(x_msb,x_lsb) (((unsigned int)B8(x_msb)<<8) + B8(x_lsb))
#define B32(x_msb,x_2,x_3,x_lsb) (((unsigned long)B8(x_msb)<<24) + ((unsigned long)B8(x_2)<<16) + ((unsigned long)B8(x_3) <<8) + B8(x_lsb))
#define TH 0xFE
#define TL 0x40 //2K timer value

#define LCD_RESET 0xE2 //Reset
#define LCD_DISPLAY_ON 0xAF //Display on
#define LCD_DISPLAY_OFF 0xAE //Display off
#define LCD_PS_ON 0xA5 //Power saving driver    
#define LCD_PS_OFF 0xA4 //Normal drive
#define LCD_DUTY16 0xA8 //Duty cycle 1/16
#define LCD_DUTY32 0xA9 //Duty cycle 1/32
#define LCD_END 0xEE
#define LCD_RWMODE 0xE0
#define LCD_LINE0 0xC0 //Start line
#define LCD_PAGE0 0xB8 //Start page
#define LCD_COLUMN0 0x00 //Start column
#define Both_Write_Cmd(cmd) LCD_Write(0,0,cmd);LCD_Write(1,0,cmd)
#define Both_Write_Data(dat) LCD_Write(0,1,dat);LCD_Write(1,1,dat)
#define CLK P1_3
#define RESET P1_6
#define A0 P1_0
#define E1 P1_2
#define E2 P1_1
#define LCD_RD P1_4	
#define LCD_WR P1_5	
#define DATA P0


// Convert the 16x8 font to 8x8 font
unsigned char __code ASCII[][8]={
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
{0x0,0x0,0xE,0xFF,0xFF,0xE,0x0,0x0},
{0x0,0x3,0x7,0x0,0x0,0x7,0x3,0x0},
{0x8,0xFE,0xFE,0x8,0xFE,0xFE,0x8,0x0},
{0xE,0x9F,0x91,0x91,0x91,0xF3,0x66,0x0},
{0x8C,0xC,0x40,0x60,0x30,0x98,0x8C,0x0},
{0x60,0xF6,0x9F,0xB9,0x6F,0xF6,0x90,0x0},
{0x0,0x4,0x7,0x3,0x0,0x0,0x0,0x0},
{0x0,0x0,0x7C,0x7E,0x83,0x81,0x0,0x0},
{0x0,0x0,0x81,0x83,0x7E,0x7C,0x0,0x0},
{0x20,0x28,0x78,0x70,0x70,0x78,0x28,0x20},
{0x0,0x20,0x20,0x78,0x78,0x20,0x20,0x0},
{0x0,0x0,0x0,0x80,0x80,0x0,0x0,0x0},
{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0},
{0x0,0x0,0x0,0x80,0x80,0x0,0x0,0x0},
{0x80,0x0,0x40,0x60,0x30,0x18,0xC,0x0},
{0x7C,0x7E,0x83,0xB1,0x83,0x7E,0x7C,0x0},
{0x0,0x84,0x86,0xFF,0xFF,0x80,0x80,0x0},
{0x82,0xC3,0xE1,0xB1,0x99,0x8F,0x86,0x0},
{0x2,0x83,0x91,0x91,0x91,0xFF,0x6E,0x0},
{0x30,0x38,0x2C,0xA6,0xFF,0xFF,0xA0,0x0},
{0x1F,0x9F,0x91,0x91,0x91,0xF1,0x61,0x0},
{0x7C,0xFE,0x93,0x91,0x91,0xF0,0x60,0x0},
{0x3,0x3,0xC1,0xE1,0x31,0x1F,0xF,0x0},
{0x6E,0xFF,0x91,0x91,0x91,0xFF,0x6E,0x0},
{0xE,0x9F,0x91,0x91,0x91,0x7F,0x7E,0x0},
{0x0,0x0,0x0,0xC,0xC,0x0,0x0,0x0},
{0x0,0x0,0x80,0x8C,0xC,0x0,0x0,0x0},
{0x0,0x20,0x70,0x58,0xC,0x86,0x82,0x0},
{0x0,0x48,0x48,0x48,0x48,0x48,0x48,0x0},
{0x0,0x82,0x86,0xC,0x58,0x70,0x20,0x0},
{0x6,0x7,0x1,0xF1,0xF9,0xF,0x6,0x0},
{0x7C,0xFE,0x82,0xF2,0xF2,0xFE,0x7C,0x0},
{0xF8,0xFC,0x26,0x23,0x26,0xFC,0xF8,0x0},
{0x81,0xFF,0xFF,0x91,0x91,0xFF,0x6E,0x0},
{0x7C,0x7E,0x83,0x81,0x81,0x83,0x6,0x0},
{0x81,0xFF,0xFF,0x81,0x83,0x7E,0x7C,0x0},
{0x81,0xFF,0xFF,0x91,0xB9,0x83,0x87,0x0},
{0x81,0xFF,0xFF,0x91,0x39,0x3,0x7,0x0},
{0x7C,0x7E,0x83,0xA1,0xA1,0x63,0xE6,0x0},
{0xFF,0xFF,0x10,0x10,0x10,0xFF,0xFF,0x0},
{0x0,0x0,0x81,0xFF,0xFF,0x81,0x0,0x0},
{0x40,0xC0,0x80,0x81,0xFF,0x7F,0x1,0x0},
{0x81,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0x0},
{0x70,0xF8,0x88,0x88,0xF0,0xF8,0x8,0x0},
{0x81,0xFF,0xFF,0x10,0x8,0xF8,0xF0,0x0},
{0x0,0x0,0x88,0xFB,0xFB,0x80,0x0,0x0},
{0x0,0x0,0x0,0x0,0x8,0xFB,0xFB,0x0},
{0x81,0xFF,0xFF,0x60,0x70,0x98,0x88,0x0},
{0x0,0x0,0x81,0xFF,0xFF,0x80,0x0,0x0},
{0xF8,0xF8,0x18,0x70,0x18,0xF8,0xF0,0x0},
{0x8,0xF8,0xF0,0x8,0x8,0xF8,0xF0,0x0},
{0x70,0xF8,0x88,0x88,0x88,0xF8,0x70,0x0},
{0x8,0xF8,0xF0,0x88,0x88,0xF8,0x70,0x0},
{0x70,0xF8,0x88,0x88,0xF0,0xF8,0x8,0x0},
{0x88,0xF8,0xF0,0x98,0x8,0x38,0x30,0x0},
{0x10,0xB8,0xE8,0xC8,0xC8,0x98,0x10,0x0},
{0x8,0x8,0x7E,0xFF,0x88,0x88,0x0,0x0},
{0x78,0xF8,0x80,0x80,0x78,0xF8,0x80,0x0},
{0x0,0x78,0x78,0x80,0x80,0x78,0x78,0x0},
{0x78,0xF8,0x80,0x60,0x80,0xF8,0x78,0x0},
{0x88,0x98,0x70,0x60,0x70,0x98,0x88,0x0},
{0x78,0xF8,0x80,0x80,0x80,0xF8,0xF8,0x0},
{0x98,0x98,0xC8,0xE8,0xB8,0x98,0x88,0x0},
{0x0,0x10,0x10,0x7E,0xEF,0x81,0x81,0x0},
{0x0,0x0,0x0,0xEF,0xEF,0x0,0x0,0x0},
{0x0,0x81,0x81,0xEF,0x7E,0x10,0x10,0x0},
{0x2,0x3,0x1,0x3,0x2,0x3,0x1,0x0}
};
[page]
/*---------------------
The following character fonts are generated: Driver written by Wan Zhiyuan
The font library is created by Wanzhiyuan HZK software. Use dot matrix display mode
HZ is the Chinese character library you need
----------------*/
unsigned char __code HZ[][32]={
/******lattice*******
0000100000000100
1111110111111110
0000100100000000
0100100101000100
0100100101000100
0100100100101000
0100100100101000
0100100100010000
0111110100010000
0000010100101000
0000010100101000
0001110101000100
1110010110000100
0100010100000000
0001010111111110
0000100000000000
*******End of dot matrix********/
{0x2,0xFA,0x2,0x2,0xFF,0x2,0x0,0xFE,0x2,0x1A,0x62,0x82,0x62,0x1B,0x2,0x0,0x10,0x31,0x11,0x49,0x89,0x7F,0x0,0x7F,0x50 ,0x48,0x46,0x41,0x46,0x58,0x40,0x0},
/******lattice*******
0000000001000000
0000100001000000
0111110001000000
0000000001000100
0000010111111110
1111111001000100
0001000001000100
0001000001000100
0010000001000100
0010010001000100
0100001010000100
1111111010000100
0100000100000100
0000000100000100
0000001000101000
0000010000010000
*******End of dot matrix********/
{0x20,0x24,0x24,0xE4,0x26,0x34,0x20,0x10,0x10,0xFF,0x10,0x10,0x10,0xF8,0x10,0x0,0x8,0x1C,0xB,0x8,0x8,0x8A,0x4C,0x30,0xC ,0x3,0x40,0x80,0x40,0x3F,0x0,0x0},
/******lattice*******
0001000010000000
0001000001001000
0010001111111100
0010001000001000
0100101000001000
1111101111111000
0001001000000000
0010001000000100
0100001111111110
1111011010010100
0100101010010100
0000001111111100
0001101010010100
1110001010010100
0100001010010100
0000001000001100
*******End of dot matrix********/
{0x20,0x30,0xAC,0x63,0x30,0x0,0xFC,0x24,0x25,0x26,0x24,0x24,0x3E,0x84,0x0,0x0,0x22,0x67,0x22,0x12,0x14,0x2,0xFF,0x9,0x7F ,0x9,0x9,0x7F,0x89,0xFF,0x1,0x0},
/******lattice*******
0000000000000000
0111111111111110
0100000000000010
1000100000000100
0000100000100000
0000111111110000
0000100000000000
0000100000001000
0000111111111100
0000000000001000
0000000001001000
0111111111101000
0000000000001000
0000000000001000
0000000001010000
0000000000100000
*******End of dot matrix********/
{0x8,0x6,0x2,0x2,0xFA,0x22,0x22,0x22,0x22,0x22,0x32,0x22,0x82,0xA,0x6,0x0,0x0,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0x9 ,0x4D,0x89,0x41,0x3F,0x1,0x0,0x0},
/******lattice*******
0000000000000000
0000000000000100
1111111111111110
0000001000000000
0000001000000000
0000001000010000
0000001111111000
0000001000010000
0000001000010000
0000010000010000
0000010000010000
0000010000010000
0000100000010000
0001000000010000
0010000010100000
0100000001000000
*******End of dot matrix********/
{0x4,0x4,0x4,0x4,0x4,0x4,0xFC,0x44,0x44,0x44,0x44,0xE4,0x44,0x6,0x4,0x0,0x0,0x80,0x40,0x20,0x10,0xE,0x1,0x0,0x40 ,0x80,0x40,0x3F,0x0,0x0,0x0,0x0},
/******lattice*******
0000010001000000
1111111001000000
0001000001000000
0001000001000100
0010000011111110
0100010100001000
1111111010001000
0001000010001000
0001000010001000
0111110010010000
0001000001010000
0001000000100000
0001111001010000
1111000010001000
0100000100001110
0000011000000100
*******End of dot matrix********/
{0x42,0x62,0x52,0xCE,0x42,0x63,0x42,0x20,0xD0,0x1F,0x10,0x10,0xF0,0x18,0x10,0x0,0x20,0x62,0x22,0x3F,0x12,0x92,0x90,0x40,0x23 ,0x14,0x8,0x16,0x61,0xC0,0x40,0x0},
/******lattice*******
0000000000010000
0100001111111000
0011000000000000
0001000000000000
0000000000001000
0000011111111100
1111000100100000
0001000100100000
0001000100100000
0001000100100100
0001001000100100
0001001000011100
0001010000000000
0010100000000110
0100011111111100
0000000000000000
*******End of dot matrix********/
{0x40,0x42,0x44,0xCC,0x0,0x20,0x22,0xE2,0x22,0x22,0xE2,0x23,0x32,0x20,0x0,0x0,0x0,0x40,0x20,0x1F,0x20,0x50,0x4C,0x43,0x40 ,0x40,0x47,0x48,0x48,0x6E,0x20,0x0}
};



void OutCLK() __interrupt 1 __using 1//CLK out 2kHz
{
	TF0=0;//CLR
	TR0=0;
	EA=0;
	TH0=TH;TL0=TL;
	CLK=!CLK;
	TR0=1;
	EA=1;
}
void Delay_ms(UINT x)
{
	UINT y;
	while(x--)
	{
		for(y=0;y<600;y++);
	}
}
void Init_Timer()
{
	TMOD=0x21; //T0 counter mode, T1 eight-bit reload mode
	TH0=TH;
	TL0=TL;
	TR0=1;
	ET0=1;
	SCON = 0x50;
	TH1 = 0xFF; //57600
	TL1 = 0xFF;         
	TR1 = 1;
	PCON=PCON|0x80; // double the baud rate
	EA=1;
}
void putchar(char s)
{
	SBUF=s;
	while(!TI);
	TI=0;
}
[page]
BYTE Read_Status(BOOL right)
{
	BYTE tData;
	DATA=0xff;
	LCD_WR=1;
	LCD_RD=0;
	A0=0;
	if(right)
	{
		E1=0;
	}
	else
	{
		E2=0;
	}
	tData=DATA;
	if(right)
	{
		E1=1;
	}
	else
	{
		E2=1;
	}
	LCD_RD=1;
	A0=1;
	return tData;
}

void LCD_Write(BOOL right,BOOL disp,BYTE Data)
{//Simulate 8080
	/*BYTE rTemp=0xff;
	while(rTemp & 0x7F)
	{
		rTemp=Read_Status(right);
	}*/
	if(right)
	{
		E1=0;
	}
	else
	{
		E2=0;
	}
	A0=disp; //disp=1 data, disp=0 display
	DATA=Data;
	LCD_RD=1;
	LCD_WR=0;
	__asm
	NOP
	NOP
	NOP
	NOP
	__endasm;
	LCD_WR=1;
	if(right)
	{
		E1=1;
	}
	else
	{
		E2=1;
	}
	__asm
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	__endasm;
}

BYTE LCD_Read(BOOL right)
{//Simulate 8080
	BYTE tData;
	if(right)
	{
		E1=0;
	}
	else
	{
		E2=0;
	}
	DATA=0xFF;
	LCD_WR=1;
	LCD_RD=0;
	tData=DATA;
	LCD_RD=1;
	if(right)
	{
		E1=1;
	}
	else
	{
		E2=1;
	}
	return tData;
}

void SetPage(BYTE page0,BYTE page1)
{
LCD_Write(0,0,0xB8|page1);
LCD_Write(1,0,0xB8|page0);
}

void SetAddress(BYTE address0,BYTE address1)
{
LCD_Write(0,0,address1);
LCD_Write(1,0,address0);
}

void LCD_Cls(BYTE FILL)
{
	BYTE i;
	BYTE page;
	for (page=0;page<4;page++)
	{
		SetPage(page,page);
		SetAddress(0,0);
		for (i=0;i<61;i++)
		{
			Both_Write_Data(FILL);
		}
	}

}

void Init_LCD()
{
	RESET=1;
	RESET=0; //8080 timing
	#ifdef DEBUG
	printf("Status(Chip1):0x%X
",Read_Status(0));
	printf("Status(Chip2):0x%X
",Read_Status(1));
	#endif
	Both_Write_Cmd(LCD_RESET); //soft reset
	#ifdef DEBUG
	printf("Status(Chip1):0x%X
",Read_Status(0));
	printf("Status(Chip2):0x%X
",Read_Status(1));
	#endif
	Both_Write_Cmd(LCD_PS_OFF); //Normal drive
	Both_Write_Cmd(LCD_DISPLAY_ON); //Turn on display
	Both_Write_Cmd(LCD_DUTY16); //16% duty cycle
	#ifdef DEBUG
	printf("Status(Chip1):0x%X
",Read_Status(0));
	printf("Status(Chip2):0x%X
",Read_Status(1));
	#endif
}
/*
 * CODE: A0 /RD /WR D7 D6 D5 D4 D3 D2 D1 D0
		  LLH BUSY ADC ON/OFF RESET LLLL
*/

void Draw8(BOOL right,BYTE Asc)
{
	BYTE i;
	for(i=0;i<8;i++)
	{
		LCD_Write(right,1,ASCII[Asc-32][i]);
	}
}

void DrawASCIIStr(BOOL right,BYTE *str)
{
	while(*str!='')
	{
		Draw8(right,*str);
		str++;
	}
}

void main()
{  
	BYTE i,j;
	Init_Timer(); //Start the timer
	#ifdef DEBUG
	printf("System started.
");
	#endif
	Init_LCD();
	LCD_Cls(0x00); //Clear screen
	SetPage(0,0);
	SetAddress(0,0);
	for(j=0;j<4;j++)
	{
		for(i=0;i<16;i++)
		{
			LCD_Write(0,1,HZ[j][i]);
		}
	}
	SetPage(1,1);
	SetAddress(0,0);
	for(j=0;j<4;j++)
	{	
		for(i=16;i<32;i++)
		{
			LCD_Write(0,1,HZ[j][i]);
		}
	}
	//Display "Driver Writing"
	SetPage(0,0);
	SetAddress(0,0);
	DrawASCIIStr(1,"BY");
	//Display BY
	for(j=4;j<7;j++)
	{
		for(i=0;i<16;i++)
		{
			LCD_Write(1,1,HZ[j][i]);
		}
	}
	SetPage(1,1);
	SetAddress(16,16);
	for(j=4;j<7;j++)
	{	
		for(i=16;i<32;i++)
		{
			LCD_Write(1,1,HZ[j][i]);
		}
	}
	//Display "Wan Zhiyuan"
    while(1)
    {
			//LCD_Cls(0xff);
			//Delay_ms(100);
			//LCD_Cls(0xAA);
			//Delay_ms(100);
			//LCD_Cls(0x55);
			//Delay_ms(100);
	}
}
Reference address:Finally, I have figured out the 12232 microcontroller driver.

Previous article:STC89C52RC 8-bit running light program
Next article:Special registers of SDBC (bit-addressable definition method)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号