/*
DEMO97.c: Shows how to use the DelayMs function to switch the LED ON or OFF.

Compiler: BC++ 3.1, 
          Turbo C++ 1.01(3.01) (free from http://cc.codegear.com/free/cpp)
          MSC 6.0,
          MSVC 1.52.

Compile mode: Large

Project: DEMO97.c
         ..\..\Lib\(8000e.Lib, 7188el.Lib or 7186el.Lib)

Hardware: i-7188/uPAC-7186/i-8000

Note: Function used:
      DelayMs  -->  delay time interval. unit is ms

[Oct 30, 2008] by Liam
*/

#include <stdio.h>
#include "..\..\lib\7186e.h"

void main(void)
{
    int LedMode=0;
    unsigned long value;
    int quit=0;
    
    InitLib();
    
    Print("Test DelayMs() ...\r\n");
    Print("Now LED must flash once every second\r\n");
    Print("Press 'q' to quit\r\n");
    
    LedOff();
    while(!quit)
    {
        if(Kbhit())
        {
            switch(Getch())
            {
                case 'q':
                    quit=1;
                    break;
            }
        }
        
        DelayMs(500);
        if(LedMode)
        {
            LedMode=0;
            LedOff();
        }
        else
        {
            LedMode=1;
            LedOn();
        }
    }
    
    LedOn();
}

