收藏 分享(赏)

led---中州科技大学chung-chou-university-of-science-and.ppt

上传人:天天快乐 文档编号:1116567 上传时间:2018-06-13 格式:PPT 页数:9 大小:394KB
下载 相关 举报
led---中州科技大学chung-chou-university-of-science-and.ppt_第1页
第1页 / 共9页
led---中州科技大学chung-chou-university-of-science-and.ppt_第2页
第2页 / 共9页
led---中州科技大学chung-chou-university-of-science-and.ppt_第3页
第3页 / 共9页
led---中州科技大学chung-chou-university-of-science-and.ppt_第4页
第4页 / 共9页
led---中州科技大学chung-chou-university-of-science-and.ppt_第5页
第5页 / 共9页
点击查看更多>>
资源描述

1、LEDPili LED,中州技術學院電子系 副教授 余文俊,LED顯示電路,2-1 LED顯示電路 輸出1或HLED亮輸出0或LLED滅,74245為緩衝器,PSOC 一般I/O代號,Example 1:outputPRT0DR=0xf0; / P0=11110000PRT0DR=0x0f; / P0=00001111PRT0DR=0xaa; / P0=10101010,Example 2 :outputunsigned char i=0;for (i=0;i=256;i=i+8)PRT1DR=i; ,PRT0DR8 bits8051之 P0PRT1DR8 bits8051之P1PRT2DR8

2、 bits8051之P2,請將 JP1,P3與 JP5用 8-PIN雙排 JUMP連接短路起來,而 SW8,SW9,與 SW10則往下切換以將其他控制 PORT開關 OFF進入 PSoC Designer後,請點選 Device Edit 的 Interconnect View,將 GlobalResources 的 CPU_Clock選在 93.75 KHz(最低速處理),再將所有腳位的 Drive狀態選擇為 Strong類型切記 Strong只能當輸出,設定IC 接腳為output,設定CPU工作頻率,當硬體設定完畢後,請點選工具列 Application Editor去編輯 Source

3、 Files 內的 main.c,然後鍵入基本 LED閃爍程式。,#include #include PSoCAPI.h void delay(unsigned int x);void main()while(1)delay(500);PRT0DR=0x55;PRT1DR=0x55;PRT2DR=0x55;delay(500);PRT0DR=0xaa;PRT1DR=0xaa;PRT2DR=0xaa;void delay(unsigned int x) unsigned i; for ( i = 0;i x;i+ ) ;,PILI LED,#include #include PSoCAPI.h

4、void delay(unsigned int x);void main(void) while(1)unsigned char j,i=0x01;for(j=0;j8;j+)PRT0DR=i;delay(200);i=i1; /enf of for / end of while / end of main,void delay(unsigned int x) unsigned int i; for ( i = 0;i x;i+ ) ;,練習題,8 個LED右移作(pili)8 個LED左移作(pili)8 個LED左右移作(pili)16個LED右移作(pili)16 個LED左移作(pili)16 個LED左右移作(pili)24個LED右移作(pili)24 個LED左移作(pili)24 個LED左右移作(pili),若是用組合語言來編輯程式,則請撰寫 Source Files 內的 main.asm,並鍵入基本 LED閃爍程式,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 大学课件

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报