PIC單片機(jī)利用視覺(jué)暫留現(xiàn)象顯示字符
利用PoV,還可以制作電子小玩意,比如利用幾個(gè)LED,就能顯示圖案,字符等。
本文引用地址:http://2s4d.com/article/201611/318658.htm下面是一個(gè)利用PoV顯示時(shí)鐘的例子:
下面是一段利用PoV顯示字符的PIC單片機(jī)程序,利用CCS C編譯器編譯:
主程序文件: pov.c




#fuses HS,NOWDT,NOPROTECT,NOLVP /* DONNOT use WDT */

/* Port D drives the LEDs */


#use delay(clock = 4000000) /* the crystal frequency is 4.000 MHz*/

void display_string(int8 *str)

















/**********************************************************















set_tris_d(0x00); /* set portD to output mode */

while(1)





字模頭文件: font.h



#define FONT_WIDTH 5

/*








void get_font_matrix(int8 ascii_code, int8 *buf);

字模c文件: font.c






const int8 font_blank_table[FONT_BLANK_TABLE_SIZE] = {



const int8 font_number_table[FONT_NUMBER_TABLE_SIZE] = {












const int8 font_uletter_table[FONT_UPPER_CASE_TABLE_SIZE] = {




























const int8 font_lletter_table[FONT_LOWER_CASE_TABLE_SIZE] = {




























void get_font_matrix(int8 ascii_code, int8 *buf)




if(ascii_code == )




























這段程序會(huì)在PIC單片機(jī)的Port D點(diǎn)亮一排LED,用手晃動(dòng)這排LED,就會(huì)看到“china”字樣。
評(píng)論