Page 3 of 6
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 12:18 pm
by ChrisT66
Tried it, the result remained the same
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 12:24 pm
by mnfisher
Is that with the alternative conversion (.lsb and .msb)?
Looks like sign extension issue...
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 12:31 pm
by ChrisT66
Yes with .lsb und .msb
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 12:40 pm
by mnfisher
Odd - Can you print out the 30 bytes of data (of payload) - I'll have a play this evening (just on my phone at the moment).
It could be tat it is sending delta values but something else might be awry..
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 12:52 pm
by ChrisT66
0: 220
1: 197
2: 212
3: 213
4: 208
5: 87
6: 232
7: 195
8: 220
9: 213
10: 220
11: 85
12: 220
13: 197
14: 220
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 1:05 pm
by mnfisher
Thanks,
First value is 220 + (197 * 256) =50652. This will display as a negative number on the LCD display (the print number takes signed 16 bit values)
Do the values look sensible or are they completely adrift (what is sending the data here?)
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 1:30 pm
by ChrisT66
The values should actually all be around 1500 (or at least the first 6, as the values come from a 6-channel RC transmitter). In the centre position, the value of each channel is 1500.
What is strange is that the strange received values vary by exactly 1000 between the upper and lower transmitter positions.
Just like the actual values can be between 1000 and 2000. The change is therefore transmitted correctly.
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 2:07 pm
by ChrisT66
I have now saved the second received data records as standard values (the first data records after starting the program are strangely always different, from the second, they remain constant) I now always subtract these standard values from the received data and add 1500, i.e. I always get 1500 in the normal case. With a maximum change, the values are now between 1000 and 2000.
This solution is not a dream, but it works somehow...
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 2:13 pm
by mnfisher
Sounds like a good solution...
I wondered if it was a twos complement value - but that doesn't give reasonable values either?
So - glad it seems to be working AOK...
Martin
Re: UART Transmission with atmega328p
Posted: Mon Oct 14, 2024 2:20 pm
by ChrisT66
Here is your modified chart. What I don't like so much is this norm value and mean value formation, because you also have to ignore the first value.
I'm sure you have a better method for this, don't you?
Thanks again for your great help, I wouldn't have been able to do it otherwise!
Greetings Chris