在HITECH-PICC18编译下,我发现了PIC18F252与pic18F2520有很大的不同
第一IC18F252最多只能用50%,那怕是50.001%的超过,编程器都不会出问题,但是PIC18F2520则不受限制!到80%还是正常工作。
但是我还是发现了PIC18F252在液晶显示上的优点。
具体说吧。
#include <pic18.h>
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
const uchar tag[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//1
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//2
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,//3
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,//4
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,//5
0x03,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0xFF,0xFF,0xE0,0x00,0x01,0xFF,0xFF,0xE0,0x00,//6
0x03,0xFF,0xFF,0xFF,0xFE,0x00,0x1F,0xFE,0x01,0xF8,0x00,0x3F,0xFF,0xFF,0xFC,0x00,//7
0x00,0x00,0x1F,0xC0,0x00,0x00,0x7F,0xC0,0x03,0x7F,0x00,0xFF,0x00,0x01,0xFF,0x00,//8
0x00,0x00,0x1F,0xC0,0x00,0x01,0xFF,0x00,0x06,0x7F,0x80,0xFE,0x00,0x00,0x7F,0x00,//9
0x00,0x00,0x1F,0xC0,0x00,0x03,0xFE,0x00,0x00,0x6F,0x80,0x3F,0xC0,0x00,0x00,0x00,//10
0x00,0x00,0x1F,0xC0,0x00,0x03,0xFC,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF8,0x00,0x00,//11
0x00,0x00,0x1F,0xC0,0x00,0x03,0xFC,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF0,0x00,//12
0x00,0x00,0x1F,0xC0,0x00,0x03,0xFC,0x00,0x00,0x3F,0x80,0x00,0x00,0x07,0xFE,0x00,//13
0x00,0x00,0x1F,0xC0,0x00,0x01,0xFE,0x00,0x00,0x3F,0x81,0xFE,0x00,0x00,0x7F,0x80,//14
0x00,0x00,0x1F,0xC0,0x00,0x01,0xFF,0x00,0x00,0x7F,0x01,0xFF,0x00,0x00,0x3F,0x80,//15
0x00,0x00,0x1F,0xC0,0x00,0x00,0xFF,0xC0,0x01,0xFE,0x00,0xFF,0x80,0x00,0xFF,0x00,//16
0x00,0x00,0x1F,0xC0,0x00,0x00,0x0F,0xFF,0xFF,0xF8,0x00,0x3F,0xFF,0xFF,0xF8,0x00,//17
0x00,0x00,0x1F,0xC0,0x00,0x00,0x00,0x1F,0xFF,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,//18
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//19
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//20
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//21
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//22
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//23
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//24
0x00,0x88,0x2A,0x22,0x27,0x00,0x20,0x0E,0x7D,0xF7,0xC0,0x11,0x17,0xC4,0x70,0x00,//25
0x01,0x48,0x2A,0x51,0x48,0x80,0x50,0x11,0x11,0x14,0x40,0x29,0x14,0x4A,0x48,0x00,//26
0x02,0x28,0x2A,0x88,0x8C,0x00,0x88,0x18,0x11,0x04,0x40,0x45,0x14,0x11,0x44,0x00,//27
0x03,0xE8,0x2A,0xF8,0x83,0x00,0xF8,0x06,0x11,0xC7,0xC0,0x7D,0xF7,0x1F,0x44,0x00,//28
0x02,0x28,0x94,0x88,0x88,0x80,0x88,0x11,0x11,0x14,0x00,0x45,0x14,0x51,0x48,0x00,//29
0x02,0x2F,0x94,0x88,0x87,0x00,0x88,0x0E,0x11,0xF4,0x00,0x45,0x17,0xD1,0x70,0x00,//30
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//31
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#define ZWCS RB3
#define ZWSTD RB4
#define ZWSCLK RB5
#define ZWPSB RB6
#define ZWRST RB7
#define TRISZWRS TRISB3
#define TRISZWRW TRISB4
#define TRISZWE TRISB5
#define TRISZWPSB TRISB6
#define TRISZWRST TRISB7
#define comm 0
#define dat 1
#define x1 0x80
#define x2 0x90
#define y 0x80
void wr_lcd (uchar dat_comm,uchar content)
{
uchar a,i,j;
delay_us(90);
// DelayUs(250);
a=content;
ZWCS = 1;
ZWSCLK = 0;
ZWSTD = 1;
for(i=0;i<5;i++)
{
PULSE();
}
ZWSTD = 0;
PULSE();
if(dat_comm)
{
ZWSTD = 1;
}
else
{
ZWSTD = 0;
}
PULSE();
ZWSTD = 0;
PULSE();
for(j=0;j<2;j++)
{
for(i=0;i<4;i++)
{
a=a<<1;
ZWSTD = CARRY;
PULSE();
}
ZWSTD = 0;
for(i=0;i<4;i++)
{
PULSE();
}
}
delay_us(1);
ZWCS = 0;
}
void img_disp(const uchar *img)
{
uchar i,j;
for(j=0;j<32;j++)
{
for(i=0;i<8;i++)
{
wr_lcd (comm,0x34);
wr_lcd (comm,y+j);
wr_lcd (comm,x2+i);
wr_lcd (comm,0x30);
wr_lcd (dat,img[j*16+i*2]);
wr_lcd (dat,img[j*16+i*2+1]);
}
}
wr_lcd (comm,0x36);
}
void main()
{
} |