虚拟示波器 这应该算是我第一次吧,刚出校门不久,老板赏识,给了一次难得的机会。。。。 从schàpcbà硬件调试à单片机程序,收获颇多。。。。 《第一版并口示波器》 第一版的板子,改动挺多的,运放都弄错了,7805功率也不够,换了一个金属壳的。。。。 反正不少问题。 《PCB图》 呵呵,看看当时的布线,走线中规中举横平竖直,这图是用trax画的,当时已经很少用这个画图的了,现在的小伙们可能都没听说过。 《原理图一》 《原理图二》 到现在看这款示波器的原理还是挺经典的,后面的逻辑部门全部用数字电路搭起来的,没用CPLD之类的芯片,AD FIFO 都是挺经典的电路。图可能不是很清楚,感兴趣的可以联系我索要原理图。而且,这款示波器还是隔离的,市面上很少有隔离的虚拟示波器。。。。。 部分代码程序: /* --10mV |--20mV |---50mV |---100mV 幅度调整----|---200mV |---500mV |---1V |---2V ---5V ---AC AC/DC/GND---|---DC ---GND */ //YA幅度调整及AC/DC/GND控制 void Prefix_con_YA (unsigned char AC/DC/GND,unsigned char Voltage) { unsigned char control_reg_YA = 0x00; switch(AC/DC/GND){ case 0 : control_reg_YA = control_reg_YA&0xDF; break;//AC case 1 : control_reg_YA = control_reg_YA|0x20; break;//DC case 2 : control_reg_YA = control_reg_YA&0x10|0x10;break;//GND } switch(Voltage){ case 0 : control_reg_YA = control_reg_YA&0xE0|0X04;break;//10mV case 1 : control_reg_YA = control_reg_YA&0xE0|0X06;break;//20mV case 2 : control_reg_YA = control_reg_YA&0xE0|0X05;break;//50mV case 3 : control_reg_YA = control_reg_YA&0xE0|0X04;break;//100mV case 4 : control_reg_YA = control_reg_YA&0xE0|0X0A;break;//200mV case 5 : control_reg_YA = control_reg_YA&0xE0|0X09;break;//500mV case 6 : control_reg_YA = control_reg_YA&0xE0|0X08;break;//1V??????? case 7 : control_reg_YA = control_reg_YA&0xE0|0X1A;break;//2V case 8 : control_reg_YA = control_reg_YA&0xE0|0X19;break;//5V } write_74HCT574_U04(control_reg_YA); } //YB幅度调整及AC/DC/GND控制 void Prefix_con_YB (unsigned char AC/DC/GND,unsigned char Voltage) { unsigned char control_reg_YB = 0x00; switch(AC/DC/GND){ case 0 : control_reg_YB = control_reg_YB&0xDF; break;//AC case 1 : control_reg_YB = control_reg_YB|0x20; break;//DC case 2 : control_reg_YB = control_reg_YB&0x10|0x10;break;//GND } switch(Voltage){ case 0 : control_reg_YB = control_reg_YB&0xE0|0X04;break;//10mV case 1 : control_reg_YB = control_reg_YB&0xE0|0X06;break;//20mV case 2 : control_reg_YB = control_reg_YB&0xE0|0X05;break;//50mV case 3 : control_reg_YB = control_reg_YB&0xE0|0X04;break;//100mV case 4 : control_reg_YB = control_reg_YB&0xE0|0X0A;break;//200mV case 5 : control_reg_YB = control_reg_YB&0xE0|0X09;break;//500mV case 6 : control_reg_YB = control_reg_YB&0xE0|0X08;break;//1V case 7 : control_reg_YB = control_reg_YB&0xE0|0X1A;break;//2V case 8 : control_reg_YB = control_reg_YB&0xE0|0X19;break;//5V } write_74HCT574_U05(control_reg_YB); } //YA偏移量控制,YB偏移量控制 void offset (unsigned int quantity) { //quantity = setbuf[2] + (setbuf[3]<<0x08) + (setbuf[4]<<0x10); write_LT1446(quantity); } //时基控制 /* ---0.5us/0.2us--20M |---1us/2us --10M |---5us --2M |---10us/20us --1M |---50us --200K |---0.1ms/0.2ms--100K 时基控制-|---0.5ms --20K |---1ms/2ms --10K |---5ms --2K |---10ms/20ms --1K |---50ms --200Hz |---0.1s/0.2s --100Hz |---0.5s --20Hz |--- --10Hz |--- --2Hz --- --1Hz */ void time_base (unsigned char time) { switch(time){ case 0 : write_74HCT574_U31(0XF8);break;//20M case 1 : write_74HCT574_U31(0XF9);break;//10M case 2 : write_74HCT574_U31(0XFA);break;//2M case 3 : write_74HCT574_U31(0XFB);break;//1M case 4 : write_74HCT574_U31(0XFC);break;//200K case 5 : write_74HCT574_U31(0XFD);break;//100K case 6 : write_74HCT574_U31(0XFE);break;//20K case 7 : write_74HCT574_U31(0XFF);break;//10K case 8 : write_74HCT574_U31(0XF0);break;//2K case 9 : write_74HCT574_U31(0XF1);break;//1K case 10 : write_74HCT574_U31(0XF2);break;//200Hz case 11 : write_74HCT574_U31(0XF3);break;//100Hz case 12 : write_74HCT574_U31(0XF4);break;//20Hz case 13 : write_74HCT574_U31(0XF5);break;//10Hz case 14 : write_74HCT574_U31(0XF6);break;//2Hz case 15 : write_74HCT574_U31(0XF7);break;//1Hz } } //同步电平控制 void trig_level (unsigned char level) { //level = setbuf[6] + (setbuf[7]<<0x08); write_LT1451(level); } //触发沿控制 void trig_pol (unsigned char pol) { switch(pol){ case 0 : write_74HCT574_U09(0XF7); break;//上升沿 case 1 : write_74HCT574_U09(0XF7); break;//下降沿 } } //同步源控制 void trig_fountain (unsigned char fountain) { switch(fountain){ case 0 : write_74HCT574_U09(0XF7); break;//YA同步 case 1 : write_74HCT574_U09(0XF7); break;//YB同步 case 2 : write_74HCT574_U09(0XF7); break;//外同步 } } //YA/YB选择 //停止/开始 void start_stop(unsigned char st) { switch(st){ case 0 : write_74HCT574_U09(0XF7); break;//停止 case 1 : write_74HCT574_U09(0XF7); break;//开始 } } //发送设置 void signal_setup() { //前置设置 switch(setbuf[0]){ case 0 : Prefix_con_YA (); break;//AC/10mV case 1 : Prefix_con_YA (); break;//AC/20mV case 3 : Prefix_con_YA (); break;//AC/50mV case 4 : Prefix_con_YA (); break;//AC/100mV case 5 : Prefix_con_YA (); break;//AC/200mV case 6 : Prefix_con_YA (); break;//AC/500mV case 7 : Prefix_con_YA (); break;//AC/1V case 8 : Prefix_con_YA (); break;//AC/2V case 9 : Prefix_con_YA (); break;//AC/5V case 2 : Prefix_con_YA (); break;//AC/50mV } } 下面是当时市面存在的比较经典的虚拟示波器: 《普源并口示波器》 《迪阳并口示波器》 《汉泰USB示波器》 |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |