AT89C2051驅動步進電機的電路和源碼:AT89C2051驅動步進電機的電路和源碼 程序: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.hregister 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() */main(){ flag1=0; serinit(9600); disable(); /* no need timer interrupt */ cw_n = n; /* initial step number for cw */ flag1 |=0x01; /* initial enable cw() */while(1){ { tick_wait(); /* wait for 10ms elapsed */energize(); /* round-robin execution the following tasks every 10ms */ cw(); ccw(); } }}cw(){ if((flag1&0x01)!=0) { cw_n--; /* decrement cw step number */ if (cw_n !=0) j++; /* if not zero increment index j */ else {flag1&=~0x01; /* disable cw() execution */ ccw_n = n; /* reload step number to ccw counter */ flag1 |=0x02; /* enable cww() execution */ } }
標簽:
C2051
2051
89C
AT
上傳時間:
2013-11-21
上傳用戶:boyaboy
抽樣z變換頻率抽樣理論:我們將先闡明:(1)z變換與DFT的關系(抽樣z變換),在此基礎上引出抽樣z變換的概念,并進一步深入討論頻域抽樣不失真條件。(2)頻域抽樣理論(頻域抽樣不失真條件)(3)頻域內插公式一、z變換與DFT關系(1)引入連續傅里葉變換引出離散傅里葉變換定義式。離散傅里葉變換看作是序列的傅里葉變換在 頻 域 再 抽 樣 后 的 變 換 對.在Z變換與L變換中,又可了解到序列的傅里葉 變換就是單位圓上的Z 變 換.所以對序列的傅里葉變換進行頻域抽樣時, 自 然可以看作是對單位圓上的 Z變換進行抽樣. (2)推導Z 變 換 的 定 義 式 (正 變 換) 重 寫 如 下: 取z=ejw 代 入 定 義 式, 得 到 單 位 圓 上 Z 變 換 為w是 單 位 圓 上 各 點 的 數 字 角 頻 率.再 進 行 抽 樣-- N 等 分.這 樣w=2kπ/N, 即w值為0,2π/N,4π/N,6π/N…, 考慮到x(n)是N點有限長序列, 因而n只需0~N-1即可。將w=2kπ/N代入并改變上下限, 得 則這正是離散傅里葉變換 (DFT)正變換定義式.
標簽:
抽樣
變換
頻率
上傳時間:
2014-12-28
上傳用戶:zhaistone
The μPSD32xx family, from ST, consists of Flash programmable system devices with a 8032 MicrocontrollerCore. Of these, the μPSD3234A and μPSD3254A are notable for having a complete implementationof the USB hardware directly on the chip, complying with the Universal Serial Bus Specification, Revision1.1.This application note describes a demonstration program that has been written for the DK3200 hardwaredemonstration kit (incorporating a μPSD3234A device). It gives the user an idea of how simple it is to workwith the device, using the HID class as a ready-made device driver for the USB connection.IN-APPLICATION-PROGRAMMING (IAP) AND IN-SYSTEM-PROGRAMMING (ISP)Since the μPSD contains two independent Flash memory arrays, the Micro Controller Unit (MCU) can executecode from one memory while erasing and programming the other. Product firmware updates in thefield can be reliably performed over any communication channel (such as CAN, Ethernet, UART, J1850)using this unique architecture. For In-Application-Programming (IAP), all code is updated through theMCU. The main advantage for the user is that the firmware can be updated remotely. The target applicationruns and takes care on its own program code and data memory.IAP is not the only method to program the firmware in μPSD devices. They can also be programmed usingIn-System-Programming (ISP). A IEEE1149.1-compliant JTAG interface is included on the μPSD. Withthis, the entire device can be rapidly programmed while soldered to the circuit board (Main Flash memory,Secondary Boot Flash memory, the PLD, and all configuration areas). This requires no MCU participation.The MCU is completely bypassed. So, the μPSD can be programmed or reprogrammed any time, anywhere, even when completely uncommitted.Both methods take place with the device in its normal hardware environment, soldered to a printed circuitboard. The IAP method cannot be used without previous use of ISP, because IAP utilizes a small amountof resident code to receive the service commands, and to perform the desired operations.
標簽:
Demonstration
3200
USB
for
上傳時間:
2014-02-27
上傳用戶:zhangzhenyu