DPRG
DPRG List  



[DPRG] Sending RS232 to Atmel

Subject: [DPRG] Sending RS232 to Atmel
From: Aishah Anwar sycochatterbox at yahoo.com
Date: Mon Oct 10 19:47:39 CDT 2005

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

More information about the DPRG mailing list