Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Interrupt not working....

Status
Not open for further replies.
:p :p I changed back to 12MHz xtal again...

I'm not quite clear about the "endless loop" example...

But isit i have to add some code to start / stop the timer?
Because i use the timer to calculate the number of overflows and the last value in TH and TL...
 
S.K said:
:p :p I changed back to 12MHz xtal again...
Just to be sure, complement an used port pin in the timer 0 or 2 (what is it finally?:p?) and put a scoop on that pin, you should see a square wave with 10ms ton/toff assuming code
Code:
TIMER_2 EQU 65535 - 10000
is still in your code.


S.K said:
I'm not quite clear about the "endless loop" example...

But isit i have to add some code to start / stop the timer?
Because i use the timer to calculate the number of overflows and the last value in TH and TL...
You can go on with your "WAIT" loop (for now :))but remember it's not good practice to hold on the µC in a loop.


With the seven steps I suggested on 1st August 2007, 07:55 AM it should work.
Review your code according to this steps, remove all dubious Timer 0/2 stuff and post a new version.
Good luck...
 
Ok.... But I have to clarify something...

not good practice to hold on the µC in a loop

Does this means since the program loops after it display, i should not wait until the 4th pulse than display? Instead i should let it display all the while than when its 4th pulse, i display the calculated value...
 
Yep, something like that :eek:

I took a closer look at your code to find an endless loop but I can't find any :(
Starting from "Main" you do 4 calls
Last call to "Wait" to wait for four pulses then things go wrong :(

Your "Loop" code is even wrong since:
1) There is no jump to "Loop"
2) You jump to "Clear_LCD" should be a Call because I don't know what happen on the "ret" at the end of the "Clear_LCD" routine. There is nothing to return to.


You absolutely need more structure in your code :p:D:p:D
Check the attached file.
I think it has a good structure for your application.
Just add all the code specific for your µC at the start (Part 1).
And all the code at the end (Parts 5 to 8) to calculate and display things.

The µC continously executes Part 2 and jumps to specific code according to some bits set by the ISR's.

Don't know if the reload thing is needed at the start ot the timer ISR, depend on timer used and µC: check the datasheet.

Don't know if your assembler will accept all these things mine does :p:eek:
Try to understand the principle, the structure, the idea, ... and translate it for your assembler.

Use the "segment", "ds" , "dbit" , ... directives to reserve some space, your assembler / relocater / linker (call it like you want) will allocate specific addresses to them.
Never do what someone else can do four you :D
 

Attachments

  • HeartBeat.txt
    5 KB · Views: 154
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top