精华内容
下载资源
问答
  • 8052单片机模拟器

    2010-08-12 13:15:47
    8052单片机模拟器,模拟8052单片机编程
  • 单片机模拟器

    千次阅读 2005-10-20 17:33:00
    目前正在写一个51系列单片机模拟器,会陆续写一些开发过程及进展情况。。。
    目前正在写一个51系列单片机的模拟器,会陆续写一些开发过程及进展情况。。。
    展开全文
  • mcs51单片机模拟器

    2010-04-02 23:59:07
    mcs51单片机模拟器, Intel MCS-51系列 单片机模拟器 ,由昆明理工大学计算机系开发。
  • 8052-Sim单片机模拟器.exe 8052-Sim单片机模拟器.exe 8052-Sim单片机模拟器.exe 8052-Sim单片机模拟器.exe
  • Virtual51单片机模拟器SDK_RENEWAL.7z Virtual51单片机模拟器SDK_RENEWAL.7z ========================================= 可以在PC端仿真的MCS-51单片机模拟器,特别方便各位 单片机开发、学习人员使用、、 本模拟器...
  • 8051单片机模拟器

    2009-04-17 10:38:47
    可以实现单片机的模拟 功能很强大 在新建文件后,先保存 后缀.asm
  • 51单片机学习资料打包共享\8051模拟器.pdf 51单片机学习资料打包共享\8051模拟器.pdf
  • 单片机模拟器Virtual51

    2008-09-29 09:41:02
    Virtual51是一个动态可视化的MCS-51全功能模拟程序,可以让你在Virtual51上运行MCS-51程序就如同在硬体上一 样。提供8KB的程序空间,256字节的RAM,16KB的XRAM,2个16位的定时/计数器(T0 和 T1),一个实时时钟,...
  • 伟服单片机软件模拟器电源技术网.rar 伟服单片机软件模拟器电源技术网.rar 伟服单片机软件模拟器电源技术网.rar 伟服单片机软件模拟器电源技术网.rar
  • 单片机8051模拟器

    2009-03-30 18:26:56
    单片机8051模拟器 单片机汇编的 110条指令的运行,各种寄存器,存储器,端口 外部设备等
  • 本文主要介绍 PIC单片机软件模拟器PICSIM及其使用,帮你更多的认识PIC单片机
  • 51单片机指令模拟器

    千次阅读 2020-02-23 15:50:45
    MCS-51单片机指令模拟器,除了DA指令外,其它指令都可以模拟。 实现了254条指令的模拟,并进行测试,但是测试还不够完整,只对关键指令完成测试,其它指令测试均人为检查过,DA指令还未实现,后面会实现 请到我的...

    MCS-51单片机指令模拟器,全部指令都可以模拟。实现了对RAM的数据写入的探查,可通过宏定义启用配置,并通过代码配置侦测函数,代码中有示例。

    请到我的github中,或者我的私人博客中下载,地址:

    http://www.iotscitech.cn/post/11

    https://github.com/lotoohe-space/SIM

    展开全文
  • 单片机LCD字模模拟器

    2013-05-31 14:21:32
    单片机LCD字模模拟器,图片 字符 汉字等字模的生成,方便开发
  • 本文介绍单片机在汽车驾驶模拟器中的应用,此控制系统在汽车驾驶模拟器中经实验验证其输出与实际很接近,精确度满足模拟要求。
  • 基于单片机的简易钢琴模拟器.pdf
  • 基于单片机的数据采集系统成本相对较低,接口的可扩展性好,同时,模拟量和开关量的预处理工作也可以由单片机来完成。系统完全可以满足汽车驾驶模拟器的交互性和实时性要求,已在所开发的汽车驾驶模拟器中得到了应用...
  • 汽车驾驶模拟器是一种能正确模拟汽车的驾驶操纵动作,获得实车驾驶感觉的仿真系统。目前的汽车驾驶模拟器集合了传感器、计算机三维实时动画、计算机接口、人工智能、数据通信、网络、多媒体等多种先进技术,主要用于...
  • 为实现基于单片机的步进电机式模拟器仪表系统,采用C8051F340单片机为控制器,单片机输出的时序方波作为步进电机驱动芯片的控制信号,步进电机带动指针显示汽车行驶过程中的实时信息。系统还利用LED进行相应工况的...
  • 基于PLC与单片机的滑翔伞模拟器控制系统设计.pdf
  • 针对航管应答机在地面测试时需要专用气压源提供模拟高度信息的缺点,分析了航管应答机高度接口 信号的特性,总结出高度数值与高度接口信号之间的对应关系,设计了基于单片机的航管应答机高度模拟器 硬件电路,...
  • 基于AT89S52单片机的陆标定位模拟器的设计
  • 基于单片机四路抢答器模拟器课程设计,应用于80C51的课程设计
  • 硬件上使用了XNUCLEO的stm32-f103rb单片机(主控),音频播放模块(播放音频),LED灯(阵列表示台阶),超声波传感器(障碍物位置输入)。 软件上用mbed online compiler和keil5测试程序,再使用st-link烧录进...

    项目介绍&总结

    这个大一暑期和大二上学期做的一个合作项目。
    我们希望做一个硬件来实现对音游的实体化,所采用了音乐楼梯的形式——检测人的位置来击打掉落的光快,从而发出音乐。
    硬件上使用了XNUCLEO的stm32-f103rb单片机(主控),音频播放模块(播放音频),LED灯(阵列表示台阶),超声波传感器(障碍物位置输入)。
    软件上用mbed online compiler和keil5测试程序,再使用st-link烧录进单片机。
    我主要参与了开始的创意确立和方案制定,完成了代码中部分逻辑的实现和最后实物的焊接与组装。
    虽然付出了很多努力,但最终效果不尽如人意。主要是因为硬件设计需要能力要求较高,我们当时的水平难以达到,走了很多弯路。而且使用的超声波传感器比较玄学,测量精度不佳。综上种种,要想快速实现idea,并且实现快速迭代,还是软件好用。或许有机会再去啃硬件的“深坑”。

    效果图

    效果图

    代码部分

    #include "mbed.h"
    
    //define pins of LEDs(6*6 matrix)
    
    BusOut dec0(PA_10,PB_3,PB_5,PB_4);//CN9
    BusOut dec1(PB_10,PA_8,PA_9,PC_7);//CN5
    BusOut dec2(PB_6,PA_7,PA_6,PA_5);//CN8
    BusOut dec3(PB_9,PB_8,PC_9,PC_3);//CN7
    BusOut dec4(PC_2,PA_0,PA_1,PC_13);//CN7
    BusOut dec5(PB_7,PA_15,PA_14,PA_13);//CN9
    
    //define pins of sensors
    DigitalOut trig_L(PC_8);//
    DigitalOut trig_R(PC_6);//
    DigitalIn echo_L(PC_5);
    DigitalIn echo_R(PA_12);//CN10
    int position;
    
    //define pins of audio module
    BusOut aud(PC_12,PC_10,PC_11,PD_2,PC_4,PB_13);//CN10 0d000001~0d100100
    //PwmOut buz(PB_13);
    
    //define pins of song selector(switch)
    DigitalIn song(PA_11);
    int SongNum=0;
    
    //define pins of start botton
    DigitalIn sta(PB_12);
    
    //define pins of response LEDs
    DigitalOut red(PB_11);//?
    DigitalOut green(PB_2);//?
    
    //pc communication(for debug)
    Serial pc(USBTX, USBRX);
    
    //define buzzer frequencies of keys
    
    /*float S_0=0;
    float C_3=261.63/2,c_3=277.18/2,D_3=293.66/2,d_3=311.13/2,E_3=329.63/2,F_3=349.23/2,
    f_3=369.99/2,G_3=392.00/2,g_3=415.30/2,A_3=440.00/2,a_3=466.16/2,B_3=493.88/2;
    float C_4=261.63,c_4=277.18,D_4=293.66,d_4=311.13,E_4=329.63,F_4=349.23,
    f_4=369.99,G_4=392.00,g_4=415.30,A_4=440.00,a_4=466.16,B_4=493.88;
    float C_5=261.63*2,c_5=277.18*2,D_5=293.66*2,d_5=311.13*2,E_5=329.63*2,F_5=349.23*2,
    f_5=369.99*2,G_5=392.00*2,g_5=415.30*2,A_5=440.00*2,a_5=466.16*2,B_5=493.88*2;
    */
    
    int S_0=0;
    int C_3=1,c_3=2,D_3=3,d_3=4,E_3=5,F_3=6,
        f_3=7,G_3=8,g_3=9,A_3=10,a_3=11,B_3=12;
    int C_4=13,c_4=14,D_4=15,d_4=16,E_4=17,F_4=18,
        f_4=19,G_4=20,g_4=21,A_4=22,a_4=23,B_4=24;
    int C_5=25,c_5=26,D_5=27,d_5=28,E_5=29,F_5=30,
        f_5=31,G_5=32,g_5=33,A_5=34,a_5=35,B_5=36;
    
    
    //define combo counter
    int com = 0;
    
    //define songs
    int TestSong[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36};
    int   WeightOfTheWorld[]= {
        S_0,S_0,S_0,S_0,S_0,A_3,E_4,D_4,G_4,A_3,E_4,D_4,G_4,A_3,E_4,D_4,A_4,A_3,E_4,D_4,A_4,
        A_3,E_4,D_4,G_4,A_3,E_4,D_4,G_4,A_3,E_4,D_4,A_4,A_3,A_4,A_4,S_0,
        A_3,A_3,A_3,A_3,A_3,B_3,C_4,S_0,A_3,A_3,A_3,A_3,A_3,B_3,C_4,S_0,
        C_4,D_4,E_4,S_0,S_0,S_0,E_4,F_4,E_4,E_4,D_4,D_4,S_0,S_0,S_0,S_0,
        A_3,A_3,A_3,A_3,A_3,B_3,C_4,S_0,A_3,A_3,A_3,A_3,A_3,B_3,C_4,S_0,
        C_4,S_0,G_4,S_0,S_0,S_0,G_4,F_4,E_4,E_4,D_4,D_4,S_0,S_0,S_0,S_0,
        D_4,C_4,B_3,C_4,S_0,S_0,D_4,S_0,S_0,E_4,S_0,S_0,F_4,E_4,C_4,S_0,
        G_3,C_4,C_4,C_4,C_4,D_4,C_4,D_4,C_4,D_4,E_4,E_4,S_0,S_0,S_0,S_0,
        C_4,S_0,S_0,D_4,S_0,S_0,C_4,E_4,F_4,E_4,C_4,S_0,S_0,//3
        C_4,G_4,G_4,G_4,g_4,G_4,F_4,d_4,F_4,D_4,S_0,S_0,S_0,S_0,S_0,//1
        C_4,D_4,E_4,S_0,S_0,E_4,D_4,S_0,S_0,//7
        B_3,S_0,C_4,C_4,B_3,C_4,S_0,G_4,G_4,S_0,S_0,S_0,//4
        B_3,S_0,C_4,C_4,B_3,G_4,S_0,A_4,G_4,S_0,S_0,S_0,//4
        C_4,D_4,E_4,F_4,E_4,F_4,E_4,D_4,C_4,D_4,S_0,S_0,S_0,B_3,C_4,S_0,
        B_3,S_0,C_4,C_4,B_3,C_4,S_0,G_4,G_4,S_0,S_0,S_0,//4
        B_3,S_0,C_4,C_4,B_3,G_4,S_0,A_4,G_4,S_0,S_0,S_0,//4
        C_4,D_4,E_4,F_4,E_4,F_4,E_4,D_4,C_4,D_4,S_0,S_0,S_0,S_0,//2
        E_4,D_4,C_4,B_3,C_4,C_4,C_4,C_4,B_3,C_4,E_4,G_4,S_0,S_0,C_4,C_4,
        S_0,S_0,S_0,S_0,B_3,C_4,C_4,S_0,S_0,S_0,S_0,S_0,//4
        E_3,S_0,S_0,S_0,B_3,S_0,S_0,C_4,E_3,S_0,S_0,S_0,S_0,//3
        E_3,S_0,S_0,S_0,B_3,S_0,S_0,C_4,S_0,D_4,C_4,C_4,S_0,S_0,S_0,//1
        C_4,B_3,A_3,B_3,F_3,S_0,S_0,S_0,C_4,B_3,A_3,B_3,E_3,S_0,S_0,S_0,
        E_3,S_0,F_3,S_0,G_3,S_0,A_3,S_0,C_4,S_0,S_0,S_0,B_3,S_0,S_0,S_0,
        A_3,S_0,S_0,S_0,g_3,S_0,S_0,S_0,
        B_3,S_0,C_4,C_4,B_3,C_4,S_0,G_4,G_4,S_0,S_0,S_0,//4
        B_3,S_0,C_4,C_4,B_3,G_4,S_0,A_4,G_4,S_0,S_0,S_0,//4
        C_4,D_4,E_4,F_4,E_4,F_4,E_4,D_4,C_4,D_4,S_0,S_0,S_0,B_3,C_4,S_0,
        B_3,S_0,C_4,C_4,B_3,C_4,S_0,G_4,G_4,S_0,S_0,S_0,//4
        B_3,S_0,C_4,C_4,B_3,G_4,S_0,A_4,G_4,S_0,S_0,S_0,//4
        C_4,D_4,E_4,F_4,E_4,F_4,E_4,D_4,C_4,D_4,S_0,S_0,S_0,S_0,//2
        B_3,S_0,C_4,C_4,B_3,C_4,S_0,G_4,G_4,S_0,S_0,S_0,//4
        B_3,S_0,C_4,C_4,B_3,G_4,S_0,A_4,G_4,S_0,S_0,S_0,//4
        C_4,D_4,E_4,F_4,E_4,F_4,E_4,D_4,C_4,D_4,S_0,S_0,S_0,B_3,C_4,S_0,
        B_3,S_0,C_4,C_4,B_3,C_4,S_0,G_4,G_4,S_0,S_0,S_0,//4
        B_3,S_0,C_4,C_4,B_3,G_4,S_0,A_4,G_4,S_0,S_0,S_0,//4
        C_4,D_4,E_4,F_4,E_4,F_4,E_4,D_4,C_4,D_4,S_0,S_0,S_0,S_0,//2
        E_4,D_4,C_4,B_3,C_4,C_4,C_4,C_4,B_3,C_4,E_4,G_4,S_0,S_0,C_4,C_4,
        S_0,S_0,S_0,S_0,B_3,C_4,C_4,S_0,S_0,S_0,S_0,S_0,S_0,S_0,S_0,S_0,
    };
    int  HackingToTheGate[]= {
        S_0,S_0,S_0,S_0,S_0,A_4,F_4,F_4,D_4,F_4,E_4,F_4,G_4,
        S_0,D_4,D_4,E_4,C_4,G_4,E_4,D_4,
        S_0,S_0,D_4,F_4,G_4,A_4,G_4,S_0,
        G_4,G_4,A_4,E_4,E_4,C_4,G_4,F_4,
        S_0,A_4,G_4,F_4,S_0,F_4,G_4,S_0,
        A_4,F_4,F_4,D_4,F_4,E_4,F_4,G_4,
        D_4,D_4,E_4,C_4,G_4,A_4,G_4,F_4,
        S_0,D_4,A_4,A_4,f_4,F_4,S_0,
        D_4,F_4,E_4,F_4,G_4,C_4,E_4,F_4,F_4,G_4,C_4,D_4,
        S_0,A_4,F_4,G_4,F_4,S_0,
        D_4,D_4,A_4,a_4,G_4,F_4,G_4,G_4,E_4,
        S_0,C_4,C_4,A_4,a_4,E_4,G_4,F_4,
        A_4,G_4,F_4,D_4,D_4,D_4,A_4,G_4,A_4,E_4,
        S_0,C_4,C_4,A_4,A_4,G_4,C_4,D_4,
        S_0,A_4,F_4,G_4,F_4,S_0,
        D_4,A_4,a_4,G_4,F_4,G_4,E_4,S_0,
        C_4,A_4,a_4,E_4,G_4,F_4,S_0,
        D_4,E_4,F_4,G_4,F_4,E_4,F_4,G_4,A_4,G_4,
        A_4,a_4,G_4,A_4,A_4,g_4,A_4,C_5,
        a_4,G_4,A_4,A_4,A_4,G_4,a_4,B_4,
        S_0,C_5,B_4,G_4,B_4,E_4,B_4,A_4,
        E_4,G_4,F_4,A_4,G_4,D_4,D_4,E_4,E_4,
        E_4,C_5,B_4,D_5,C_5,G_4,B_4,A_4,A_4,G_4,A_4,
        S_0,A_4,A_4,G_4,a_4,B_4,S_0,
        C_5,B_4,G_4,G_4,E_4,B_4,A_4,S_0,
        E_4,G_4,F_4,A_4,B_5,G_4,B_4,C_5,B_4,
        E_4,C_5,B_4,D_5,C_5,G_4,B_4,C_5,
        C_5,B_4,A_4,A_4,D_5,G_4,G_4,B_4,A_4,
        S_0,A_4,A_4,G_4,a_4,B_4,S_0,
        C_5,B_4,G_4,G_4,E_4,B_4,A_4,S_0,
        E_4,G_4,F_4,A_4,G_4,D_4,D_4,E_4,E_4,
        E_4,C_5,B_4,D_5,C_5,G_4,B_4,A_4,
        S_0,A_4,G_4,A_4,F_4,B_4,G_4,A_4,
        S_0,A_4,A_4,G_4,a_4,B_4,S_0,
        C_5,B_4,G_4,G_4,E_4,B_4,A_4,S_0,
        E_4,G_4,F_4,A_4,B_5,G_4,B_4,C_5,B_4,
        E_4,C_5,B_4,D_5,C_5,G_4,B_4,C_5,
        C_5,B_4,A_4,A_4,D_5,G_4,G_4,B_4,A_4,
        S_0,S_0,S_0,S_0,S_0,S_0,S_0,S_0,
    };
    
    
    void PlaySong(int i);
    
    int pow(int x);
    void TEST();
    void SENSORTEST();
    void AUDIOTEST();
    //float toBuzzer(int x);
    
    int main()
    {
        //TEST();
    	  //SENSORTEST();
    	//AUDIOTEST();
    	
    
        int a[556]={0};
    		int b[556]={0};
        //float a[556]={0};
    		//float b[556]={0};
    
        while(1) {
    
            //1.select songs
            if(song==1) {
                //printf("select song success");
                SongNum++;
                PlaySong(SongNum);
                //printf("play song success");
            }
    
            if(SongNum>=2) {
                SongNum=0;
            }
    
            //2.press botton to start
            SongNum=1;
            //3.countdown before start(displayed by 6*6 LED matrix)
            int m;
    				//float m;
            int judge=0;
    				
            /*
    				if(1) {
                int j=0;
                for(j=0; j<550; j++) {
                    if(TestSong[j]==0) {
                        a[j]=0;
    									b[j]=0;
                    } else {
                        m=TestSong[j]%4;
                        a[j]=m+1;//m=1~4
    									b[j]=TestSong[j]; 
                    }
                }
            }
    				*/
            if( SongNum==1) {
                int j=0;
                for(j=0; j<550; j++) {
                    if(WeightOfTheWorld[j]==0) {
                        a[j]=0;
                    } else {
                        m=WeightOfTheWorld[j]%4;
                        a[j]=m+1;//m=1~4
                    }
    								
    									b[j]=~WeightOfTheWorld[j];
                }
            }
    
            if( SongNum==2) {
                for(int j=0; j<550; j++) {
                    if(HackingToTheGate[j]==0) {
                        a[j]=0;
                    } else {
                        m=HackingToTheGate[j]%4;
                        a[j]=m+1;
                    }
    								
    									b[j]=~HackingToTheGate[j];
                }
            }
    
            dec1=2+4+8+1;
            dec2=8;
            dec3=2+4+8+1;
            dec4=8;
            dec5=2+4+8+1;//3
            wait(1);
            dec1=2+4+8+1;
            dec2=1;
            dec3=2+4+8+1;
            dec4=8;
            dec5=2+4+8+1;//2
            wait(1);
            dec1=4;
            dec2=4;
            dec3=4;
            dec4=4;
            dec5=4;//1
            wait(1);
    
            int n;
            int y[6]= {0};
    
            //wait_us(10);
    
            /*if (lengthCount_R >= 53 && lengthCount_R <= 67) {
                position = 3;
            }
            if (lengthCount_R >= 29 && lengthCount_R <= 46) {
                position = 2;
            }
            if (lengthCount_R >= 8 && lengthCount_R <= 26) {
                position = 1;
            }*/
    
            //wait_us(10);
    
            for(int j=0; j<=550; j++) {
            //sensor_left
            int lengthCount_L = 0;
            wait_us(10);
            trig_L = 1;
            wait_us(10);
            trig_L = 0;
            for(int i = 0; i < 120; i++) {
                if (echo_L == 1) {
                    lengthCount_L += 1;
                }
                wait_us(10);
            }
    
            //sensor right
            int lengthCount_R = 0;
            wait_us(10);
            trig_R = 1;
            wait_us(10);
            trig_R = 0;
            for(int i = 0; i < 80; i++) {
                if (echo_R == 1) {
                    lengthCount_R += 1;
                }
                wait_us(10);
            }
            int position = 0;
            /*if (lengthCount_L >= 16 && lengthCount_L <= 30) {
                position = 6;
            }
            if (lengthCount_L >= 33 && lengthCount_L <= 52) {
                position = 5;
            }
            if (lengthCount_L >= 55 && lengthCount_L < 73) {
                position = 4;
            }*/
    				if (lengthCount_L >= 10 && lengthCount_L <= 18) {
                position = 1;
    					
            }
    					else if(lengthCount_L >= 21 && lengthCount_L <= 29){
                position = 2;
    					
    					}
    					else if(lengthCount_L >= 31 && lengthCount_L <= 41){
                position = 3;
    					
    					}
    					else if(lengthCount_L >= 43 && lengthCount_L <= 53){
                position = 4;
    					
    					}
    					else {
                position = 0;
    					
    					}
    					pc.printf("position = %d\n",position);
                for(int i=0; i<=5; i++) {
                    y[i]=a[j+i];//y[i]save a[i]and other five before
                }
    
                if(y[5]==0) {
                    dec5=0;
                } else {
                    n=pow(y[5]);
                    dec5=n;
                }
                
                if(y[4]==0) {
                    dec4=0;
                } else {
                    n=pow(y[4]);
                    dec4=n;
                }
    
                if(y[3]==0) {
                    dec3=0;
                } else {
                    n=pow(y[3]);
                    dec3=n;
                }
    
                if(y[2]==0) {
                    dec2=0;
                } else {
                    n=pow(y[2]);
                    dec2=n;
                }
    
                if(y[1]==0) {
                    dec1=0;
                } else {
                    n=pow(y[1]);
                    dec1=n;
                }
    
                if(y[0]==0) {
                    dec0=0;
                } else {
                    n=pow(y[0]);
                    judge=y[0];
                    dec0=n;
                }
    						aud=b[j];
                if(judge==position) {
                    green=1;
                    red=0;
                } else {
                    red=1;
                    green=0;
                }
                wait(0.65);
    						aud=0;
    						wait(0.05);
            }
    
            //4.play
            //4-1.lights drop down
            //4-2.sensor detect finger position
            //4-3.feedback:right positio —— play sound, combo counts; wrong position —— no sound, combo breaks
    
            //5.show maximum combo
    
            //6.press botton to end
    
        }
    
    }
    
    void PlaySong(int i)
    {
    
        int j=0;
    
        if(i==1) {
            //printf("select first song success");
    
            while(WeightOfTheWorld[j]!=NULL) {
                j++;
                aud=(~WeightOfTheWorld[j]);
                wait(1);
                if(i==0) {
                    return;
                }
            }
        } else if(i==2) {
            //printf("select second song success");
    
            while(HackingToTheGate[j]!=NULL) {
                j++;
                aud=(~HackingToTheGate[j]);
                wait(1);
                if(i==0) {
                    return;
                }
            }
        }
    }
    
    int pow(int x)
    {
        int k=1;
        for(int i=x; i>1; i--) {
            k=k*2;
        }
        return k;
    }
    
    
    void TEST(){
        /*int y = 1;
        for(int x=1;x<=36;x++){
            aud = ~x;
            pc.printf("x = %d; y = %d\n",x,y);
            pc.printf("%d\n",~x);
            wait(2);
        }*/
    
        /*int x = 1;
        while(1){
    
        aud = x;
            pc.printf("%d\n",x);
            x=x*2;
            if (x==64){
                x=1;
            }
        wait(5);
    
        }*/
        while(1) {
            dec5=1;
            wait(0.1);
            dec5=2;
            wait(0.1);
            dec5=4;
            wait(0.1);
            dec5=8;
            wait(0.1);
            dec5=0;
    
            dec4=1;
            wait(0.1);
            dec4=2;
            wait(0.1);
            dec4=4;
            wait(0.1);
            dec4=8;
            wait(0.1);
            dec4=0;
    
            dec3=1;
            wait(0.1);
            dec3=2;
            wait(0.1);
            dec3=4;
            wait(0.1);
            dec3=8;
            wait(0.1);
            dec3=0;
    
            dec2=1;
            wait(0.1);
            dec2=2;
            wait(0.1);
            dec2=4;
            wait(0.1);
            dec2=8;
            wait(0.1);
            dec2=0;
    
            dec1=1;
            wait(0.1);
            dec1=2;
            wait(0.1);
            dec1=4;
            wait(0.1);
            dec1=8;
            wait(0.1);
            dec1=0;
    
            dec0=1;
            wait(0.1);
            dec0=2;
            wait(0.1);
            dec0=4;
            wait(0.1);
            dec0=8;
            wait(0.1);
            dec0=0;
            
            trig_L=1;
            wait(0.1);
            trig_L=0;
            trig_R=1;
            wait(0.1);
            trig_R=0;
    				
            aud=1;
            wait(0.1);
            aud=2;
            wait(0.1);
            aud=4;
            wait(0.1);
            aud=8;
            wait(0.1);
            aud=16;
            wait(0.1);
            aud=32;
            wait(0.1);
            aud=0;
            wait(0.1);
            
            red=1;
            wait(0.1);
            red=0;
            green=1;
            wait(0.1);
            green=0;
    				
    				pc.printf("output test finish\n");
    				while(echo_L==0){
                wait(1);
                pc.printf("echo_L=0\n");
                }
            
            pc.printf("echo_L=1\n");
    				wait(1.0);
                
            while(echo_R==0){
                wait(1);
                pc.printf("echo_R=0\n");
                }    
    
            pc.printf("echo_R=1\n");
    				wait(1.0);
    						
            while(song==0){
                wait(1);
                pc.printf("song=0\n");
                }    
    
            pc.printf("song=1\n");
    				wait(1.0);
            
            while(sta==0){
                wait(1);
                pc.printf("sta=0\n");
                }    
    
            pc.printf("sta=1\n");
    				wait(1.0);
        }
    		
    }
    
    void SENSORTEST(){
            while(1){
    					//sensor_left
            int lengthCount_L = 0;
            wait_us(10);
            trig_L = 1;
            wait_us(10);
            trig_L = 0;
            for(int i = 0; i < 120; i++) {
                if (echo_L == 1) {
                    lengthCount_L += 1;
                }
                wait_us(10);
            }
    
    
            //sensor right
            int lengthCount_R = 0;
            wait_us(10);
            trig_R = 1;
            wait_us(10);
            trig_R = 0;
            for(int i = 0; i < 120; i++) {
                if (echo_R == 1) {
                    lengthCount_R += 1;
                }
                wait_us(10);
            }
    				pc.printf("L=%d,R=%d\n",lengthCount_L,lengthCount_R);
    				wait(1);
    				if (lengthCount_L >= 10 && lengthCount_L <= 18) {
                position = 1;
            }
    					else if(lengthCount_L >= 21 && lengthCount_L <= 29){
                position = 2;
    					
    					}
    					else if(lengthCount_L >= 31 && lengthCount_L <= 41){
                position = 3;
    					
    					}
    					else if(lengthCount_L >= 43 && lengthCount_L <= 53){
                position = 4;
    					
    					}
    					else {
                position = 0;
    					
    					}
    				/*if((lengthCount_L+lengthCount_R<=65)&&(lengthCount_L+lengthCount_R>=55)){
              if (lengthCount_L >= 10 && lengthCount_L <= 18) {
                position = 1;
            }
    					else if(lengthCount_L >= 21 && lengthCount_L <= 29){
                position = 2;
    					
    					}
    					else if(lengthCount_L >= 31 && lengthCount_L <= 41){
                position = 3;
    					
    					}
    					else if(lengthCount_L >= 43 && lengthCount_L <= 53){
                position = 4;
    					
    					}
    					else {
                position = 0;
    					
    					}
    					
    				}*/
    				/*
            int position = 0;
            if (lengthCount_L >= 16 && lengthCount_L <= 30) {
                position = 6;
            }
            if (lengthCount_L >= 33 && lengthCount_L <= 52) {
                position = 5;
            }
            if (lengthCount_L >= 55 && lengthCount_L < 73) {
                position = 4;
            }
    
            //wait_us(10);
    
            if (lengthCount_R >= 53 && lengthCount_R <= 67) {
                position = 3;
            }
            if (lengthCount_R >= 29 && lengthCount_R <= 46) {
                position = 2;
            }
            if (lengthCount_R >= 8 && lengthCount_R <= 26) {
                position = 1;
            }
    				*/
    				
    				}
    }
    
    void AUDIOTEST(){
    	while(1){
    		int i;
    		for(i=1;i<=36;i++){
    			/*aud=~i; 
    			wait(0.65);
    			aud=~0;
    			wait(0.05);*/
    			aud=~WeightOfTheWorld[i];
    			wait(0.65);
    			aud=~0;
    			wait(0.05);
    //pc.printf("WeightOfTheWorld[%d]=%d\t",i,WeightOfTheWorld[i]);	
    		}
    	}
    }
    
    展开全文
  • 基于单片机的轮机模拟器电站同步表实现,魏风波,冯志勇,本文首先简要说明了同步表在船舶电站中的用途,以及实船上同步表各个部分的功能和操作方法;文中介绍了在轮机模拟器上对于电站同
  • 基于单片机的电磁计程仪模拟器设计.pdf
  • 行业分类-设备装置-基于单片机的平台罗经模拟器.zip
  • 用这个软件可以实现单片机开发程序的软件仿真和硬件仿真,你可以看到单片机运行时内部的变化,并且可以精确地计算单片机执行指令所需花费的时间。还可以通过逻辑仿真窗口加深对单片机逻辑指令的理解。特别是逻辑循环...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 2,470
精华内容 988
关键字:

单片机模拟器