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.

ATMega16 + Siemens C35 + Code Vision AVR problem

Status
Not open for further replies.

budimanc

Newbie level 5
Joined
Mar 8, 2010
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Indonesia
Activity points
1,397
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 :
**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**
 

hi friends .....
when viewed from the source code may have been true
what do you use the communication between the Siemens C35 ATMega16 ..
communication is usually between ATMega16 with Siemens C35, no need to use inverters only direct link between the port RX to Tx between their respective
try to check the conection between them, perhaps there is an error

apologize if there is one, please be corrected

salam countrymen and professionals
 
Thx. I found the problem.
My tx n rx in my rs232 is wrong.
Thx a lot for wandi for helping me.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top