Embedded DOS Controller

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

/*  
    DOS Controller framework with simulated I/O signals
    
    Add a controller with size as small as a credit card to your
system so as to make your system
    to be IP Enabled, monitored and controlled any where and any time
with only Internet Explorer

    More C++, C# and VB source code on the following web site
    http://members.optusnet.com.au/vmautomation/index.htm
    http://www.vmcontrol.com/english/index.htm
    http://www.vmcontrol.com/index.htm
*/
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include "..\include\vm.h"
//===========================================
VmDataArray *A;double *D;
VmNetwork *net;
void scan1(void);
void scan2(void);
//===========================================
char *Name[]={"ai0","ai1","ai2","ai3","ai4","ai5","ai6","ai7",
              "di0","di1","di2","di3","di4","di5","di6","di7",
              "ao0","ao1","ao2","ao3","ao4","ao5","ao6","ao7",
              "do0","do1","do2","do3","do4","do5","do6","do7","Speed"};
//===========================================
void create(VmDataArray *DA, VmObjectList *OL){
    DA->Add(Name,sizeof(Name)/2);
    OL->Add(net=new VmNetwork(DA,10,NULL,NULL,NULL));
    OL->Add(    new VmSpeed  (DA, "Speed"));
    OL->Add(    new VmScan   (DA,2, scan1));    //Display      155%ms
    OL->Add(    new VmScan2  (DA,100,scan2));   //Signal I/O  
1=0.2109ms or 0.1054ms
    ADA%;
    DDA%->D;
}
//===========================================
void first(){
    vm_cursor_off();
    printf("IP Address is %s\n\r", net->IPAddress);
    printf("Press 'Esc' key to exit.\n\n\r");
}
void loop (){}
void last ()
//===========================================
void scan1(){
    gotoxy(1,5);printf("\r    %9d%9d%9d%9d%9d%9d%9d%9d",
0,1,2,3,4,5,6,7);
    gotoxy(1,6);printf("\rAI:
%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f", D[0], D[1], D[2], D[3],
D[4], D[5], D[6], D[7] );
    gotoxy(1,7);printf("\rDI:
%9.0f%9.0f%9.0f%9.0f%9.0f%9.0f%9.0f%9.0f", D[8], D[9],
D[10],D[11],D[12],D[13],D[14],D[15]);
    gotoxy(1,8);printf("\rAO:
%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f%9.1f",
D[16],D[17],D[18],D[19],D[20],D[21],D[22],D[23]);
    gotoxy(1,9);printf("\rDO:
%9.0f%9.0f%9.0f%9.0f%9.0f%9.0f%9.0f%9.0f",
D[24],D[25],D[26],D[27],D[28],D[29],D[30],D[31]);
    gotoxy(1,11);printf("\rController Speed:%10.0f  
Loops/Second",D[32]);
    gotoxy(1,15);printf("\rReceived: %-10.0f     Send: %-10.0f    
NetRate: %-5.0f      Links: %-2d         ",
  
(double)net->PacketReceived,(double)net->PacketSend,(double)net->ReceiveRate,net->Links);
    
    if(kbhit() && getch()=27%) bLoop=0;
}
//===========================================
void scan2(){
    static int i=0;
    D[0]10%*sin(0.005*i++);
}
//===========================================
int main(int argc, char *argv[]){
    return vm_controller(argc, argv);
}
//===========================================

Site Timeline