DPRG
DPRG List  



[DPRG] Sending RS232 to Atmel

Subject: [DPRG] Sending RS232 to Atmel
From: Kipton Moravec kip at kdream.com
Date: Mon Oct 10 21:37:27 CDT 2005

I know this may seem like a stupid question, but what is the chip you
are using for translation from Atmel to RS-232 levels? 

Sometimes people forget that the Atmel has a UART, but a RS-232 chip is
needed to convert the signals to RS-232 levels. 

Kip

On Mon, 2005-10-10 at 17:47 -0700, Aishah Anwar wrote:
> Hi,
> I have a query. I have programmed my Atmel ATMEGA8
> chip to be able to receive data from my GUI (Visual
> Basic 6) using the UARTS. I am sending a character '1'
> from the VB to my Atmel chip.
> 
> 
> Right now any characters i send to the atmel chip from
> the VB, it keeps going to default. Is it because the
> Atmel chip is unable to know that a character is sent
> from the VB? Below is just a small part of the program
> of my ATMEL.
> 
> I would really appreciate some assistance. Kindly
> assist? Thank you very much.
> 
> Regards
> Aishah
> while(1)
> 	{
> 
> d = USART_RECEIVE();	// Wait for a character from the
> VB program
> switch (d) {
> 
> case '3':	// Check if VB sent the character 1
> ~(_BV(0)|_BV(2)); // Turn Lamp off
> 			
> while (checkForSerialData() != 0) { 
> delay_ms(300);
> PORTC = (_BV(0)|_BV(2)); // Turn Lamp on
> delay_ms(300);
> PORTC = ~(_BV(0)|_BV(2));// Turn Lamp off
> }
> break;
> 
> case '2':	// Check if VB sent the character 2
> (_BV(0)|_BV(2));// Turn Lamp off
> pwmIsEnabled = 0;
> break;
> 
> case '1':	// Check if VB sent the character 1
> PORTC = ~(_BV(0)|_BV(2));// Turn Lamp off
> pwmIsEnabled = 0;
> break;
> 
> default:
> PORTC = ~PORTC;
> }
> usart_putc('a');	// Tell the VB program that we have
> recieved something
> 
> 
> 	
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at dprg.org
> http://list.dprg.org/mailman/listinfo/dprglist
> 
-- 
Kipton Moravec <kip at kdream.com>


More information about the DPRG mailing list