AN2120: Connecting an M68HC08 Family Microcontroller to an ...
AN2120: Connecting an M68HC08 Family Microcontroller to an ...
AN2120: Connecting an M68HC08 Family Microcontroller to an ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Application Note<br />
***********************************************************************/<br />
BYTE ModemBuffNotEmpty (void) {<br />
return !(mDataSlot == mEmptySlot);<br />
}<br />
/***********************************************************************<br />
Function : ModemInBufferCount<br />
Parameters : None<br />
Date : J<strong>an</strong>uary 2001<br />
Desc : Returns the number of characters available in the Modem<br />
Queue.<br />
***********************************************************************/<br />
BYTE ModemInBufferCount (void) {<br />
if ((mEmptySlot - mDataSlot) >= 0)<br />
return (BYTE)(mEmptySlot - mDataSlot);<br />
else {<br />
return (BYTE)((mEmptySlot + MODEM_BUFFER_SIZE) - mDataSlot);<br />
}<br />
}<br />
/***********************************************************************<br />
Function : Waitfor<br />
Parameters : A string <strong>to</strong> wait for<br />
A Time out value<br />
Date : J<strong>an</strong>uary 2001<br />
Desc : Returns True if Modem response matches the String argument,<br />
False otherwise. Time is the number of times the Delay funtion<br />
will be called from within the waiting loop.<br />
***********************************************************************/<br />
BYTE Waitfor (char *String, BYTE Time) {<br />
BYTE c = 0;<br />
BYTE Offset = 0;<br />
while (Time-- > 0) {<br />
Delay (100); // Wait =~ 150 mSec<br />
while (ModemBuffNotEmpty()) { // Wait for characters<br />
c = ModemGetch (); // Extract a character from FIFO<br />
if (c == String [Offset]) { // Is C a part of the string?<br />
Offset++; // Compare with next character<br />
if (String [Offset] == 0) { // is this the end of string?<br />
return True; // match = True<br />
}<br />
}<br />
else // c does not belong <strong>to</strong> String<br />
Offset = 0; // Reset String pointer<br />
}<br />
<strong>AN2120</strong><br />
76 MOTOROLA