1. 求大神帮忙写关于基于51单片机的流量传感器的C程序代码(本人是学硬件的,但是这种要写代码的一点也不会)
是不是只是求这个脉冲而已,还要其它的显示什么的吗?可以私信给我。
2. 我想问一下~那个~用STC89C52单片机产生一个PWM波的C语言程序怎么写啊?
首先89C52内部没有硬件PWM发生器,只能通过定时器模拟!你可以通过两个定时器,T0控制周期,T1控制占空比。
例如:实现周期为1000us,占空比为20%的PWM,用P1.0实现
首先你设置T0为65536-1000 (12M晶振)
T1为65536-200
首先初始化P1.0=1,两个定时器同时打开,在定时器T1中断时拉低P1.0,在定时器T0中断时在拉高P1.0,同时将两定时器初始值初始化T0为65536-1000 ,T1为65536-200
希望对你有用,呵呵!!!
3. Java 求大神帮忙!!求代码
代码如下:
import java.io.File;public class FileTest {public static void main(String[] args){File file = new File("C:\\");File[] files = file.listFiles();for (int i=0;i");}else {System.out.println(files[i].getName() + " " + files[i].length());}}}}
如果有帮助到你,请点击采纳
4. C语言代码 求大神帮忙!!
三个空依次是
temp=a[i];
a[i]=a[N-1-i];
a[N-1-i]=temp;
5. 求大神帮忙翻译一下下面这段代码!!!!!!!!!急!!!!!!!!!
这些代码没什么实际意义,都是声明API而已,一个个告诉你这些API都是什么作用吧。
1、OSGetProfileInt:取得win.ini初始化文件中指定条目的一个整数值
(参数lpAppName,String,欲在其中搜索条目的小节名。这个字串不区分大小写;
lpKeyName,String,欲获取的项名或条目名。这个字串不区分大小写;
nDefault,Long,指定在条目未找到时返回的默认值)
2、OSGetProfileSection:获取指定小节(在win.ini文件中)所有项名和值的一个列表
(参数lpAppName,String,欲获取的小节。这个字串不区分大小写;
lpReturnedString,String,用于容纳项和值字串列表的一个缓冲区。每个字串都用一个NULL分隔,最后一个字串用两个NULL字符中止;
nSize Long,lpReturnedString缓冲区的大小,在windows 95中最大为32767 )
3、OSGetProfileString :为win.ini初始化文件中指定的条目取得字串
(参数lpAppName,String,要在其中查找条目的小节名。这个字串不区分大小写。如果为vbNullString,则在lpReturnedString缓冲区装载这个.ini文件的所有小节的一个列表 ;
lpKeyName,String,欲获取的项名或条目名。这个字串不区分大小写。如果为vbNullString,则在lpReturnedString缓冲区装载指定小节内所有项的一个列表;
lpDefault,String,指定条目未找到时返回的默认值。可设为空("");
lpReturnedString,String,指定一个预先初始化好的字串缓冲区,长度至少为nSize个字符;
nSize,Long,装载到lpReturnedString缓冲区的最大字符数)
4、OSWriteProfileSection:为Win.ini初始化文件中一个指定的小节设置所有项名和值
(参数lpAppName,String,要设置的小节。这个字串不区分大小写;
lpString,String,项和值字串的一个列表。每个字串都用一个NULL字符分隔,最后一个字串后面用两个NULL表示中止。如lpAppName指定的小节不存在,则用那个名字新建一个小节,并将其追加到初始化文件的最后。如果存在,则当前的所有项名和值都会被这个缓冲区中指定的数据取代 )
5、OSWriteProfileString:在Win.ini初始化文件指定小节内设置一个字串。
(参数lpszSection,String,指定要在其中写入新串的小节。如尚不存在,会创建这个小节。这个字串不区分大小写;
lpszKeyName,String,要设置的项名或条目名。这个字串不区分大小写。用vbNullString可删除这个小节的所有设置项;
lpszString,String,指定为这个项写入的字串值。用vbNullString表示删除这个项现有的字串。)
同时又声明了两个常量:
nBUFSIZEINI = 1024
nBUFSIZEINIALL = 4096
6. 有没有会用Java编写一下这个代码,求大神帮忙!
public class Main { //入口
public static void main(String[] args) {
DPHero ez = new DPHero();
Support qinnv = new Support();
ez.setName("伊泽瑞尔");
qinnv.setName("琴女");
}
}
***
public interface Ad { //ad接口
public void physicAttack();
}
***
public interface Ap { //ap接口
public void magicAttack();
}
***
public interface Healer { //healer接口
public void heal();
}
***
public class Hero { //hero类
private String name;
private int hp;
private int armor;
private int movespeed;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getHp() {
return hp;
}
public void setHp(int hp) {
this.hp = hp;
}
public int getArmor() {
return armor;
}
public void setArmor(int armor) {
this.armor = armor;
}
public int getMovespeed() {
return movespeed;
}
public void setMovespeed(int movespeed) {
this.movespeed = movespeed;
}
}
***
public class DPHero extends Hero implements Ad, Ap { //dphero类
@Override
public void physicAttack() {
System.out.println("可以进行物理攻击");
}
@Override
public void magicAttack() {
System.out.println("可以进行魔法攻击");
}
}
***
public class Support extends Hero implements Healer { support类
@Override
public void heal() {
System.out.println("加血");
}
public void heal(Hero hero) {
System.out.println("为"+ hero.getName() +"加血");
}
public void heal(Hero hero,int hp){
System.out.println("为"+ hero.getName() + "加"+ hp +"血");
}
}
7. 求大神帮写一液晶+STC89c52单片机+4*4矩阵键盘实现简易计算器的C语言程序,实现加减乘除以及扩展功能
没有液晶的,以前做了一个有一个数码管的,发给你供参考。
#include#define uchar unsigned char;uchar LED1,LED2,LED3,LED4;uchar keyval,calflag,s_dat,d_dat;uchar distab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0xff};unsigned int number,r_dat;void delay(unsigned int a){ unsigned int i,j; for(i=0;i3)number=0;}main(){ TMOD = 0x01; number = 0; TH0=0xf4; TL0=0x48; TR0=1; ET0=1; EA=1; LED1=0; LED2=0; LED3=0; LED4=0; while(1) { getkey(); switch(keyval) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: LED3=LED4; LED4=keyval; LED1=0; LED2=0; break; case 10:break; //"ON" case 11: //"=" d_dat=LED3*10+LED4; dealdat(); break; case 12: //"/" calflag=3; s_dat=LED3*10+LED4; LED3=0; LED4=0; break; case 13: //"*" calflag=2; s_dat=LED3*10+LED4; LED3=0; LED4=0; break; case 14: //"-" calflag=1; s_dat=LED3*10+LED4; LED3=0; LED4=0; break; case 15: //"+" calflag=0; s_dat=LED3*10+LED4; LED3=0; LED4=0; break; default:break; } }}
8. 求大神帮忙用JAVA编一下代码!!!ji'ji'ji
package com.zhidao;
//几何图形
public interface Geometry {
//求周长
public double circumference();
//求面积
public double area();
}
package com.zhidao;
public class Rectangle implements Geometry{
private double width;
private double height;
public Rectangle(double width, double height) {
this.width = width;
this.height = height;
}
public Rectangle() {
this.width = 0;
this.height = 0;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
@Override
public double circumference() {
return 2*(width+height);
}
@Override
public double area() {
return width*height;
}
}
package com.zhidao;
public class Circle implements Geometry{
private static final double PI = 3.14159265;
//半径
private double redius;
public Circle() {
this.redius = 0;
}
public Circle(double redius) {
this.redius = redius;
}
public double getRedius() {
return redius;
}
public void setRedius(double redius) {
this.redius = redius;
}
@Override
public double circumference() {
return 2*PI*redius;
}
@Override
public double area() {
return PI*redius*redius;
}
}
package com.zhidao;
public class TestDriver {
public static void main(String[] args) {
Geometry rectangle = new Rectangle(100.544,200.567);
System.out.println("矩形周长="+rectangle.circumference());
System.out.println("矩形面积="+rectangle.area());
Geometry circle = new Circle(20.678);
System.out.println("圆周长="+circle.circumference());
System.out.println("圆面积="+circle.area());
}
}