/*
    Led_7led.c : To control red led .                              
                                                                                    
    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: Led_7led.c                                                                  
             ..\Lib\(8000E.Lib,7188XAL.Lib,7188XBL.Lib,7188XL.Lib or 7188EL.Lib)    
                                                                                    
    Hardware: 7188/8000                                                             
    
[24 May,2005] by Bill
*/

#include"..\..\lib\vh2k.h"

void main(void)
{
    int i,data;
    
    InitLib();
    Print("Start to test LED(red LED)\n\r");
    for(;;)
    {
        for(i=0;i<16;i++)
        {
            
            
            switch (i)
            {
            	case 0:
            		Print("RUN ON,L1 ON,L2 ON\n\r");
                	LedOn(); //open RUN LED (green light)
                	Led1On();//open L1 LED (red light)
                	Led2On();//open L2 LED (red light)
                	break;
                case 2:
            		Print("RUN ON,L1 ON,L2 OFF\n\r");
                	LedOn(); //open RUN LED (green light)
                	Led1On();//open L1 LED (red light)
                	Led2Off();//close L2 LED (red light)
                	break;
                case 4:
            		Print("RUN ON,L1 OFF,L2 ON\n\r");
                	LedOn(); //open RUN LED (green light)
                	Led1Off();//close L1 LED (red light)
                	Led2On();//open L2 LED (red light)
                	break;
                case 6:
                	Print("RUN ON,L1 OFF,L2 OFF\n\r");
                	LedOn(); //open RUN LED (green light) 
                	Led1Off();//close L1 LED (red light)
                	Led2Off();//close L2 LED (red light)
                	break;
                case 8:
            		Print("RUN OFF,L1 ON,L2 ON\n\r");
                	LedOff(); //close RUN LED (green light)
                	Led1On();//open L1 LED (red light)
                	Led2On();//open L2 LED (red light)
                	break;
                case 10:
            		Print("RUN OFF,L1 ON,L2 OFF\n\r");
                	LedOff(); //close RUN LED (green light)
                	Led1On();//open L1 LED (red light)
                	Led2Off();//close L2 LED (red light)
                	break;
                case 12:
            		Print("RUN OFF,L1 OFF,L2 ON\n\r");
                	LedOff(); //close RUN LED (green light)
                	Led1Off();//close L1 LED (red light)
                	Led2On();//open L2 LED (red light)
                	break;
                case 14:
                	Print("RUN OFF,L1 OFF,L2 OFF\n\r");
                	LedOff(); //close RUN LED (green light) 
                	Led1Off();//close L1 LED (red light)
                	Led2Off();//close L2 LED (red light)
                	break;
                
            		
                default:
                	Print("Toggle RUN,L1 and L2\n\r");
                	LedToggle();
                	Led1Toggle();
                	Led2Toggle();
           }
           /*     	
            
            if(i==0 || i==2 || i==4 ||i==6 || i==8)
            {
            	Print("L1 ON,L2 OFF\n\r");
                LedOn(); //Open the LED 
                Led2Off();
                
                
            }
            else
            {
            	Print("L1 OFF,L2 ON\n\r");
                LedOff();   //Close the LED                    
                Led2On();
            }
            */
            //Show any segment of the 5-Digit Led
            //Show5DigitLed(1,i);
            //Show5DigitLed(2,i);
            //Show5DigitLed(3,i);
            
            //Show any segment of the 5-Digit Led and also can show the DOT '.'.
            //Show5DigitLedWithDot(4,0xA);    //Show the fourth led is 'A'. 
            //Show5DigitLedWithDot(5,0xE);    //Show the fifth led is 'E'.
            
            if(Kbhit())                   
            {                             
                data=Getch();             
                if(data=='q' || data=='Q')
                {                         
                    return;               
                }                         
            }                             
            Delay(5000); //Show the value of 7seg in every 500 ms.
        }    
    }
}
