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.

PORTEUS 7 related problem...

Status
Not open for further replies.

ismbn

Full Member level 3
Joined
Feb 11, 2012
Messages
160
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,308
Location
Mumbai. india
Activity points
2,444
Hi all...

I am using Porteus 7 professional for circuit simulation... and using AVR studio 4.


Now the problem is I am doing coding for making baud rate of 9600 or 19200 or what ever but when i am simulation the program it's working on baud rate of only 1200: what is the problem behind this i am sending the code all the file please tell me if i am wrong any where:I am using AT MEGA 2560 in the project :

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<avr/io.h>
#include<avr/interrupt.h>
#include<delay.h>
#define Baud_rate 19200
#define ubrr_value (((F_CPU/(Baud_rate * 16UL))-1))
int a,c=1;
int main(void)
{
DDRB=0XFF;
DDRD=0XFF;
UBRR0H = (ubrr_value>>8);
UBRR0L = (ubrr_value);
sei ();
UCSR0B=(1<<RXCIE0) | (1<<TXCIE0)|(1<<RXEN0)|(1<<TXEN0);
UCSR0C=(3<<UCSZ00);
 
while(1)
{
//_delay_ms(10);
//UDR0='p';
//a=UDR0;
 
/*for(int i=0;i<=256;i++)
    {
    UDR0=i; 
    }*/
}
 
}
int b=1;
    ISR (USART0_RX_vect)
    {
    PORTB=c;
    c++;
    a=UDR0;;
 
    UDR0=a;
    }
 
    ISR (USART0_TX_vect)
    {
    PORTD=b;
    b++;
    }



View attachment serial comm.rar


Thanks Regards
ISMAIL
 

You are currently using 8MHz clock in the simulation (internal RC), change the mcu properties in proteus to crystal 16MHz as in your code

- - - Updated - - -

Actually I'm not sure of the clock frequency you intend to use, is it 8MHz?
 

no sir i have tried i changed it to the other clock frequency also it but it is not working at all...

please tell me what to do. Do i need to to check this in hardware only???
Ismail
 

What does your code do. I dont know ATMEGA, but I will try to help. where is sei() function?
 
Last edited:
  • Like
Reactions: ismbn

    ismbn

    Points: 2
    Helpful Answer Positive Rating
@internetuser2k12

the sei(); function is on the line No. 13
plz see

Now i am using the the hardwear hear also the sam prblem
 

line no 13 only calls sei() function. Where is the function prototype and where is the actual function in the code?
 

oh... sorry sei() function is in the #include<avr/interrupt.h>
this function enables the global interrupt pin if u have installed win avr u can find it in C:\WinAVR\avr\include\avr\interrupt.h

ismail
 

OK. I have avr studio 6. I tried to compile your code, but I got error. It said delay.h missing. I cant find delay.h file on my system. Can you upload the file?
 

Last edited:

@madhusuthanan ....
sorry i din't got u..
i have checked the code 1000 times... but faild to do it... if you can suggest me for some changes it will be great.......

Regard
Ismail
 

hi ismail,

still you have the problem.

- - - Updated - - -

please specify the crystal that you have used in hardware
 

this is also 16MHz...
it is set in the properties of the program...
and yes you was asking for the
_delay_ms(10);

for this you have to do::

#include <util/delay.h>
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top