how can i connect atmega32 to PC ?

Thread Starter

Mil Nik

Joined Nov 26, 2016
12
hi guys ..
I have little problem I cant connect my atmega32 to pc ...
like this simple program for Temperature ..
port 30 : vcc..
port 31 : gnd..
portA.0 : Analog input..
and a crystal 11.0592 to port 12 & 13...
and portD.0 for sending to pc..
.............................................................................
#include<mega32.h>
#include<delay.h>
#include<stdio.h>
#include<stdlib.h>

int t;
char s[3];

void main(void)
{
ADMUX=0b01000000;
ADCSRA=0b10000111;
UCSRA=0x00;
UCSRB=0x08;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x47;
while(1)
{
ADCSRA=0b11000111;
while((ADCSRA&0b00010000)==0);
ADCSRA=0b10010111;
t=ADCW/2;
itoa(t,s);
printf("%s",s);
delay_ms(200);
}
}
 
Top