Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

interface Atmega32 with rs232 and max 232....

Status
Not open for further replies.

hanukaran

Junior Member level 2
Joined
Oct 15, 2010
Messages
24
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,283
Activity points
1,542
now i wan sen data to be shown in pc.I use visual basic for that. now the problem how to write the coding to send the data to rs232...can anyone help me...i have attached my coding and my schematic of circuit and the interface
 

Attachments

  • project.rar
    71 bytes · Views: 97

here i attach the files....sorry
 

Attachments

  • project.rar
    164.2 KB · Views: 108

If I understand correctly you are asking for help on the pc side communication software, not the mcu code.
I'm not not sure if this is the right category for that.

Alex
 

now the problem how to write the coding to send the data to rs232
If this is your problem (sending data from controller to PC) , here's a sample program.
Code:
// USART0 initialisation
void USART0_Init(unsigned short int F_CPU_MHz, unsigned short int Baud_Rate)
{
/*****************************************************************************************************************
Description:	Initialize the UART0 hardware with the required BaudRate
Input:			Frequency of the Microcontroller, Desired BaudRate
Output:			None
*****************************************************************************************************************/ 
	UCSR0B = 0x00; 										// Disable while setting baud rate
	UCSR0A = 0x00;										// Disable USART flags
	UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);		// 8-Bit data, 1-Bit Stop
	UBRR0L = ((F_CPU_MHz*1000000)/Baud_Rate/16)-1;		// Set Baud Rate Lo - Asynch Normal Mode
	UBRR0H = 0x00; 										// Set Baud Rate Hi
	UCSR0B = (1<<RXEN0)|(1<<TXEN0);					// Enable USART TX and RX
}

// Send a single byte to the computer
void Send_Byte(char data)
{
/*****************************************************************************************************************
Description:	Send a single byte on the UART port
Input:			A character to be sent
Output:			None
*****************************************************************************************************************/ 
    while ((UCSR0A & (1<<UDRE0)) == 0);
	UDR0 = data;
}

// Receive a single byte from the computer
char Receive_Byte(void)
{
/*****************************************************************************************************************
Description:	Receive a single byte on the UART port
Input:			None
Output:			A character with the received byte
*****************************************************************************************************************/ 
    while((UCSR0A&(1<<RXC0)) == 0);
    return UDR0;
}
 
thanks for your answer and valuable time.....in my c# coding which i attach .... while (1)
{
red_1=0;
red_2=1;
green_1=1;
delay_green();
green_1=0;...............

if red_1=0..should send data to pc that will shown in Vb then it will return to red_2..how to edit this....
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top