I'm trying to make a embedded c project where i will input 7 chars and make some calculations with them - now i got problem getting my conversion to work - I'm working with a ATMEGA 2560, where I output the chars on uart.
Here's the code:
volatile char daata[8] = "123:456\0";
volatile char recdata[8];
volatile char data = 0;
volatile char byte;
volatile int minimum;
volatile int maximum;
volatile char mx;
volatile char mi;
and my function uses:
void putsUSART0(char *ptr)
{
while(*ptr)
{
putchUSART0(*ptr);
ptr++;
}
}
and
void putchUSART0(char tx)
{
while(!(UCSR0A & (1 << UDRE0))); // wait for empty transmit buffer
UDR0 = tx;
}
where the code im working on is:
minimum = (100 * (daata[0] - 0x30) + 10 * (daata[1] - 0x30) + daata[2] - 0x30);
maximum = daata[6] - 0x30 + 10 * (daata[5] - 0x30) + 100 * (daata[4]);
mi = minimum + 0x30;
putsUSART0("mimimum is:");
//putchUSART0(minimum );
putsUSART0(mi);
putsUSART0("maximum is:");
putchUSART0(maximum);
_delay_ms(5000);
status = requestsample;
The problem is that my output is
mimimum is:maximum is:ˆ
Can anyone explain the strange behavior.