📄 8chdvm.c
字号:
//8 Channel digital volt meter
@cid "DVM1";
@ver "1.0";
@name "8 Channel DVM";
@dbname "8 Channel DVM";
@licon1 "xilinx.bmp";
@sicon1 "small1.bmp";
library "IOLib"
main(){
int result;
int i;
float Channel1, Channel2, Channel3, Channel4, Channel5, Channel6, Channel7, Channel8;
graph_on();
clearg();
rect(0,0,0,165,165,1);
textattr(0,1,0);
text(10,10, "Channel 1");
text(10,20, "Channel 2");
text(10,30, "Channel 3");
text(10,40, "Channel 4");
text(10,50, "Channel 5");
text(10,60, "Channel 6");
text(10,70, "Channel 7");
text(10,80, "Channel 8");
text(90,10, "V");
text(90,20, "V");
text(90,30, "V");
text(90,40, "V");
text(90,50, "V");
text(90,60, "V");
text(90,70, "V");
text(90,80, "V");
while(1){
IOWrite(0x2900003e,0xffff);
IOWrite(0x2900003e,0x0000);
//Now, Clear the numbers:
text(70,10, " ");
text(70,20, " ");
text(70,30, " ");
text(70,40, " ");
text(70,50, " ");
text(70,60, " ");
text(70,70, " ");
text(70,80, " ");
//Channel 1
result = IORead(0x29000002);
result=result >> 4;
Channel1 = result;
Channel1 = (Channel1/2047) * 2.5;
text(70,10, format(Channel1,2));
//Channel 2
result = IORead(0x29000012);
result = result >> 4;
Channel2 = result;
Channel2 = (Channel2/2047) * 2.5;
text(70,20, format(Channel2,2));
//Channel 3
result = IORead(0x29000022);
result=result >> 4;
Channel3 = result;
Channel3 = (Channel3/2047) * 2.5;
text(70,30, format(Channel3,2));
//Channel 4
result = IORead(0x29000032);
result=result >> 4;
Channel4 = result;
Channel4 = (Channel4/2047) * 2.5;
text(70,40, format(Channel4,2));
//Channel 5
result = IORead(0x29000042);
result=result >> 4;
Channel5 = result;
Channel5 = (Channel5/2047) * 2.5;
text(70,50, format(Channel5,2));
//Channel 6
result = IORead(0x29000052);
result=result >> 4;
Channel6 = result;
Channel6 = (Channel6/2047) * 2.5;
text(70,60, format(Channel6,2));
//Channel 7
result = IORead(0x29000062);
result=result >> 4;
Channel7 = result;
Channel7 = (Channel7/2047) * 2.5;
text(70,70, format(Channel7,2));
//Channel 8
result = IORead(0x29000072);
result=result >> 4;
Channel8 = result;
Channel8 = (Channel8/2047) * 2.5;
text(70,80, format(Channel8,2));
for(i=0;i<800;i++); //wait for a little bit before refreshing the screen
//volt2=result2;
//volt2=(volt2/2047)*2.5;
//text(50,110,format(volt2,2));
//text(70,110,"volts");
}
event(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -