#include<reg51.h> unsigned char miao=0,fen=0,shi=0; unsigned char miao1=0,miao2=0; unsigned char fen1=0,fen2=0; unsigned char shi1=0,shi2=0;
上傳時間: 2013-11-04
上傳用戶:ruan2570406
飛思卡爾智能車的舵機測試程序 #include <hidef.h> /* common defines and macros */#include <MC9S12XS128.h> /* derivative information */#pragma LINK_INFO DERIVATIVE "mc9s12xs128" void SetBusCLK_16M(void) { CLKSEL=0X00; PLLCTL_PLLON=1; //鎖相環電路允許位 SYNR=0x00 | 0x01; //SYNR=1 REFDV=0x80 | 0x01; POSTDIV=0x00; _asm(nop); _asm(nop); while(!(CRGFLG_LOCK==1)); CLKSEL_PLLSEL =1; } void PWM_01(void) { //舵機初始化 PWMCTL_CON01=1; //0和1聯合成16位PWM; PWMCAE_CAE1=0; //選擇輸出模式為左對齊輸出模式 PWMCNT01 = 0; //計數器清零; PWMPOL_PPOL1=1; //先輸出高電平,計數到DTY時,反轉電平 PWMPRCLK = 0X40; //clockA 不分頻,clockA=busclock=16MHz;CLK B 16分頻:1Mhz PWMSCLA = 0x08; //對clock SA 16分頻,pwm clock=clockA/16=1MHz; PWMCLK_PCLK1 = 1; //選擇clock SA做時鐘源 PWMPER01 = 20000; //周期20ms; 50Hz; PWMDTY01 = 1500; //高電平時間為1.5ms; PWME_PWME1 = 1;
上傳時間: 2013-11-04
上傳用戶:狗日的日子
This example provides a description of how to use the USART with hardware flowcontrol and communicate with the Hyperterminal.First, the USART2 sends the TxBuffer to the hyperterminal and still waiting fora string from the hyperterminal that you must enter which must end by '\r'character (keypad ENTER button). Each byte received is retransmitted to theHyperterminal. The string that you have entered is stored in the RxBuffer array. The receivebuffer have a RxBufferSize bytes as maximum. The USART2 is configured as follow: - BaudRate = 115200 baud - Word Length = 8 Bits - One Stop Bit - No parity - Hardware flow control enabled (RTS and CTS signals) - Receive and transmit enabled - USART Clock disabled - USART CPOL: Clock is active low - USART CPHA: Data is captured on the second edge - USART LastBit: The clock pulse of the last data bit is not output to the SCLK pin
上傳時間: 2013-10-31
上傳用戶:yy_cn
#include <reg51.h>#include <main.h>#include <interrupt.h> cs5460a應用電路(含源程序)bit code table_odd_even_bit[16]={0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0}; extern uchar rs485_timeout,pointer_buf485;extern uchar rs485_buf[MAX_485_LEN];extern uchar idata spi_buf[MAX_SPI_LEN];extern uchar pointer_send,send_len; extern uchar count_1s;//extern uint count_2min;extern uint count_10s;extern uchar oper_len,send_offset,chk_sum,send_i;extern bit flag_send_data,flag_level,flag_drdy,flag_data_ok;
上傳時間: 2014-01-24
上傳用戶:heart_2007
//------------------------------------------------------------------------------------//此程序為ADC轉換程序,可以選擇向ADC0BUSY寫1或用定時器0,1,2,3作為ADC的啟動信號。////------------------------------------------------------------------------------------//頭文件定義//------------------------------------------------------------------------------------//#include <c8051f330.h> #include <stdio.h> //-----------------------------------------------------------------------------// 定義16位特殊功能寄存器//----------------------------------------------------------------------------- sfr16 ADC0 = 0xbd; sfr16 TMR0RL = 0xca; sfr16 TMR1RL = 0xca; sfr16 TMR2RL =0xca; sfr16 TMR3RL =0xca; sfr16 TMR0 = 0xCC; sfr16 TMR1 = 0xCC; sfr16 TMR2 = 0xcc; sfr16 TMR3 = 0xcc; //-----------------------------------------------------------------------------// 全局變量定義//-----------------------------------------------------------------------------char i;int result; //-----------------------------------------------------------------------------//定義常量//-----------------------------------------------------------------------------#define SYSCLK 49000000 #define SAMPLE_RATE 50000 //------------------------------------------------------------------------------------// 定義函數//------------------------------------------------------------------------------------void SYSCLK_Init (void);void PORT_Init (void);void Timer0_Init (int counts);void Timer1_Init (int counts);void Timer2_Init (int counts);void Timer3_Init (int counts);void ADC0_Init(void);void ADC0_ISR (void);void ADC0_CNVS_ADC0h(void);//------------------------------------------------------------------------------------// 主程序//------------------------------------------------------------------------------------ void main (void) { int ADCRESULT[50] ; int k; PCA0MD &= ~0x40; // 禁止看門狗 SYSCLK_Init (); PORT_Init (); Timer0_Init (SYSCLK/SAMPLE_RATE); //Timer1_Init (SYSCLK/SAMPLE_RATE); //選擇相應的啟動方式 //Timer2_Init (SYSCLK/SAMPLE_RATE); //Timer3_Init (SYSCLK/SAMPLE_RATE); ADC0_Init(); EA=1; while(1) { //ADC0_CNVS_ADC0h(); k=ADC0; ADCRESULT[i]=result; //此處設斷點,觀察ADCRESULT的結果 } }
上傳時間: 2013-10-13
上傳用戶:SimonQQ
用途:測量地磁方向,測量物體靜止時候的方向,測量傳感器周圍磁力線的方向。注意,測量地磁時候容易受到周圍磁場影響,主芯片HMC5883 三軸磁阻傳感器特點(抄自網上): 1,數字量輸出:I2C 數字量輸出接口,設計使用非常方便。 2,尺寸小: 3x3x0.9mm LCC 封裝,適合大規模量產使用。 3,精度高:1-2 度,內置12 位A/D,OFFSET, SET/RESET 電路,不會出現磁飽和現象,不會有累加誤差。 4,支持自動校準程序,簡化使用步驟,終端產品使用非常方便。 5,內置自測試電路,方便量產測試,無需增加額外昂貴的測試設備。 6,功耗低:供電電壓1.8V, 功耗睡眠模式-2.5uA 測量模式-0.6mA 連接方法: 只要連接VCC,GND,SDA,SDL 四條線。 Arduino GND -> HMC5883L GND Arduino 3.3V -> HMC5883L VCC Arduino A4 (SDA) -> HMC5883L SDA Arduino A5 (SCL) -> HMC5883L SCL (注意,接線是A4,A5,不是D4,D5) 源程序: #include <Wire.h> #include <HMC5883L.h> HMC5883Lcompass; voidsetup() { Serial.begin(9600); Wire.begin(); compass = HMC5883L(); compass.SetScale(1.3); compass.SetMeasurementMode(Measurement_Continuous); } voidloop() { MagnetometerRaw raw = compass.ReadRawAxis(); MagnetometerScaled scaled = compass.ReadScaledAxis(); float xHeading = atan2(scaled.YAxis, scaled.XAxis); float yHeading = atan2(scaled.ZAxis, scaled.XAxis); float zHeading = atan2(scaled.ZAxis, scaled.YAxis); if(xHeading < 0) xHeading += 2*PI; if(xHeading > 2*PI) xHeading -= 2*PI; if(yHeading < 0) yHeading += 2*PI; if(yHeading > 2*PI) yHeading -= 2*PI; if(zHeading < 0) zHeading += 2*PI; if(zHeading > 2*PI) zHeading -= 2*PI; float xDegrees = xHeading * 180/M_PI; float yDegrees = yHeading * 180/M_PI; float zDegrees = zHeading * 180/M_PI; Serial.print(xDegrees); Serial.print(","); Serial.print(yDegrees); Serial.print(","); Serial.print(zDegrees); Serial.println(";"); delay(100); }
上傳時間: 2013-12-16
上傳用戶:stella2015
中文版詳情瀏覽: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-21
上傳用戶:wxqman
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-14
上傳用戶:zoudejile
通過以太網遠程配置Nios II 處理器 應用筆記 Firmware in embedded hardware systems is frequently updated over the Ethernet. For embedded systems that comprise a discrete microprocessor and the devices it controls, the firmware is the software image run by the microprocessor. When the embedded system includes an FPGA, firmware updates include updates of the hardware image on the FPGA. If the FPGA includes a Nios® II soft processor, you can upgrade both the Nios II processor—as part of the FPGA image—and the software that the Nios II processor runs, in a single remote configuration session.
上傳時間: 2013-11-22
上傳用戶:chaisz
Digital cameras have become increasingly popular over the last few years. Digital imagingtechnology has grown to new markets including cellular phones and PDA devices. With thediverse marketplace, a variety of imaging technology must be available. Imaging technologyhas expanded to include both charge-coupled device (CCD) and CMOS image sensors.
標簽: CoolRunner-II XAPP CPLD 390
上傳時間: 2013-10-16
上傳用戶:18710733152