Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Proteus and interrupt debuging ?

Status
Not open for further replies.

SphinX

Advanced Member level 3
Joined
Jan 25, 2002
Messages
822
Helped
58
Reputation
116
Reaction score
29
Trophy points
1,308
Location
EGYPT
Activity points
7,051
how to trace source code on proteus

Hi All,


I have started to learn proteus.
I wrote a simple program to make a delay of approx. 100uS
using interupt.

' Xtal= 12Mhz
Org 0000
sjmp start
Org 0bh
sjmp inter

start:
mov p1,#0
mov IE,#10000010b 'Enable interupt on Timer 0 overflow
mov TMOD,#00000010b 'Choose Timer0 Reload mode
mov TH0,#155 'Make the timer start from 155 (255-155=100us)
mov TL0,#155
SETB TR0 'Run the timer
SETB p1.0
loop: sjmp loop

inter: 'Interupt service

cpl p1.0 'Toggle p1.0
reti
END

I simulated this program using proteus, it worked good
I attatched a LogicAnalyzer to the circuit in the proteus
it give correct results.

But when i executed the debuger in proteus and start to trace into
the code (F11) i noticed that it not execute the interrupt after
the timer0 overflow and the p1.0 not change although it have worked
done in simulation !

What is the bug ?

Thanks
 

E

erickki

Guest
proteus interrupt test

Cross-posting is not allowed. One post/subject. Other one is deleted!

erickki
 

james

Member level 2
Joined
Sep 14, 2003
Messages
49
Helped
6
Reputation
12
Reaction score
4
Trophy points
1,288
Activity points
1,883
enable interrupts in proteus

Pharaoh of Egypt,

No any bug. The problem is .... interrupts are very hard to trace out using step by step for many emulators. And don't forget proteus is a software simulator.

Let say (although you didn't specified about which micro you're using) you're working with 8051 core.

The program is simple:
your assembly code sets timer0 interrupt flag and reload registers, then clears the port p1.0 and finally goes in a loop for ever.
Every 100us timer overloads and a Timer0 interrupt is generated.
The interrupt routine do the complement of previous state of p1.0. The result should be a square wave at period of 200us (5KHz).

If you want to see interrupt executing, use breakpoints.

So, use CTRL+F12; the cpu source code dialog should open.

Now, click over the line "cpl p1.0". This is the first line of your service interrupt routine. Click F9; a red check point should be appeared at the left of above code line.

Finally press F12. Your interrupt routine should be traced now and you can measure the time interrupt on the state bar.

I didn't test your code, but if working, the above procedure should allow you to trace interrupt.

Hope this helps in some way

james
 

SphinX

Advanced Member level 3
Joined
Jan 25, 2002
Messages
822
Helped
58
Reputation
116
Reaction score
29
Trophy points
1,308
Location
EGYPT
Activity points
7,051
Thanks Very Much

I use 89C2051 uC

This help me.

The time 102 us :)


Thanks again,
Bye
AmR
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top