Second day trying to get the character from byte value which was scaled by 0x40 bytes
I’m trying to get hex value from Logic Pro/Mackie Control.
Logic sends me 0xE, it mean this is ‘n’. If it sends me ‘4e’ it mean I should draw on the display ‘n.’ (simply add dot at the end).
Here is formula for converting char to byte. Please help me made vice versa formula.
char translate_seven_segment( char achar )
{
achar = toupper( achar );
if ( achar >= 0x40 && achar <= 0x60 )
return achar - 0x40;
else if ( achar >= 0x21 && achar <= 0x3f )
return achar;
else
return 0x00;
}
char s = 'N';
Byte ad = translate_seven_segment( s ) + ( '.' == '.' ? 0x40 : 0x00 );
I found also following code (this seems without topper()):
def translate_seven_segment( char )
case char
when 0x40..0x60
char - 0x40
when 0x21..0x3f
char
else
0x00
end
end
How I can reverse it ? I know mackie use this code to build hex from char. But I need vise versa, is to get char from hex.
OK, I see you added the note about wanting to reverse the sequence. If that’s the case it’s fairly simple: