|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
|
Listing 3-Transmitting a value using multidrop protocol is a two-stage operation. First, the drop address must be sent, then the character. The protocol for handling bus contentions is not given.
#define SENDMultiDropADDRESS 0x80 // Transmit using multidrop protocol
#define WRITEREADY 0x04
#define CLOCKED 0x08
void MultiDropSend(char value, char dropaddress) {
char temp;
ResetToMODE1( ); // Configure DUART to send 9-bit address
temp = *MODE1;
ResetToMODE1( );
*MODE1 = temp | SENDMultiDropADDRESS;
while((TXDONE & WRITEREADY) != WRITEREADY) // Wait till DUART can send
*TXHOLD = dropaddress; /* Wait */ ;
while((*TXDONE & CLOCKED) != CLOCKED) // Wait till value has been clocked out
/* Wait */ ;
ResetToMODE1( ); // Configure DUART to send 9-bit value
temp = *MODE1;
ResetToMODE1( );
*MODE1 = temp & ~ SENDMultiDropADDRESS;
while((*TXDONE & WRITEREADY) != WRITEREADY) // Wait till DUART can send
/* Wait */ ;
* TXHOLD = value;
while((*TXDONE & CLOCKED) != CLOCKED) // Wait till value has been clocked out
/* Wait */ ;
}
|
|||||||||||||||||||||||||||||||||
|
Copyright © 2003 ChipCenter-QuestLink About ChipCenter-Questlink |
||||||||||||||||||||||||||||||||||