/* 
8K_DO.c :This demo program is uesed in DO module.      

Compiler: BC++ 3.1,                                                            
          Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum)
          MSC 6.0,                                                             
          MSVC 1.52.                                                           
                                                                               
Compile mode: large                                                            
                                                                               
Project: 8K_DO.c                                                               
         ..\Lib\(8000.Lib, 8000E.lib)   
                                                                               
Hardware: 8000

[24 May,2005] by Bill
*/
#include "..\..\lib\vp2k.h"


void main()
{
    unsigned long DOdata;
    int iSlot,iChannelNum;
    unsigned char cTemp[10];
    
    InitLib();
    Print("\nInstall Com0");
	InstallCom0(300,8,0,1);

	//Print("\nInstall Isr");
	//InstallIsr8000H();
    
    Print("Please Input Slot Number(0~3 or 0~7) =");
    LineInput(cTemp,10);
    sscanf(cTemp,"%d",&iSlot);
    
    Print("Please Input Channel Number(8,16 or 32)");
    LineInput(cTemp,10);
    sscanf(cTemp,"%d",&iChannelNum);
    
    for(;;)
    {        
        Print("Please Input DO Data(Hex) = "); 
        LineInput(cTemp,10);
        sscanf(cTemp,"%8lX",&DOdata);                

        if(iChannelNum<=8)
        {              
            DO_8(iSlot,DOdata);
            Print("DO data = %02X ok.\n\r",DOdata);
        }
        else if(iChannelNum==16)
        {
            DO_16(iSlot,DOdata);
            Print("DO data = %04X ok.\n\r",DOdata);
        }
        else if(iChannelNum==32)
        {
            DO_32(iSlot,DOdata);
            Print("DO data = %-08lX ok.\n\r",DOdata);
        }
    }   
}       
        
        
        
