Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
Re: M68hc9s12DP256 SCI - jmey...@emittechnologies.com - Nov 14 18:43:13 2008
Here is something in C for you:
// accepts ASCII characters from serial port and
// adds them until
or max length
// echos input
// accomodates back space
void SCI1_InString(char *string, unsigned short max) {
int length=0;
char character;
character = SCI1_InChar();
while(character!=CR){
if(character==BS){
if(length){
string--;
length--;
SCI1_OutChar(BS);
}
}
else if(length
*string++=character;
length++;
SCI1_OutChar(character);
}
character = SCI1_InChar();
}
*string = 0;
}
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )