CIS441 Controller

Dependencies:   TextLCD mbed-rtos mbed

Fork of PacemakerController by Chad Nachiappan

Committer:
chadnach1
Date:
Tue Nov 24 23:19:34 2015 +0000
Revision:
1:979e9e785549
Pacemaker and Heart

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chadnach1 1:979e9e785549 1 #include "mbed.h"
chadnach1 1:979e9e785549 2
chadnach1 1:979e9e785549 3 // This represents the heart
chadnach1 1:979e9e785549 4 DigitalOut myled(LED1);
chadnach1 1:979e9e785549 5 int p_clock;
chadnach1 1:979e9e785549 6
chadnach1 1:979e9e785549 7
chadnach1 1:979e9e785549 8
chadnach1 1:979e9e785549 9 void timer0_init(void)
chadnach1 1:979e9e785549 10 {
chadnach1 1:979e9e785549 11 LPC_SC->PCONP |=1<1; //timer0 power on
chadnach1 1:979e9e785549 12 LPC_TIM0->MR0 = 239800; //10 msec
chadnach1 1:979e9e785549 13 LPC_TIM0->MCR = 3; //interrupt and reset control
chadnach1 1:979e9e785549 14 //3 = Interrupt & reset timer0 on match
chadnach1 1:979e9e785549 15 //1 = Interrupt only, no reset of timer0
chadnach1 1:979e9e785549 16 NVIC_EnableIRQ(TIMER0_IRQn); //enable timer0 interrupt
chadnach1 1:979e9e785549 17 LPC_TIM0->TCR = 1; //enable Timer0
chadnach1 1:979e9e785549 18 }
chadnach1 1:979e9e785549 19
chadnach1 1:979e9e785549 20 int main() {
chadnach1 1:979e9e785549 21 while(1) {
chadnach1 1:979e9e785549 22 myled = 1;
chadnach1 1:979e9e785549 23 wait(0.2);
chadnach1 1:979e9e785549 24 myled = 0;
chadnach1 1:979e9e785549 25 wait(0.2);
chadnach1 1:979e9e785549 26 }
chadnach1 1:979e9e785549 27 }