UART Transmission with atmega328p

For general Flowcode discussion that does not belong in the other sections.
ChrisT66
Posts: 103
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: UART Transmission with atmega328p

Post by ChrisT66 »

Tried it, the result remained the same

mnfisher
Valued Contributor
Posts: 1628
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 142 times
Been thanked: 761 times

Re: UART Transmission with atmega328p

Post by mnfisher »

Is that with the alternative conversion (.lsb and .msb)?

Looks like sign extension issue...

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: UART Transmission with atmega328p

Post by ChrisT66 »

Yes with .lsb und .msb

mnfisher
Valued Contributor
Posts: 1628
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 142 times
Been thanked: 761 times

Re: UART Transmission with atmega328p

Post 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..

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: UART Transmission with atmega328p

Post 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

mnfisher
Valued Contributor
Posts: 1628
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 142 times
Been thanked: 761 times

Re: UART Transmission with atmega328p

Post 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?)

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: UART Transmission with atmega328p

Post 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.

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: UART Transmission with atmega328p

Post 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...

mnfisher
Valued Contributor
Posts: 1628
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 142 times
Been thanked: 761 times

Re: UART Transmission with atmega328p

Post 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

ChrisT66
Posts: 103
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: UART Transmission with atmega328p

Post 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
Attachments
IBUS2.fcfx
(23.37 KiB) Downloaded 98 times

Post Reply