Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <string.h>
- #include <stdlib.h>
- int main(void)
- {
- char string[]="atz"; //komunikat
- char string1[]={'$',0x20,0x20,0x20,'*'};
- char a[20];
- int i=0,j=0,Z;
- UCSRB=(1<<TXEN);
- UBRRL=207;
- Z=string[0]^string[1]^string[2];
- itoa(Z,a,16);
- while(1)
- {
- for(j=0;j<7;j++)
- {
- if(j>0 && j<4)
- {
- string1[j]=string[j-1];
- }
- if(j==5)
- {
- string[j]=a[0];
- }
- }
- for (i=0;i<strlen(string1)+2;i++)
- {
- if(i==strlen(string1))
- {
- UDR=0x0D;
- }
- if(i==strlen(string1)+1)
- {
- UDR=0x0A;
- }
- if(i>=0 && i<strlen(string1))
- {
- UDR=string1[i];
- }
- while(!(UCSRA&(1<<TXC)));
- UCSRA|=(1<<TXC);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement