Vielen Dank für deine super Antwort. Ich habe es nun so gemacht:

Code:
void Makeframe (int Wert, char *Adress)
{
	char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
	int data[4];
	unsigned char datahexchar[4];
	uint8_t i, checksum = 0xFF;
	char Check1, Check2, *Startadress = Adress;
	
	data[3] = Wert / 4096;
	Wert = Wert - (data[3] * 4096);
	data[2] = Wert / 256;
	Wert = Wert - (data[2] * 256);
	data[1] = Wert / 16;
	Wert = Wert - (data[1] * 16);
	data[0] = Wert;
	
	*Adress = '!';
	Adress++;
	for(i=4;i>0;i--)
	{
		datahexchar[i-1] = hex[data[i-1]];
		*Adress = datahexchar[i-1];
		Adress++;
	}
	
	Adress = Startadress;
	for (i = 5; i >= 1; i--)
	{
		checksum ^= *Adress;
		Adress++;
	}
	Check1 = hex[checksum / 16];
	Check2 = hex[checksum % 16];
	*Adress = Check1;
	Adress++;
	*Adress = Check2;
	Adress++;
	*Adress = 0x00;
}
Somit habe ich ja das problem mit der Terminierung auch umgangen da 0x00 ja in ascii ja nicht 0 ist sondern NUL. Oder sehe ich das falsch? Zusätzlich habe ich so auch immer die gleiche Framelänge. Was hälts du von diesem Code?