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

8051 timer and external interrupts in c

Status
Not open for further replies.

MichaelBridge12

Newbie level 1
Joined
Dec 6, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
I want to know how I can use an external interrupt to control a timer interrupt. I am using keil as my compiler and programming in c. Let's say I want to produce a square wave in the timer interrupt and then every time my external interrupt is active I want to turn off/turn on the square wave. I pretty much just want to know how I can use the external interrupt to control my timer interrupt or would I just complement the square wave in the external interrupt anytime the external interrupt is activated? Any advice on how to go about doing this would be great. Thanks!
 
Last edited:

Joined
Dec 4, 2012
Messages
4,294
Helped
822
Reputation
1,654
Reaction score
793
Trophy points
1,393
Location
Bangalore, India
Activity points
0
When your MCU encounters an external interrupt start the timer which has been initialized previously. Make the timer to generate square wave for the required time and turn OFF. The process repeats with every external interrupt.
 

sequel

Member level 4
Joined
Oct 27, 2012
Messages
76
Helped
8
Reputation
16
Reaction score
7
Trophy points
1,288
Location
Nigeria
Activity points
1,753
When your MCU encounters an external interrupt start the timer which has been initialized previously. Make the timer to generate square wave for the required time and turn OFF. The process repeats with every external interrupt.

also when u startup the timer via the external interrupt,you also have to disable it else the system will hang in an endless loop of the external interrupt service routine
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top