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.

Wierd Issue with UART

Status
Not open for further replies.

rahulkalpsts107

Newbie level 4
Joined
May 21, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,336
Hi ,

I'm facing a very strange issue .
I Have a serial LCD that i have connected to the board.
This serial LCD works on uart.
I'm able to display contents on the LCD via UART.
However if i want to Light up an Led connected to the board the UART just stops working.
I'm using an AVR board with atmega32.
My Fuse settings currently are HIGH : 0x99 LOW : 0xEE 4Mhz external.

My power comes from usb . since i use JTAG ICE to power it up as im debugging.

Regards,
Rahul
 

With this kind of explanation I think nobody can help you a lot. There are not details how you made connections for light on LCD. Did you use a pin from same port on which are UART (in case of ATmega32 it is PORT D). Maybe you have some problem in code when you try to put that pin high for light on LCD.

Which board you use? Is it some development tool which you bought from some company, so you can put link where we can see schematic of the board?
 

Hi ,

Well the led is connected to PORTB so it has no problem.
The board is this . See the link **broken link removed**
The serial lcd has rx,vcc,gnd that works at TTL 5v , so is my board .
I have attached a pic for ur ref.
IMG_2277.JPG
Also the code is here for uart
Code:
int put_uart_char(char c, FILE *fd) 
{
  while (!(UCSRA & _BV(UDRE)));  //Wait for transmit buffer to become empty. 
  UDR = c; //Write the character to the UART. 
  return 0; 
}

void print(char * string) {
int i;
	for( i = 0;i<strlen(string) ; i++) {
		_delay_ms(100);
		char c = string[i] ;
		put_uart_char((int)c , NULL);
	}
}

void clearScreen() {
	_delay_ms(100);
	put_uart_char(0x0C, NULL);
}


void uart_init(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, 1stop bit */
	UCSRC = (1<<URSEL)|(3<<UCSZ0);

	_delay_ms(400);
}

The delay is added since i see lot of issues where data is wrongly output.
Let me know if you need anything else.

Regards,
Rahul
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top