AVR studio is working fine now just by rebooting the computer (not uninstalling anything), must have been the virus.
Thanks for your interest.
Sorry for the delay, I made 2 versions of the circuit, a UART transmitter/receiver pair. They are set up more or less exactly as the diagrams on this webpage.
WinAVR AVR-GCC Tutorial (<-- click)
The two versions are very similar except in Version 1, the input to the transmitter is generated internally, transmitting 0x55 continuously. In Version 2, the input to the transmitter is external, hooked up a wire either to ground or Vcc. (In this case, the code for the transmitter and receiver is the same.) Version 1 only differs by two lines of code in the transmitter.
Here are voltage measurements for some pins that I thought were relevant. When a range is given, it means the measurement oscillated but spent most of its time in the middle of that range.
Version 1:
Transmitter: Rx=0, Tx=2.72 V, Data pin of TX434=2.72
Receiver: Data pin of RX434=0.68-0.8, Rx=0.59-0.69, Tx=4.82-4.84
Version 2:
(Case 1: Rx pin of transmitter held at 0)
Transmitter: Rx=0, Tx=4.99, Data pin of TX434=4.99
Receiver: Data pin of RX434=1.1-1.2, Rx=1.15-1.3, Tx=0
(Case 2: Rx pin of transmitter held at +5V)
Transmitter: Rx=4.99, Tx=4.99, Data pin of TX434=4.99
Receiver: Data pin of RX434=1-1.2, Rx=0.74-0.94, Tx=0
I have Proteus simulations too if you want to see them.
(Code in next post...)
---------- Post added at 05:50 ---------- Previous post was at 05:38 ----------
Version 1 code:
Code:
#include <avr/io.h>
#include <util/delay.h>
void USART_Init( unsigned int baud )
{
/* Set baud rate */
UBRRH = (unsigned char)(baud>>8);
UBRRL = (unsigned char)baud;
/* Enable receiver and transmitter */
UCSRB = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
}
void USART_Transmit( unsigned char data )
{
/* Wait for empty transmit buffer */
while ( !( UCSRA & (1<<UDRE)) )
;
/* Put data into buffer, sends the data */
UDR = data;
}
unsigned char USART_Receive( void )
{
/* Wait for data to be received */
while ( !(UCSRA & (1<<RXC)) )
;
/* Get and return received data from buffer */
return UDR;
}
//void delayms(uint8_t t)//delay in ms
//{
//uint8_t i;
//for(i=0;i<t;i++)
// _delay_ms(1);
//}
int main(void)
{
volatile uint8_t x;
//char x;
USART_Init(95); //
//this is the UBRR value, calculated from UBRR=fosc/(16(baud+1))
while(1)
{
x=0x55;
//x=USART_Receive();
// delayms(100);
USART_Transmit(x);
}
return(0);
}
Version 2 code (in both versions, this is the receiver code)
Code:
#include <avr/io.h>
#include <util/delay.h>
void USART_Init( unsigned int baud )
{
/* Set baud rate */
UBRRH = (unsigned char)(baud>>8);
UBRRL = (unsigned char)baud;
/* Enable receiver and transmitter */
UCSRB = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
}
void USART_Transmit( unsigned char data )
{
/* Wait for empty transmit buffer */
while ( !( UCSRA & (1<<UDRE)) )
;
/* Put data into buffer, sends the data */
UDR = data;
}
unsigned char USART_Receive( void )
{
/* Wait for data to be received */
while ( !(UCSRA & (1<<RXC)) )
;
/* Get and return received data from buffer */
return UDR;
}
//void delayms(uint8_t t)//delay in ms
//{
//uint8_t i;
//for(i=0;i<t;i++)
// _delay_ms(1);
//}
int main(void)
{
char x;
USART_Init(7); //
//this is the UBRR value, calculated from UBRR=fosc/(16(baud+1))
while(1)
{
x=USART_Receive();
// delayms(100);
USART_Transmit(x);
}
return(0);
}
Here's another thing, the checkbox for "Serial program downloading (SPI) enabled; (SPIEN=0)" is grayed out (can't click it) and there's a red question mark by it, I'm not using SPI but I just thought I should mention it. This is the case for all the uC right out of the box.