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.

pwm to generate user defined pulses using pic18f4550

Status
Not open for further replies.
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??!
 

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
 
oki...but can you look at my code and temme if it is wrong??
 

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.
 

"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.
 

Its means..such kind of programs wouldnt generate interrupts when u test it on a simulator...
 

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
 
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:|
 

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

Back
Top