/**************************************************************
 *   DIO-24  :      DEMO_02 Program                          *
 *   Function :  Digital Input Output                         *
 *   Langurage                                                *
 **************************************************************/

 #include "stdio.h"
 #include "dio24.h"


 main()

 {
 int pa, pc_low;

 int i;

 clrscr();

 if(_DIO24_Init(0x2c0)) printf(" Can't Found DIO-24 !! ");

    /* _DIO24_Conf(  Port A Conf , Port B Conf ,
		      Port C Low nibble Conf , Port C High nibble Conf) */


			    /* Config  1: For Input  */
			    /* Config  0: For Output */


 _DIO24_Conf(1,0,1,0);     /* Config CN0 PA      1 : Input  */
			    /* Config CN0 PB       0 : Output */
			    /* Config CN0 PC_Low   1 : Input  */
			    /* Config CN0 PC_High  0 : Output */


 printf(" DIO-24 DEMO Program\n ");
 gotoxy(2,12);

 printf(" Press any key to countiune \n ");
 printf(" Press <q> to Quit          \n ");





 for (i=0;i<=255;i++)
 {
   gotoxy(1,2);

   _DIO24_Output(Port_B,i);
   _DIO24_Output(Port_C_Higher,i);

   pa      = _DIO24_Input(Port_A);
   pc_low  = _DIO24_Input(Port_C_Lower);

   printf(" Port B , Port C High  nibble Output Data = %X\n",i);
   
   printf(" Port A              ( 8 bit) , Read Data = %X \n",pa);
   printf(" Port C Lower nibble ( 4 bit) , Read Data = %X \n",pc_low);

  if( getch()=='q') exit();
  }

}
