- Mon Apr 12, 2010 9:10 pm
#98384
Hi Guys,
I'm really stuck, after working on the tutorial shown on the sparkfun website on hooking the ATmega8/168/328 to RS232 i've gotten it to the point where if i loop the MAX232 it works great. i can get the LED to light up as per the initial programming tutorial. i have hooked the ATmega328 to the MAX232 and followed the code examples in the 328 Datasheet.
BUT it will not send data to the hyperterminal.
here is my code.
oh and on occasion when i try to save/build the project is get the following error
"Encountered a Sharing Violation while accessing
C:\Users\Matt\Documents\AVR Projects\Serial328\MFC31C1.tmp."
im using windows 7.
however i can still retry the save/build and it works fine.
oh and yes. hyperterminal is setup for the BAUD rate etc etc.
Cheers,
Matt
I'm really stuck, after working on the tutorial shown on the sparkfun website on hooking the ATmega8/168/328 to RS232 i've gotten it to the point where if i loop the MAX232 it works great. i can get the LED to light up as per the initial programming tutorial. i have hooked the ATmega328 to the MAX232 and followed the code examples in the 328 Datasheet.
BUT it will not send data to the hyperterminal.
here is my code.
Code: Select all
any help would be awesome!!!#include <avr/io.h>
void USART_Init() {
// BAUD 2400, No Parity, 1 Stop Bit, Asyncronous
UCSR0A = 0x00;
UCSR0B = 0x18;
UCSR0C = 0x86;
UBRR0H = 0x00;
UBRR0L = 0x33;
}
void USART_Transmit( unsigned char data ) {
// Wait for empty transmit buffer */
while ( !( UCSR0A & UDRE0) );
// Put data into buffer, sends the data */
UDR0 = data;
}
int main() {
// status LED
DDRC = 255;
PORTC = 255;
USART_Init();
USART_Transmit('h');
USART_Transmit('e');
USART_Transmit('l');
USART_Transmit('l');
USART_Transmit('o');
return 0;
}
oh and on occasion when i try to save/build the project is get the following error
"Encountered a Sharing Violation while accessing
C:\Users\Matt\Documents\AVR Projects\Serial328\MFC31C1.tmp."
im using windows 7.
however i can still retry the save/build and it works fine.
oh and yes. hyperterminal is setup for the BAUD rate etc etc.
Cheers,
Matt
Hi