Sign in

username:

password:



Not a member?

Search avrclub



Search tips

Subscribe to avrclub



avrclub by Keywords

AT90S2313 | AT90S8515 | ATMega | ATmega128 | ECL | FETS | IAR | Keyboard | LCD | STK50 | TMOS | UART

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Advertise Here

Atmel AVR Microcontroller discussion group.

C CODE - pruchj1 - Apr 15 7:10:00 2005


Hi!
Donīt you have someone C code, which implement simple protocol on
UART? Iīve Atmega128. I want to be sure, that recieve data are ok,
without mistakes. For example checksum after recieving message...
Thank you!

Honza.





(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )


Re: [AVR club] C CODE - Victor Tatischev - Apr 18 2:25:00 2005


--- pruchj1 <pruchj1@pruc...> wrote: > Hi!
> Donīt you have someone C code, which implement
> simple protocol on
> UART? Iīve Atmega128. I want to be sure, that
> recieve data are ok,
> without mistakes. For example checksum after
> recieving message...
> Thank you!
>
> Honza. __________________________________

[Non-text portions of this message have been removed]




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] C CODE - Dave VanHorn - Apr 18 9:07:00 2005

At 06:10 AM 4/15/2005, pruchj1 wrote: >Hi!
>Donīt you have someone C code, which implement simple protocol on
>UART? Iīve Atmega128. I want to be sure, that recieve data are ok,
>without mistakes. For example checksum after recieving message...
>Thank you! Well, both sides of the conversation need to be speaking the same protocol.

One of the simplest is Xmodem, which implements a checksum of the data.
In an xmodem packet, you send the block number,
the complement of the block number, 128 data bytes, then the checksum.
The checksum is simply the result of adding all
the data into an 8 bit register, and throwing
away the carries. (modulus 8 addition)
If you get an errored packet, you send an ASCII
NAK in response, and the host sends the packet again.
If you get a good packet, you send an ASCII ACK,
and the host sends the next packet.

At the higher level, too many errors in a row
causes you to abort the transfer, by sending multiple ^X chars.
Something you should be aware of though, this
group is pretty much abandoned, and we are all over at AVR-Chat.





(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )