Energy Meter IC Family Software Instruction Manual

71M652X Software User’s Guide
Revision 1.7 TERIDIAN Proprietary 62 of 138
© Copyright 2005-2007 TERIDIAN Semiconductor Corporation
Command Pending
cmd_pending()
UART0 echo
no entry
len = 0?
c = len
cli_buff[ cli_index ] = NUL_
cp = cb
return (FALSE)
echo0?
S_EMPTY != *status
status = Serial_Tx (port, cb, len)
call_when_waiting()
Y
Y
Y
N
N
cli_index--
Y
BS_ == c ?
CLI_BASE != cli_index CTRL_X == c)
cli_index = CLI_BASE
c >= ' '
(CLI_BASE == cli_index) && (','
== c)
cli_index++
cli_buff[ cli_index ] && cli_index
< CLI_BUFF_SIZE
status=Serial_Tx(port,cli_buff,cli_idx)
cli_index<CLI_BUFF_SIZE
call_when_waiting ()
S_EMPTY != *status ?
send_crlf ();
put_char (&c)
return (TRUE)
(CR_ == c) || (LF_ == c) ?
END
!(len = Serial_CRx (port, cb,
CMD_BUFF_SIZE))
i < c ?
Y
i = 0
memcpy_xx(cp+1,cp, len-i- 1)
*cp++ = CR_
(CR_== *cp || LF_==*cp)
len++
*cp = LF_
cp++
i++
cp = cb
Y
N
N
len?
len --
Y
c = *cp++
Find end of command
*cli_buff = NUL_
cli_index = CLI_BASE
status = Serial_Tx(port,cli_buff, cli_idx)
!echo_0?
call_when_waiting ()
S_EMPTY != *status)
send_crlf ()
Y
Y
Y
N
N
N
len--
cp++
return (TRUE)
cli_index = CLI_BASE
Y
N
N
N
Y
return (FALSE)
Figure 5-17: cmd_pending()