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.

How to code the timer to run for a certain amount of time ?

Status
Not open for further replies.

Aichibo

Newbie level 2
Joined
Aug 4, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
UK
Activity points
1,303
Hey all,

I'm kinda new to all this and I've been referencing Kernighan and Ritchie's book on C programming while looking through the various posts on this forum to try and work out how to complete my task.

So far I've managed to:

Get LEDs to turn on via pointers to the ports, run these functions off variables, get it to check via bitwise whether certain levels are higher than set values to how many LEDs it turns on (battery meter) and then got it to poll a switch value and turn on the LEDs when the switch is depressed.

However, now I am trying to get the processor to go to sleep and then every 100ms or so wake up and poll the switch port to see if it is depressed. This is due to the board I'm working on doesn't have an availiable socket to the ports which allow direct access to the interrupts. So I'm doing it via a timer which brings the CPU to normal operations and then running my previous code which made the LEDs glow when the switch is depressed.

Obviously this will not be as responsive as having it looping and polling the switch but as its going to be a battery powered device, I thought that this would be a good work around.

The problem is.. I have no idea how to code the timer to run for a certain amount of time then firing an interrupt to bring the processor out of sleep before running my code.

If you require the rest of my code, please ask.

TL;DR: Noob doesn't know how to code.

Thanks in advance!
 

Re: MSP430 and timers

Hi

For every MSP430 IC TI provide a C language example code all you have to do is to go to TI site and download the code

All the best

Bobi

The microcontroller specialist
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top