目前共有8篇帖子。
【重發】【120128】【實驗】物理+電腦實驗
1樓 巨大八爪鱼 2014-8-13 22:31
我先編寫了一個12864液晶的程序,編寫好之後編譯成hex文件,然後把測試板和12864液晶拿出來插上,用ISP下載線把測試版與電腦連接並下載程序,液晶上出現了字。
然後我用手機拍攝了幾張照片,用藍芽傳到電腦上。
又因為拍攝效果不是很好,我用ps處理了一下。
最終效果:


哈哈打算給張庶仁看看
2樓 巨大八爪鱼 2014-8-13 22:32
這次PS處理充分運用了蒙版、圖層、圖像色彩調整等知識點
圖片做好後我就收拾器材,結束實驗
3樓 巨大八爪鱼 2014-8-13 22:32
4樓 JosephHeinrich 2014-8-13 22:41
這內容啊,不堪回首……
5樓 JosephHeinrich 2014-8-13 22:42
想到自己還在犯二的那些年……
6樓 巨大八爪鱼 2014-8-13 23:45
不過那段c程序代碼對我很重要
7樓 巨大八爪鱼 2014-8-13 23:45
【附:這次實驗用的程序】
/********************************************************************
* *
* LCM12864帶字型檔演示程序 - 12864顯示圖片和文字 *
* *
* 控制晶片//chipST7920,並口模式。 *
* *
* 東莞市智傑電子科技有限公司 *
* 展櫃地址:東莞市長安明和電子廣場B區B-B1019 *
* 電話:0769-89268669 *
* *
********************************************************************/ #include <reg52.h>
#include <intrins.h> /************* 12864LCD引腳定義 *************/ #define LCD_data P0 //數據口 sbit LCD_RS = P2 ^ 0; //暫存器選擇輸入
sbit LCD_RW = P2 ^ 1; //液晶讀/寫控制
sbit LCD_EN = P2 ^ 2; //液晶使能控制
sbit LCD_PSB = P2 ^ 3; //串/並方式控制
sbit LCD_RST = P2 ^ 5; //液晶複位埠 /*********************************************************/ unsigned char code DIS1[] =
{
"東莞智傑電子科技"
};
unsigned char code DIS2[] =
{
"ZhiJieElectronic"
};
unsigned char code DIS3[] =
{
"單片機 開發板"
};
unsigned char code DIS4[] =
{
"編程器 液晶模塊"
}; char code reserve[3]_at_ 0x3b; //保留0x3b開始的3個位元組 /*********************************************************/ unsigned char code Photo1[] =
{
/*-- 智傑電子圖片 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x40,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x40,0x18,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x7F,0x1C,0x00,0x00,0x02,
0x40,0x10,0x04,0x08,0x00,0x02,0x00,0x00,0x00,0x00,0x1E,0x7F,0xFC,0x00,0x00,0x02,
0x40,0x3F,0xE7,0xFC,0x00,0x02,0x00,0x00,0x00,0x07,0x9F,0x80,0x06,0x00,0x00,0x02,
0x40,0x22,0x04,0x18,0x00,0x02,0x01,0x80,0x00,0x7F,0xE0,0x00,0x02,0x00,0x60,0x02,
0x40,0x46,0x04,0x18,0x1F,0xFF,0xFF,0xC0,0x0F,0xF8,0x00,0x00,0x01,0x00,0xF0,0x02,
0x40,0x86,0x24,0x18,0x00,0x0E,0x80,0x01,0xFF,0x80,0x00,0x00,0x01,0x03,0x9C,0x02,
0x41,0xFF,0xF4,0x18,0x00,0x1A,0x80,0x01,0xF0,0x00,0x00,0x00,0x01,0x0E,0x06,0x02,
0x40,0x04,0x04,0x18,0x00,0x1A,0x40,0x06,0x00,0x00,0x00,0x00,0x01,0x18,0x33,0x02,
0x40,0x0F,0x04,0x18,0x00,0x32,0x60,0x02,0x00,0x00,0x00,0x00,0x01,0x30,0x31,0xC2,
0x40,0x08,0xC7,0xF8,0x00,0x62,0x30,0x01,0xC0,0x00,0x00,0x00,0x01,0x60,0x03,0xC2,
0x40,0x18,0x64,0x18,0x00,0xC2,0x1C,0x00,0xC0,0x00,0x00,0x00,0x00,0xC0,0x0E,0x02,


回復

5樓
2012-01-28 11:43

刪除 |




巨大八爪魚
學業有成8 0x40,0x30,0x24,0x10,0x01,0x82,0x0F,0x00,0x38,0x00,0x00,0x00,0x01,0x80,0x0C,0x02,
0x40,0x48,0x00,0x40,0x02,0x02,0x03,0xC0,0x1E,0x00,0x00,0x00,0x03,0x00,0x18,0x02,
0x41,0x8F,0xFF,0xE0,0x0C,0x02,0x00,0x80,0x06,0x00,0x00,0x00,0x02,0x00,0x30,0x02,
0x40,0x0C,0x00,0xC0,0x10,0x02,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x20,0x02,
0x40,0x0C,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,0x00,0x60,0x02,
0x40,0x0C,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x1B,0x80,0x00,0x00,0x00,0x60,0x02,
0x40,0x0F,0xFF,0xC0,0x02,0x20,0x84,0x00,0x00,0x03,0xF0,0x00,0x00,0x00,0x60,0x02,
0x40,0x0C,0x00,0xC0,0x02,0x20,0xC2,0x03,0x00,0x00,0x7E,0x00,0x00,0x00,0x40,0x02,
0x40,0x0C,0x00,0xC0,0x02,0x10,0x43,0x87,0xC0,0x00,0x0F,0x80,0x00,0x00,0x5E,0x02,
0x40,0x0C,0x00,0xC0,0x06,0x18,0x61,0x86,0xFC,0x00,0x01,0xE0,0x00,0x00,0xDF,0xC2,
0x40,0x0F,0xFF,0xC0,0x0C,0x18,0x61,0x86,0x1F,0xD0,0x00,0x60,0x00,0x00,0x80,0xE2,
0x40,0x0C,0x00,0xC0,0x0C,0x18,0x40,0x86,0x01,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x3A,
0x40,0x08,0x00,0x80,0x00,0x00,0x00,0x06,0x00,0x0F,0xFE,0x00,0x00,0x00,0x00,0x3A,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1A,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1A,
0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,
0x40,0x00,0x30,0x00,0x00,0x00,0x01,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,
0x40,0x00,0x30,0x00,0x03,0xFF,0xFF,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,
0x40,0x00,0x30,0x00,0x00,0x00,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,
0x40,0x00,0x30,0x00,0x00,0x00,0x0C,0x01,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x0A,
0x40,0x30,0x30,0x30,0x00,0x00,0x10,0x01,0x80,0x00,0x3F,0xFF,0xFC,0x00,0x00,0x3A,
0x40,0x3F,0xFF,0xF0,0x00,0x00,0x60,0x01,0x80,0x00,0x71,0xFF,0xF0,0x00,0x00,0x32,
0x40,0x30,0x30,0x30,0x00,0x01,0x80,0x00,0x80,0x01,0xC0,0x00,0x0C,0x00,0x00,0x22,
0x40,0x30,0x30,0x30,0x00,0x01,0xC0,0x00,0xC0,0x03,0x80,0x00,0x0C,0x00,0x00,0x62,
0x40,0x30,0x30,0x30,0x00,0x01,0x80,0x00,0xC0,0x0E,0x00,0x00,0x18,0x00,0x00,0xC2,
0x40,0x30,0x30,0x30,0x00,0x01,0x80,0xE0,0x60,0x3C,0x00,0x00,0x18,0x00,0x01,0x82,
0x40,0x3F,0xFF,0xF0,0x0F,0xFF,0xFF,0xF0,0x60,0x70,0x00,0x00,0x30,0x00,0x03,0x02,
0x40,0x30,0x30,0x30,0x00,0x01,0x80,0x00,0x31,0xC0,0x00,0x00,0x70,0x00,0x06,0x02,
0x40,0x30,0x30,0x30,0x00,0x01,0x80,0x00,0x13,0x80,0x00,0x00,0x60,0x00,0x1C,0x02,
0x40,0x30,0x30,0x30,0x00,0x01,0x80,0x00,0x1E,0x00,0x00,0x00,0xC0,0x00,0x70,0x02,
0x40,0x30,0x30,0x30,0x00,0x01,0x80,0x00,0x0C,0x00,0x00,0x00,0x80,0x00,0xC0,0x02,
0x40,0x3F,0xFF,0xF0,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x01,0x80,0x07,0x80,0x02,
0x40,0x30,0x30,0x20,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x03,0x00,0x1E,0x00,0x02,
0x40,0x20,0x30,0x04,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x03,0x00,0xF8,0x00,0x02,
0x40,0x00,0x30,0x04,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x0C,0x03,0xC0,0x00,0x02,
0x40,0x00,0x30,0x04,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x18,0x0F,0x00,0x00,0x02,
0x40,0x00,0x30,0x06,0x00,0x21,0x80,0x00,0x00,0x00,0x00,0x30,0x7C,0x00,0x00,0x02,







巨大八爪魚
學業有成8 0x40,0x00,0x30,0x06,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x61,0xE0,0x00,0x00,0x02,
0x40,0x00,0x1F,0xFE,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0xC7,0x80,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x9C,0x00,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF0,0x00,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; /********************************************************** us延時子函數 (4.34us) **********************************************************/
void delayNOP()
{
_nop_();
_nop_();
_nop_();
_nop_();
} /********************************************************** ms延時子函數 ***********************************************************/
void delayms(unsigned int ms)
{
unsigned char y;
while (ms--)
{
for (y = 0; y < 114; y++)
;
}
} /********************************************************** 檢查LCD忙狀態
lcd_busy為1時,忙,等待。
lcd-busy為0時,閒,可寫指令與數據。 **********************************************************/
bit lcd_busy()
{
bit result;
LCD_RS = 0;
LCD_RW = 1;
LCD_EN = 1;
delayNOP();
result = (bit)(P0 &0x80);
LCD_EN = 0;
return (result);
} /********************************************************** 寫指令數據到LCD
RS=L,RW=L,E=高脈衝,D0-D7=指令碼。 **********************************************************/
void lcd_wcmd(unsigned char cmd)
{
while (lcd_busy())
;
LCD_RS = 0;
LCD_RW = 0;
LCD_EN = 1;
P0 = cmd;
delayNOP();
LCD_EN = 0;
} /********************************************************** 寫顯示數據到LCD
RS=H,RW=L,E=高脈衝,D0-D7=數據。 **********************************************************/
void lcd_wdat(unsigned char dat)
{
while (lcd_busy())
;
LCD_RS = 1;
LCD_RW = 0;
LCD_EN = 1;
P0 = dat;
delayNOP();
LCD_EN = 0;
} /********************************************************** LCD初始化設定 **********************************************************/
void lcd_init()
{
LCD_PSB = 1; //並口方式 LCD_RST = 0; //液晶複位
delayms(5);
LCD_RST = 1;
delayms(5); lcd_wcmd(0x34); //擴充指令操作
delayms(5);
lcd_wcmd(0x30); //基本指令操作
delayms(5);
lcd_wcmd(0x0C); //顯示開,關游標
delayms(5);
lcd_wcmd(0x06); //游標的移動方向
delayms(5);
lcd_wcmd(0x01); //清除LCD的顯示內容
delayms(5);
} /********************************************************** 設定顯示位置子函數 **********************************************************/







巨大八爪魚
學業有成8 void lcd_pos(unsigned char X, unsigned char Y)
{
unsigned char pos; if (X == 1)
{
X = 0x80;
}
else if (X == 2)
{
X = 0x90;
}
else if (X == 3)
{
X = 0x88;
}
else if (X == 4)
{
X = 0x98;
}
pos = X + Y; //確定顯示地址 lcd_wcmd(pos); //寫顯示地址
} /********************************************************** 閃爍子函數 **********************************************************/
void lcdflag()
{
lcd_wcmd(0x08); //關閉顯示
delayms(1000);
lcd_wcmd(0x0c); //開啟顯示
delayms(1000);
lcd_wcmd(0x08);
delayms(1000);
lcd_wcmd(0x0c);
delayms(1000);
lcd_wcmd(0x08);
delayms(1000);
lcd_wcmd(0x0c);
delayms(1000);
lcd_wcmd(0x01); //清屏
delayms(5);
} /********************************************************** 圖形顯示子函數 **********************************************************/
void photodisplay(unsigned char *bmp)
{
unsigned char i, j; lcd_wcmd(0x34); //寫數據時,關閉圖形顯示 for (i = 0; i < 32; i++)
//32行(上半屏)
{
lcd_wcmd(0x80 + i); //先寫入Y坐標值
lcd_wcmd(0x80); //寫入X坐標值
for (j = 0; j < 16; j++)
//16*8列
lcd_wdat(*bmp++);
delayms(1);
} for (i = 0; i < 32; i++)
//32行(下半屏)
{
lcd_wcmd(0x80 + i); //先寫入Y坐標值
lcd_wcmd(0x88); //寫入X坐標值
for (j = 0; j < 16; j++)
//16*8列
lcd_wdat(*bmp++);
delayms(1);
}
lcd_wcmd(0x36); //寫完數據,開圖形顯示
} /********************************************************** 清屏子函數 **********************************************************/
void clr_screen()
{
lcd_wcmd(0x34); //擴充指令操作
delayms(5);
lcd_wcmd(0x30); //基本指令操作
delayms(5);
lcd_wcmd(0x01); //清屏
delayms(5);
}
/********************************************************** 寫字元串子函數 **********************************************************/
void wr_string(unsigned char str[])
{
unsigned char num = 0; while (str[num])
{
lcd_wdat(str[num++]); //寫數據
delayms(150); //延時形成逐字顯示效果
}
} /********************************************************** 主函數 **********************************************************/
void main()
{
delayms(100); //上電,等待穩定
lcd_init(); //初始化LCD while (1)
{
lcd_pos(1, 0); //設置顯示位置為第一行
wr_string(DIS1);
lcd_pos(2, 0); //設置顯示位置為第二行
wr_string(DIS2);
lcd_pos(3, 0); //設置顯示位置為第三行
wr_string(DIS3);
lcd_pos(4, 0); //設置顯示位置為第四行
wr_string(DIS4); delayms(5000); //停留2000***cdflag(); //螢幕閃爍 photodisplay(Photo1); //顯示圖片1
delayms(5000); //停留2000ms
clr_screen(); //清屏 }
} /*********************************************************/







巨大八爪魚
學業有成8 unsigned char code DIS1[] =
{
"撕裂你!!!!!"
};
unsigned char code DIS2[] =
{
"把你撕成碎片!!"
};
unsigned char code DIS3[] =
{
"我是愛激的男朋友"
};
unsigned char code DIS4[] =
{
"不准欺負我女朋友"
};
8樓 巨大八爪鱼 2014-8-13 23:45
當時我做得不好的一個地方是:一個螢幕用了4個數組

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
 
 
©2010-2024 Arslanbar [手機版] [桌面版]
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。