标题:
help
[打印本页]
作者:
yang8249
时间:
2004-8-20 12:02
帮帮我啊。
LED老是没显示的啊。
为什么啊??
用MAX7219应该注意什么啊???
作者:
yang8249
时间:
2004-8-20 12:40
标题:
help
#include "reg51.h" #include "ps7219.h" /*void ps7219_reset() { unsigned char i; ps7219_pin_RST=0; for(i=0;i<125;i++) ps7219_delay(); ps7219_pin_RST=1; for(i=0;i<255;i++) ps7219_delay(); ps7219_pin_RST=0; for(i=0;i<125;i++) ps7219_delay(); } */ void ps7219_init() { ps7219_send_data(addr_close,0x01); ps7219_send_data(addr_scan_count,0x03); ps7219_send_data(addr_light_con,0x09); ps7219_send_data(addr_trans_mode,0xff); } void ps7219_echo(unsigned char add) { unsigned char i; ps7219_send_data(add,0x30); for(i=0;i<125;i++) ps7219_delay();ps7219_delay(); ps7219_send_data(add,0x6d); for(i=0;i<125;i++) ps7219_delay(); ps7219_send_data(add,0x79); for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0x33);for(i=0;i<125;i++) ps7219_delay(); ps7219_send_data(add,0x5b);for(i=0;i<125;i++) ps7219_delay(); ps7219_send_data(add,0x5f);for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0x70); for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0xff); for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0x73); for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0x7e); for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0x77); for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0x1f); for(i=0;i<125;i++)ps7219_delay(); ps7219_send_data(add,0x4e);for(i=0;i<125;i++) ps7219_delay(); ps7219_send_data(add,0x3d); for(i=0;i<125;i++) ps7219_delay(); ps7219_send_data(add,0x4f); for(i=0;i<125;i++) ps7219_delay(); ps7219_send_data(add,0x47); for(i=0;i<125;i++) ps7219_delay(); } void ps7219_send_data(unsigned char addr,da) { unsigned char i,byte_out; byte_out=addr; ps7219_pin_DIN=1; ps7219_pin_CLK=1; ps7219_pin_LOAD=0; for(i=0;i<8;i++) { ps7219_pin_CLK=1; ps7219_pin_DIN=(bit)(byte_out&0x80); byte_out=byte_out<<1; ps7219_pin_CLK=0; ps7219_delay(); } ps7219_pin_CLK=1; byte_out=da; for(i=0;i<7;i++) { ps7219_pin_CLK=1;//时钟信号 ps7219_pin_DIN=(bit)(byte_out&0x80); byte_out=byte_out<<1; ps7219_pin_CLK=0; ps7219_delay(); } ps7219_pin_LOAD=1;//得出最后一位时要把load变为1。不然会数据丢失. ps7219_pin_CLK=1; ps7219_pin_DIN=(bit)(byte_out&0x80); ps7219_pin_CLK=0; ps7219_delay(); ps7219_pin_CLK=1; } void ps7219_delay(void) { unsigned char i; for(i=0;i<125;i++) {} } void main() { ps7219_init(); ps7219_send_data(addr_test,0x01); while(1) {ps7219_init(); ps7219_echo(0x02); ps7219_echo(0x03);ps7219_echo(0x04);ps7219_echo(0x01);} } 这是用MAX7219的程序。 为什么没反应啊???
作者:
yang8249
时间:
2004-8-20 12:40
哪位高手帮帮我啊。
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0