budimanc
Newbie level 5
Hi everyone...
I got some problems in connecting my ATMega16 to Siemens C35 by using CodeVision.
I have tried connecting:
1. Siemens C35 to PC using HyperTerminal(from Windows) /Terminal (from CodeVision). The Result: OK
2. ATMega16 to PC by testing my USART(using MAX232) to computer. The result is OK
3. ATMega16 to Siemens C35. The Result is bad, n i think no communication.
For addition the configuration for terminal is
Baudrate : 19200 bps
Data bits : 8
Parity : None
Stop bits : 1
Flow Control : None
I think from what i got, in connecting ATMega16 to Siemens C:
We need to deactivate echo by giving command ate0.
n the respon from Siemens should be OK n i try to display it to my LCD.
The listing program is.
/*****************************************************
This program was produced by the
CodeWizardAVR V1.25.3 Standard
Automatic Program Generator
© Copyright 1998-2007 Pavel Haiduc, HP InfoTech s.r.l.
HP InfoTech, Development Tools for Microcontrollers, C Compilers, In-System Programmers
Chip type : ATmega16
Program type : Application
Clock frequency : 12.000000 MHz
Memory model : Small
External SRAM size : 0
Data Stack size : 256
*****************************************************/
#include <mega16.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x18 ;PORTB
#endasm
#include <lcd.h>
#include <delay.h>
// Standard Input/Output functions
#include <stdio.h>
// Declare your global variables here
void main(void)
{
// Declare your local variables here
unsigned char test[16];
unsigned char lcd_buffer[16];
PORTA=0x00;
DDRA=0x00;
PORTB=0x00;
DDRB=0x00;
PORTC=0x00;
DDRC=0x00;
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 19200
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x26;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// LCD module initialization
lcd_init(16);
while (1)
{
printf ("ate0");
delay_ms(500);
putchar (13);
test[0]=getchar ();
test[1]=getchar ();
sprintf (lcd_buffer,"%s",test);
lcd_gotoxy(0,0);
lcd_puts(lcd_buffer);
delay_ms(10000000);
};
}
The Schematic diagram for ATMega16 + USART is :
For the fuse bits, I'm using
Ext: 0xFF
High: 0XD9
Low: 0xFF
Please help me to solve my problem as soon as possible.
---------- Post added at 02:24 PM ---------- Previous post was at 02:00 PM ----------
Download link : **broken link removed**
---------- Post added at 02:25 PM ---------- Previous post was at 02:24 PM ----------
Download link : **broken link removed**
I got some problems in connecting my ATMega16 to Siemens C35 by using CodeVision.
I have tried connecting:
1. Siemens C35 to PC using HyperTerminal(from Windows) /Terminal (from CodeVision). The Result: OK
2. ATMega16 to PC by testing my USART(using MAX232) to computer. The result is OK
3. ATMega16 to Siemens C35. The Result is bad, n i think no communication.
For addition the configuration for terminal is
Baudrate : 19200 bps
Data bits : 8
Parity : None
Stop bits : 1
Flow Control : None
I think from what i got, in connecting ATMega16 to Siemens C:
We need to deactivate echo by giving command ate0.
n the respon from Siemens should be OK n i try to display it to my LCD.
The listing program is.
/*****************************************************
This program was produced by the
CodeWizardAVR V1.25.3 Standard
Automatic Program Generator
© Copyright 1998-2007 Pavel Haiduc, HP InfoTech s.r.l.
HP InfoTech, Development Tools for Microcontrollers, C Compilers, In-System Programmers
Chip type : ATmega16
Program type : Application
Clock frequency : 12.000000 MHz
Memory model : Small
External SRAM size : 0
Data Stack size : 256
*****************************************************/
#include <mega16.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x18 ;PORTB
#endasm
#include <lcd.h>
#include <delay.h>
// Standard Input/Output functions
#include <stdio.h>
// Declare your global variables here
void main(void)
{
// Declare your local variables here
unsigned char test[16];
unsigned char lcd_buffer[16];
PORTA=0x00;
DDRA=0x00;
PORTB=0x00;
DDRB=0x00;
PORTC=0x00;
DDRC=0x00;
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 19200
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x26;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// LCD module initialization
lcd_init(16);
while (1)
{
printf ("ate0");
delay_ms(500);
putchar (13);
test[0]=getchar ();
test[1]=getchar ();
sprintf (lcd_buffer,"%s",test);
lcd_gotoxy(0,0);
lcd_puts(lcd_buffer);
delay_ms(10000000);
};
}
The Schematic diagram for ATMega16 + USART is :
**broken link removed**
For the fuse bits, I'm using
Ext: 0xFF
High: 0XD9
Low: 0xFF
Please help me to solve my problem as soon as possible.
---------- Post added at 02:24 PM ---------- Previous post was at 02:00 PM ----------
Download link : **broken link removed**
---------- Post added at 02:25 PM ---------- Previous post was at 02:24 PM ----------
Download link : **broken link removed**