Here is a great piece of code I have used in my Morse code beeping clock, it might be my 4th or 5th generation code for sending nibbles of data to a LCD unit.
I thought when I came up with it , it was a great piece of code, I can not remember how much small bit of memory it saved in the program
You might be able to modify it to your own need, that is if I read your problem correctly.
I have deleted a bit of code to make it easier to read.
Code:
void sendLcd2(int highB, int lowB)
{
Boolean twice=false;
byte nibble;
do{
nibble=(twice == false)?highB:lowB;
twice = !twice;
/*
the first time this code runs nibble == high byte, and twice == true
so this do while function repeats the second time nibble == low byte.
This time twice == false so the do while function come to end.
*/
}
while (twice == true);
return;
}
of course if you do a "do - while" function that will only run once.