/*****************************/
/* AD2COM battery condition  */
/*   RS-232C version         */
/*****************************/

A communication is attempted to a hyperterminal on PC.

<<<Setting on PC>>>
The following is a programming for this time.
PC activation -> Program -> Accessary -> Hyperterminal -> Hypertrm.exe
The process above enables to obtain a voltage value to PC through a RS-232C cable.

If Hypertrm.exe is activated:
1. Prompts the setting for connection. Enter "AD2COM."
2. In Telephone Number, RS-232C selects any from com1 to com4. (example: com1)
3. Properties for com1
    bit/sec     38400
    data bit    8
    parity      none
    stop bit    1
    flow control    none
4. During connection, the counter at the left below of screen changes.
   PC should be waiting in this state.
5. When exiting, a message "Do you save the session, AD2COM?" If you select "yes" this setting is saved for the next time you click on the icon for AD2COM.

Note: if you set to serial port that is same port to PC Filer,"rupshell" process already use the port. So after terminate "rupshell" process(Alt-Ctrl-Del ->select "rupshell" to be quit.),you'll test Hypertrm.exe.


<<<Description>>>
To avoid overlaps, this section does not deal with the same points covered in lesson1 about AD2COM.

After program activation, connecting a RS-232C cable prompts to the next process.
Read a voltage value using arrow keys of onHand/Ruputer, and forward that value to the RS-232C output.

left key ---  Light load voltage value display (pwread =***d)
              RS-232C output (P0=***)
right key --- Heavy load voltage value display (pwread2=***d)
              RS-232C output (P2=***)
up key ---    LCD ON
              RS-232C output (LCD ON)
down key ---  LCD OFF
              RS-232C output (LCDOFF)
MENU key ---  Exit

When LCD is ON, use <- and -> keys to display a voltage value on the LCD screen.
When LCD is OFF, no value is displayed even with <- and -> keys.
Regardless of whether LCD is ON or OFF, an RS-232C putput is carried out.
Other keys are not enabled.

<<<Souce file>>>
For prototype declaration, refer to a C language text book.

Bkey_SH --- RS-232C cable value   Specified in rupsys.h
            Plugging/unplugging of RS-232C cable is dealt as the same as an event of other keys.

ComProc()
 Refer to the 45th line for program body.

bi_cominit()
 Initializes communication ports.

 Format
  bi_cominit(Dev,Bps,Pulse,Tout)

  int   Dev   Selection of communication method 0=none 1=Ir 2=RS-232C....
  int   Bps   Baud rate 1=115.2k 2=57.6k 3=38.4k 4=19.2k...
  int   Pulse Pulse width Only valid if Ir is selected 1=1.6usec 2=3/16bit
  int   Tout  Timeout value 0=immediate return -1=no timer monitor Others=Tout sec

  Return value 0=normal termination -1=abnormal termination

bi_comclr()
 Initializes the receiving buffers

  Return value 0=normal termination -1=abnormal termination

bi_comopen()
 Opens a communication port.
 Precisely, a communication circuit is powered ON.
 Thus, power must be OFF (closed) to terminate.

  Return value 0=normal termination -1=abnormal termination

bi_comclose()
 Closes a communication port.
 Precisely, a communication circuit is powered ON.

  Return value 0=normal termination -1=abnormal termination

PwreadProc()
 Refer to the 82nd line for program body.

MessSend()
 Refer to the 153th line for program body.

bi_complwrite()
 Sends multiple characters.

 Format
  bi_complwrite(write,len,num)

  char *write   A string to be sent
  int   len     The number of characters to be sent
  int  *num     Returns the number of characters that could not be sent.
  Return value  0=normal termination -1=abnormal termination -2=voltage drop



===============================================================================
 Copyright (c) 1998-1999.  Seiko Instruments Inc.  All rights reserved. 
===============================================================================
