您好,欢迎访问三七文档
实物图调试1.不通电,用万用表根据电路图仔细检查各线路连接是否正常。2.首先是调试单片机部分,DA和运算放大器芯片不接。通过串口下程序。看是否可以正常下程序。3.当可以正常下程序时,给51单片机下一个让所有I/0口一会儿输入0,延时,再输出1,以此类推。用万用表测量各I/O口得电压是否一会儿高,一会儿低。4.安上DA和运算放大器芯片,给单片机下一个输出方波的测试程序,通过示波器看输出是否正常。P1.01P1.12P1.23P1.34P1.45P1.56P1.67P1.78RST9P3.0/RXD10P3.1/TXD11P3.2/INT012P3.3/INT113P3.4/T014P3.5/T115P3.6/WR16P3.7/RD17X218X119GND20P2.021P2.122P2.223P2.324P2.425P2.526P2.627P2.728PSEN29ALE30EA31P0.732P0.633P0.534P0.435P0.336P0.237P0.138P0.039VCC40STC89C52123456789PAIZU-10KVCCY111.0592MC630PC730PD0P30P31VCCVCC125V1234567891110RS23212345678910111213141516U2MAX232P31P30VCCT1OUTR1INT1OUTR1IN104C5D1D2D3D4D5D6D71234567891020191817161514131211P4DAC0832VCCCSDAWRD0VCC7562411LM32491083411LM32412V10KR25KR112V-12V-12VCSDAWR104C1104C2104C3104C4100R3104C6D1D2D3D4D5D6D7S1S212VOUT112VOUT2S3D/A转换器的函数信号发生器源程序(部分):#includeREG51.H#defineucharunsignedchar#defineuintunsignedint#defines_max12#defineKEYP1//键盘输入口#definedataoutP0//波形输出口sbitmc=P2^0;//************************函数声明******************voidINT_1(void);//外部中断1处理函数voidTIMER1(void);//定时器T1中断处理函数voidSCAN(intN);//串行输出函数voidtransfer(intN);voiddelay(uintN);//延时子函数voidmanage_key1(void);//按键1处理函数voidmanage_key2(void);//按键2处理函数voidchance(intN);//正弦波、三角波频率计算函数voidfpj(intN);//脉冲频率计算函数voidcleary();//初始化函数//***********定义全局变量****************************uintdataTHHL1;//定时器T1初始值uintdataTHHL0;//定时器T0初始值intdataout_flag;//输出波形表选择值intdatas;//频率计数值intn=0;intSIN_THR;//**********正弦波256\32\16点数据表******************ucharcodesin256_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A,0x1C,0x1E,0x21,0x23,0x25,0x27,0x29,0x2C,0x2E,0x31,0x33,0x36,0x38,0x3B,0x3D,0x40,0x43,0x46,0x48,0x4B,0x4E,0x51,0x54,0x57,0x5A,0x5D,0x60,0x63,0x66,0x69,0x6C,0x6F,0x73,0x76,0x79,0x7C};ucharcodesin32_tab[32]={0x92,0xA5,0xB7,0xC7,0xD4,0xDE,0xE4,0xE7,0xE5,0xDF,0xD6,0xC9,0xB9,0xA7,0x94,0x80,0x6C,0x59,0x47,0x37,0x2A,0x21,0x1B,0x19,0x1B,0x20,0x29,0x35,0x45,0x56,0x69,0x7D};ucharcodesin16_tab[16]={0xA5,0xC7,0xDE,0xE7,0xDF,0xC9,0xA7,0x80,0x59,0x37,0x21,0x19,0x20,0x35,0x56,0x7D};//**********三角波256\32\16点数据表******************ucharcodethr256_tab[256]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff};ucharcodethr32_tab[32]={0x0F,0x1F,0x2F,0x3F,0x4F,0x5F,0x6F,0x7F,0x8F,0x9F,0xAF,0xBF,0xCF,0xDF,0xEF,0xFF,0xEF,0xDF,0xCF,0xBF,0xAF,0x9F,0x8F,0x7F,0x6F,0x5F,0x4F,0x3F,0x2F,0x1F,0x0F,0x00};ucharcodethr16_tab[16]={0x1F,0x3F,0x5F,0x7F,0x9F,0xBF,0xDF,0xFF,0xDF,0xBF,0x9F,0x7F,0x5F,0x3F,0x1F,0x00};//********按键1处理函数********************voidmanage_key1(void){ucharj;SIN_THR=1;TR1=1;j=s;if(j=0&&j=4)//波形频率=50HZ,输出正弦波256点数据表{out_flag=1;}elseif(j=5&&j=9)//波形频率大于等于100小于等于400HZ,输出正弦波32点数据表{out_flag=2;}elseout_flag=3;//波形频率大于等于500HZ,选择输出正弦波16点数据表}//***********按键2处理函数*****************voidmanage_key2(void){ucharj;SIN_THR
本文标题:信号发生器
链接地址:https://www.777doc.com/doc-4010565 .html