16 16點陣顯示漢字原理及顯示程序 #include "config.h" #define DOTLED_LINE_PORT PORTB #define DOTLED_LINE_DDR DDRB #define DOTLED_LINE_PIN PINB #define DOTLED_LINE_SCKT PB1 #define DOTLED_LINE_SCKH PB5 #define DOTLED_LINE_SDA PB3 #define DOTLED_ROW_PORT PORTC #define DOTLED_ROW_DDR DDRC #define DOTLED_ROW_PIN PINC #define DOTLED_ROW_A0 PC0 #define DOTLED_ROW_A1 PC1 #define DOTLED_ROW_A2 PC2 #define DOTLED_ROW_A3 PC3 #define DOTLED_ROW_E PC4 uint8 font[] = { /*-- 調入了一幅圖像:這是您新建的圖像 --*/ /*-- 寬度x高度=16x16 --*/ 0x00,0x00,0x00,0x00,0x08,0x38,0x18,0x44,0x08,0x44,0x08,0x04,0x08,0x08,0x08,0x10, 0x08,0x20,0x08,0x40,0x08,0x40,0x08,0x40,0x3E,0x7C,0x00,0x00,0x00,0x00,0x00,0x00 }; static void TransmitByte(uint8 byte); static void SelectRow(uint8 row); static void FlipLatchLine(void); static void TransmitByte(uint8 byte) { uint8 i; for(i = 0 ; i < 8 ; i ++) { if(byte & (1 << i)) { DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA); } else { DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SDA); } //__delay_cycles(100); DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKH); //__delay_cycles(100); DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKH); //__delay_cycles(100); } } static void SelectRow(uint8 row) { //row -= 1; row |= DOTLED_ROW_PIN & 0xe0; DOTLED_ROW_PORT = row; } static void FlipLatchLine(void) { DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKT); DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKT); } void InitDotLedPort(void) { DOTLED_LINE_PORT &= ~(_BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH)); DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA); DOTLED_LINE_DDR |= _BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH) | _BV(DOTLED_LINE_SDA); DOTLED_ROW_PORT |= 0x1f; DOTLED_ROW_PORT &= 0xf0; DOTLED_ROW_DDR |= 0x1f; } void EnableRow(boolean IsEnable) { if(IsEnable) { DOTLED_ROW_PORT &= ~_BV(DOTLED_ROW_E); } else { DOTLED_ROW_PORT |= _BV(DOTLED_ROW_E); } } void PrintDotLed(uint8 * buffer) { uint8 i , tmp; for(i = 0 ; i < 16 ; i ++) { tmp = *buffer ++; TransmitByte(~tmp); tmp = *buffer ++; TransmitByte(~tmp); SelectRow(i); FlipLatchLine(); } } void main(void) { InitDotLedPort(); EnableRow(TRUE); while(1) { PrintDotLed(font); __delay_cycles(5000); } } //---------------------------------------------------- config.h文件 #ifndef _CONFIG_H #define _CONFIG_H //#define GCCAVR #define CPU_CYCLES 7372800L #ifndef GCCAVR #define _BV(bit) (1 << (bit)) #endif #define MSB 0x80 #define LSB 0x01 #define FALSE 0 #define TRUE 1 typedef unsigned char uint8; typedef unsigned int uint16; typedef unsigned long uint32; typedef unsigned char boolean; #include <ioavr.h> #include <inavr.h> #include "dotled.h" #endif //-----
上傳時間: 2013-11-18
上傳用戶:mnacyf
51單片機驅動步進電機(含電路圖和源程序代碼) 源程序:stepper.c stepper.hex /* * STEPPER.C * sweeping stepper's rotor cw and cww 400 steps * Copyright (c) 1999 by W.Sirichote */ #i nclude c:\mc5151io.h /* include i/o header file */ #i nclude c:\mc5151reg.h register unsigned char j,flag1,temp; register unsigned int cw_n,ccw_n; unsigned char step[8]={0x80,0xc0,0x40,0x60,0x20,0x30,0x10,0x90} #define n 400 /* flag1 mask byte 0x01 run cw() 0x02 run ccw() */
上傳時間: 2013-11-09
上傳用戶:釣鰲牧馬
C語言編程基礎:1. 十六進制表示字節0x5a:二進制為01011010B;0x6E為01101110。 2. 如果將一個16位二進數賦給一個8位的字節變量,則自動截斷為低8位,而丟掉高8位。 3. ++var表示對變量var先增一;var—表示對變量后減一。 4. x |= 0x0f;表示為 x = x | 0x0f; 5. TMOD = ( TMOD & 0xf0 ) | 0x05;表示給變量TMOD的低四位賦值0x5,而不改變TMOD的高四位。 6. While( 1 ); 表示無限執行該語句,即死循環。語句后的分號表示空循環體,也就是{;} 在某引腳輸出高電平的編程方法:(比如P1.3(PIN4)引腳)1. #include <AT89x52.h> //該頭文檔中有單片機內部資源的符號化定義,其中包含P1.3 2. void main( void ) //void 表示沒有輸入參數,也沒有函數返值,這入單片機運行的復位入口 3. { 4. P1_3 = 1; //給P1_3賦值1,引腳P1.3就能輸出高電平VCC 5. While( 1 ); //死循環,相當 LOOP: goto LOOP; 6. } 注意:P0的每個引腳要輸出高電平時,必須外接上拉電阻(如4K7)至VCC電源。在某引腳輸出低電平的編程方法:(比如P2.7引腳)代碼1. #include <AT89x52.h> //該頭文檔中有單片機內部資源的符號化定義,其中包含P2.7 2. void main( void ) //void 表示沒有輸入參數,也沒有函數返值,這入單片機運行的復位入口 3. { 4. P2_7 = 0; //給P2_7賦值0,引腳P2.7就能輸出低電平GND 5. While( 1 ); //死循環,相當 LOOP: goto LOOP; 6. } 在某引腳輸出方波編程方法:(比如P3.1引腳)代碼1. #include <AT89x52.h> //該頭文檔中有單片機內部資源的符號化定義,其中包含P3.1 2. void main( void ) //void 表示沒有輸入參數,也沒有函數返值,這入單片機運行的復位入口 3. { 4. While( 1 ) //非零表示真,如果為真則執行下面循環體的語句 5. { 6. P3_1 = 1; //給P3_1賦值1,引腳P3.1就能輸出高電平VCC 7. P3_1 = 0; //給P3_1賦值0,引腳P3.1就能輸出低電平GND 8. } //由于一直為真,所以不斷輸出高、低、高、低……,從而形成方波 9. } 將某引腳的輸入電平取反后,從另一個引腳輸出:( 比如 P0.4 = NOT( P1.1) )
上傳時間: 2013-11-02
上傳用戶:zengduo
/* 4位8段數碼管分別動態顯示“1234”, */ #include "7LEDShow.h" void main() { DIGPORT = 0; // 關閉顯示 TMOD = 0x01; // T0工作方式1 /* 2ms 定時設置 */ time0_tmp = 65536-time0*fosc/12; TH0 = (time0_tmp/256); TL0 = (time0_tmp%256); TR0 = 1; ET0 = 1; EA = 1; digbit = 0x01; // 從第一位數碼管開始
上傳時間: 2013-12-12
上傳用戶:kachleen
EEPROM為ATMEL公司的AT24C01A。單片機為ATMEL公司的AT89C51。2. 軟件說明 C語言為Franklin C V3.2。將源程序另存為testi2c.c,用命令C51 testi2c.cL51 TESTI2C.OBJOHS51 TESTI2C編譯,連接,得到TESTI2C.HEX文件,即可由編程器讀入并進行寫片,實驗。3.源程序#include <reg51.h>#include <intrins.h> #define uchar unsigned char#define uint unsigned int#define AddWr 0xa0 /*器件地址選擇及寫標志*/#define AddRd 0xa1 /*器件地址選擇及讀標志*/#define Hidden 0x0e /*顯示器的消隱碼*/
上傳時間: 2013-10-09
上傳用戶:hjshhyy
include "macrodefine.h"#include "lpc2294.h" //ADS1210初始化子程序void AD_Init(void){ Delayus(2); SPI1_Communation(0x64); SPI1_Communation(0x72); //單極性,SDOUT獨立,先MSB,REF使用內部 SPI1_Communation(0x20); //自校準模式,增益1,通道0 SPI1_Communation(0x87); //TURBO=16, SPI1_Communation(0xa0); //數據更新率100}//讀取ADS1210轉換結果子程序uint32 Read_AD_Data(void){ uint8 i=0; uint8 Data_Temp[3]; uint32 Result_HEX=0; Delayus(1); SPI1_Communation(0xc0); for(i=0;i<3;i++) { Data_Temp[i] =SPI1_Communation(0xff); }
上傳時間: 2013-10-10
上傳用戶:suicone
中文版詳情瀏覽:http://www.elecfans.com/emb/fpga/20130715324029.html Xilinx UltraScale:The Next-Generation Architecture for Your Next-Generation Architecture The Xilinx® UltraScale™ architecture delivers unprecedented levels of integration and capability with ASIC-class system- level performance for the most demanding applications. The UltraScale architecture is the industr y's f irst application of leading-edge ASIC architectural enhancements in an All Programmable architecture that scales from 20 nm planar through 16 nm FinFET technologies and beyond, in addition to scaling from monolithic through 3D ICs. Through analytical co-optimization with the X ilinx V ivado® Design Suite, the UltraScale architecture provides massive routing capacity while intelligently resolving typical bottlenecks in ways never before possible. This design synergy achieves greater than 90% utilization with no performance degradation. Some of the UltraScale architecture breakthroughs include: • Strategic placement (virtually anywhere on the die) of ASIC-like system clocks, reducing clock skew by up to 50% • Latency-producing pipelining is virtually unnecessary in systems with massively parallel bus architecture, increasing system speed and capability • Potential timing-closure problems and interconnect bottlenecks are eliminated, even in systems requiring 90% or more resource utilization • 3D IC integration makes it possible to build larger devices one process generation ahead of the current industr y standard • Greatly increased system performance, including multi-gigabit serial transceivers, I/O, and memor y bandwidth is available within even smaller system power budgets • Greatly enhanced DSP and packet handling The Xilinx UltraScale architecture opens up whole new dimensions for designers of ultra-high-capacity solutions.
標簽: UltraScale Xilinx 架構
上傳時間: 2013-11-13
上傳用戶:瓦力瓦力hong
This white paper discusses how market trends, the need for increased productivity, and new legislation have accelerated the use of safety systems in industrial machinery. This TÜV-qualified FPGA design methodology is changing the paradigms of safety designs and will greatly reduce development effort, system complexity, and time to market. This allows FPGA users to design their own customized safety controllers and provides a significant competitive advantage over traditional microcontroller or ASIC-based designs. Introduction The basic motivation of deploying functional safety systems is to ensure safe operation as well as safe behavior in cases of failure. Examples of functional safety systems include train brakes, proximity sensors for hazardous areas around machines such as fast-moving robots, and distributed control systems in process automation equipment such as those used in petrochemical plants. The International Electrotechnical Commission’s standard, IEC 61508: “Functional safety of electrical/electronic/programmable electronic safety-related systems,” is understood as the standard for designing safety systems for electrical, electronic, and programmable electronic (E/E/PE) equipment. This standard was developed in the mid-1980s and has been revised several times to cover the technical advances in various industries. In addition, derivative standards have been developed for specific markets and applications that prescribe the particular requirements on functional safety systems in these industry applications. Example applications include process automation (IEC 61511), machine automation (IEC 62061), transportation (railway EN 50128), medical (IEC 62304), automotive (ISO 26262), power generation, distribution, and transportation. 圖Figure 1. Local Safety System
上傳時間: 2013-11-05
上傳用戶:維子哥哥
Abstract: There are many things to consider when designing a power supply for a field-programmablegate array (FPGA). These include (but are not limited to) the high number of voltage rails, and thediffering requirements for both sequencing/tracking and the voltage ripple limits. This application noteexplains these and other power-supply considerations that an engineer must think through whendesigning a power supply for an FPGA.
上傳時間: 2013-11-10
上傳用戶:iswlkje
UART 4 UART參考設計,Xilinx提供VHDL代碼 uart_vhdl This zip file contains the following folders: \vhdl_source -- Source VHDL files: uart.vhd - top level file txmit.vhd - transmit portion of uart rcvr.vhd - - receive portion of uart \vhdl_testfixture -- VHDL Testbench files. This files only include the testbench behavior, they do not instantiate the DUT. This can easily be done in a top-level VHDL file or a schematic. This folder contains the following files: txmit_tb.vhd -- Test bench for txmit.vhd. rcvr_tf.vhd -- Test bench for rcvr.vhd.
上傳時間: 2013-11-07
上傳用戶:jasson5678