飞思卡尔智能车的舵机测试程序 #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
上传用户:狗日的日子
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b这是条件运算符的基本例子。
上传时间: 2015-01-08
上传用户:lifangyuan12
202用列主元消取法解线性方程 ***********★*******★********★************ 一.功能 当线性方程组有唯一解时求其解 。 二.算法简介消元过程,设方程组为 Ax=b (1)公式(1)有增广矩阵 a11 a12….a1n b1 a21 a22…a2n b2 (A,B)= ………………. an1 an2…ann bn
上传时间: 2015-03-02
上传用户:jhksyghr
仿真步骤如下: 1、把3个帖子的内容分别保存为51t9py.c,51t9py_indexa.h,5py_mb.h,放在同一目录下,将51t9py.c加入工程编译 2、由于Keil的模拟串口是单字节显示,汉字显示为乱码,所以要加挂RICHWIN或RichView这种会重新刷新显示的中文平台,或手工刷新屏幕,所以请先到 http://www.pchome.net/dl/chinese.htm 下载RichView,安装运行 3、在Keil环境下可以直接按“Ctrl+F5”键仿真,按“F5”全速运行,切换到在串口依次输入: // 64*.6 426***.5 98*.7 936.3 586.1 4826*.1 9464*.7 64*.6试试:-) 4、按键对应(根据我自己的手机设置的,全部在PC的小键盘操作):
上传时间: 2013-12-15
上传用户:sk5201314
用Doolittle方法求解此方程组; 1.先由U[1][i]=a[1][i] 求的U的第一行,在根据L[i][1]=a[i][1]/U[1][1] 求的L的第一列;2..然后根据公式求得U,L其他的值; 3 回带求解得到X
上传时间: 2013-12-10
上传用户:洛木卓
GM(1,1)灰色模型,便于了解其混沌特性,程序很短,由matlab编译,
标签:
上传时间: 2015-05-30
上传用户:yzy6007
给定n个大小不等的圆c , c , , cn 1 2 ,现要将这n个圆排进一个矩形框中,且要求各圆 与矩形框的底边相切。圆排列问题要求从n个圆的所有排列中找出有最小长度的圆排列。例 如,当n=3,且所给的3 个圆的半径分别为1,1,2时,这3个圆的最小长度的圆排列如图 所示。其最小长度为2 + 4 2 。
上传时间: 2013-11-25
上传用户:lunshaomo
* Function: * 1. Replace the first oldstr with newstr in srcstr * Arguments: * IN : * srcstr * oldstr * newstr * OUT : * srcstr * Return: * 1. If find and replace one oldstr with newstr in srcstr , return 1 * 2. If find no oldstr in srcstr , return 0 * 3. If error (malloc return NULL) return -1 * Notes: * 1. srcstr should be large size enough.
标签: Arguments Function Replace oldstr
上传时间: 2014-12-20
上传用户:Yukiseop
The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d . Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet. Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1. Definition
标签: government streamline important alphabet
上传时间: 2015-06-09
上传用户:weixiao99
在目录“\上三角矩阵类的实现”中给定了文件triMat.cpp、triMat.h,请把triMat.h文件中的9个填空位置补上正确的代码,使triMat.cpp能完成上三角矩阵的加、减、乘运算。要求输入: 输入矩阵维数:4 输入矩阵a的元素(包括0): 1 2 3 4 0 1 2 3 0 0 1 2 0 0 0 1 输入矩阵b的元素(包括0): 1 2 3 4 0 1 2 3 0 0 1 2 0 0 0 1
上传时间: 2014-11-11
上传用户:时代电子小智