ANS HAFEEZ
Advanced Member level 4
- Joined
- Jul 25, 2013
- Messages
- 101
- Helped
- 5
- Reputation
- 10
- Reaction score
- 5
- Trophy points
- 1,298
- Location
- LAHORE,PAKISTAN
- Activity points
- 1,911
SALAM
i am using a C# programme which reads a file and send a string of data to ATMEGA32 via serial port .
for checking purpose i put the incoming data to portA.
as ATMEGA32 recieves data all pins of portA become at logic 1 no matter what kind of data is coming or
if i send different data ...
any tip about programming for ATMEGA32 my code is here
i am using a C# programme which reads a file and send a string of data to ATMEGA32 via serial port .
for checking purpose i put the incoming data to portA.
as ATMEGA32 recieves data all pins of portA become at logic 1 no matter what kind of data is coming or
if i send different data ...
any tip about programming for ATMEGA32 my code is here
Code:
#include <avr/io.h>
# define F_CPU 16000000UL
void INIT_USART(void)
{
UCSRB = (1<<RXEN);
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
UBRRL = 103;
UBRRH = (103>>8);
}
char USARTReadChar()
{
while(!(UCSRA & (1<<RXC))){}
return UDR;
}
int main()
{
char data;
INIT_USART();
DDRB=0xFF;
while(1)
{
data = USARTReadChar();
PORTB=data;
}
}
Last edited by a moderator: