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.
#include "CommDrv.h"<br />
#include "ModemDrv.h"<br />
#define MODEM_BUFFER_SIZE 32 // Size of Modem Buffer<br />
<strong>AN2120</strong><br />
Application Note<br />
Code Implementation<br />
#define DTR_ON PORTD &= 0xFE; // DTR Pin is PORTD0, Macro <strong>to</strong> set it ON<br />
#define DTR_OFF PORTD |= 0x01; // Macro <strong>to</strong> set DTR OFF<br />
#define DTR_PIN (PORTD & 0x01) // DTR Pin = Pin 0 of PORT D<br />
// Byte pointers of the ring buffer (FIFO)<br />
volatile BYTE mDataSlot = 0; // Points <strong>to</strong> the next available character<br />
volatile BYTE mEmptySlot = 0; // Points <strong>to</strong> next available slot of the FIFO<br />
static BYTE *ModemBuffer; // Pointer <strong>to</strong> Modem buffer<br />
/***********************************************************************<br />
Function : ModemInit<br />
Parameters : None<br />
Date : December 2000<br />
Desc : Initializes the ring buffer & clears the DTR pin<br />
***********************************************************************/<br />
void ModemInit (void) {<br />
mDataSlot = 0; // Initialize FIFO Modem pointers<br />
mEmptySlot = 0;<br />
DDRD |= 0x01; // DTR pin set <strong>to</strong> output<br />
DTR_OFF; // DTR Off<br />
}<br />
/***********************************************************************<br />
Function : ModemBuffFlush<br />
Parameters : None<br />
Date : J<strong>an</strong>uary 2001<br />
Desc : Flushes the receiving FIFO (ring buffer)<br />
***********************************************************************/<br />
void ModemBuffFlush (void) {<br />
mDataSlot = mEmptySlot;<br />
}<br />
/***********************************************************************<br />
Function : ModemDial<br />
Parameters : A string containing the phone number <strong>to</strong> dial<br />
Date : December 2000<br />
MOTOROLA 73