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.

pwm to generate user defined pulses using pic18f4550

Status
Not open for further replies.

vterminater

Junior Member level 1
Joined
Jul 16, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,413
i only get a high signal...when i checked it using simulator i found that the first delay itself does not end...!!it keep executing the line "here:goto here"...:|
can anyone temme whats the mistake??!
 

sidy50

Member level 4
Joined
Dec 31, 2009
Messages
79
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,839
Hi buddy...
the program stays in the loop all the time....
Here: goto Here

That means the interrupt is not getting generated...To check this problem...1st u check whether the timer is running properly or not...Do this by replacing (Here: goto Here)

Here: btfss (timer overflow flag)
goto here


& if u find that there is no problem with timer...
Then the problem lies within the interrupt initialisation...Try debugging it...


Regards.
Sidy
 

vterminater

Junior Member level 1
Joined
Jul 16, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,413
oki...but can you look at my code and temme if it is wrong??
 

sidy50

Member level 4
Joined
Dec 31, 2009
Messages
79
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,839
Hi da...

Im sorry...
Im not a good Assembly Lanugauge programmer...

The best method would be debugging it in a simulator...
Also itll improve ur programming skills if u debug it on ur own...Or hope somehelp helps u...

Regards.
Sidy.
 

millwood

Advanced Member level 3
Joined
Jul 2, 2009
Messages
734
Helped
80
Reputation
164
Reaction score
35
Trophy points
1,308
Activity points
5,088
"here:goto here".

what do you expect it to do?

a computer is stupid in that it does exactly what you have programmed it to do. here you have programmed it to loop around forever. so it loops around forever.

if you expect something else, program accordingly.
 

sidy50

Member level 4
Joined
Dec 31, 2009
Messages
79
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,839
Its means..such kind of programs wouldnt generate interrupts when u test it on a simulator...
 

123jack

Advanced Member level 2
Joined
Apr 21, 2010
Messages
547
Helped
91
Reputation
182
Reaction score
77
Trophy points
1,308
Location
UK
Activity points
5,357
Write it in C - or basic or pascal

If you cant work something that simple out the first
thing you should do is stop using assembler and change to a higher level language. That is the reason they exist.

Some simulators can indeed do interrupts. It just depends.

But he doesnt need a simulator he needs a debugger.

I'm starting to sound like a salesman but - the mikroC IDE includes a software debugger.

I suggest you download that - learn C and read their
examples (at least one of which just does what you are struggling with. )

Cut and paste it.
Compile it.
And if you really must - read the assembly output it generates.

If you still can't make it work - learn to use the software debugger and single step through it.

All this should take no more than 2 days from scratch. It really isnt that hard.

If you still have questions after doing that they will probably be the sort someone can really help with.

You might want to read their online book pages too.
That will probably help you quite a bit.

jack
 

vterminater

Junior Member level 1
Joined
Jul 16, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,413
now 1 confusion is that to start the second delay do i have to initialize isr at org 0x08
or its ot needed...i can just clear the timer register and stat over again:|
 

sidy50

Member level 4
Joined
Dec 31, 2009
Messages
79
Helped
14
Reputation
28
Reaction score
3
Trophy points
1,288
Location
India
Activity points
1,839
After initialisation of the Timer to generate interrupt, its going to occur after a delay, as per the values u have loaded in Timer registers...It will keep running in the background. Now when an interrupt occurs all u have to do is perfrom the task for which interrupt was generated, Clear the Interrupt Flag, Load the Timers & return, Now u r ready to go for another interrupt...Regards.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top