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 />
Desc : It sets the modem response mode <strong>to</strong> numeric (instead of verbose),<br />
then it dials a phone number & sets the DTR pin. This function<br />
returns a numeric code describing a response from the modem or<br />
a timeout. Applications should h<strong>an</strong>dle this reaponse code.<br />
***********************************************************************/<br />
BYTE ModemDial (char * Number) {<br />
signed char delayCount = 80;<br />
tr<strong>an</strong>smit ("ATV0\r"); // Force a numeric response from modem<br />
if (!Waitfor ("0", 30)) { // Wait for <strong>an</strong> OK response<br />
return -1;<br />
}<br />
}<br />
DTR_ON; // Set DTR <strong>to</strong> ON<br />
tr<strong>an</strong>smit ("ATDT"); // Dial the ISP number<br />
tr<strong>an</strong>smit (Number);<br />
tr<strong>an</strong>smit ("\r");<br />
ModemBuffFlush (); // Flush contents of buffer<br />
// Wait for a reply<br />
while ((!ModemBuffNotEmpty()) && (--delayCount > 0)) {<br />
Delay (250);<br />
}<br />
if (delayCount) {<br />
return ModemGetch (); // Return the numeric response <strong>to</strong> caller<br />
}<br />
return -1; // No response received from modem<br />
/***********************************************************************<br />
Function : ModemH<strong>an</strong>gUp<br />
Parameters : None<br />
Date : December 2000<br />
Desc : This function clears DTR <strong>to</strong> force the modem <strong>to</strong> h<strong>an</strong>g up if<br />
it was on line <strong>an</strong>d/or make the modem <strong>to</strong> go <strong>to</strong> comm<strong>an</strong>d mode.<br />
***********************************************************************/<br />
void ModemH<strong>an</strong>gUp (void) {<br />
DTR_ON; // Make a DTR tr<strong>an</strong>sition <strong>to</strong> h<strong>an</strong>g-up<br />
Delay (40); // Wait a couple of miliSeconds<br />
DTR_OFF; // Finish the DTR tr<strong>an</strong>sition<br />
}<br />
<strong>AN2120</strong><br />
74 MOTOROLA