Communicate between tow microcontrollers by using USART

Status
Not open for further replies.

vhk

New Member
There is one switch in Transmitter part ( Attiny2313 : PORTB.1) and one LED (Attiny2313ORTB.0) in Reciever part. The LED must On and Off with pressing the switch but it not works. What is the problem?

The Codes in Transmitter part: (codevision)

(codewizard-->USART-->Transmitter)
...
int Data;
while(1)
{
Data=PINB.1;
printf( "%u",Data);
};

The Codes in Reciever part:

(codewizard-->USART-->Reciever)
....
int Data=0;
while(1)
{
scanf("%u",Data);
PORTB.0=Data;
};

(TX pin in Transmitter part is connected to RX pin in Reciever part)

Thanks
 
Last edited:
How is the switch connected? Check that the switch actually works and the state of the PORTB.1 actually changes between logic 1 and 0 when the switch is pressed.
Is the code an example code that comes with Codevision? Did you alter the code in any way?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…