manu jose
/
capture_register_test
Revision 0:820f75a424e8, committed 2010-12-01
- Comitter:
- manujose
- Date:
- Wed Dec 01 05:09:29 2010 +0000
- Commit message:
- c
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 820f75a424e8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 01 05:09:29 2010 +0000 @@ -0,0 +1,67 @@ +#include "mbed.h" + + +Serial pc(USBTX,USBRX); +DigitalOut myled(p19); +//InterruptIn ir(p29); + +extern "C" void Timer2_IRQHandler(void) { +pc.printf("hello %X", LPC_TIM2->CR0); +LPC_TIM2->IR = 0xff; + +} + + + +int main() { +//CONFIGURE PIN FOR CAP2:0 + + +LPC_SC-> PCONP |= (0x3 << 22); + +//LPC_SC->PCLKSEL1 |= (1 << 13) +LPC_TIM2->TCR = 0x2; + + +LPC_PINCON->PINSEL0 |= (0xf << 8); + + //LPC_TIM2->CCR |= (1 << 4); + LPC_TIM2->CCR = 0x07; +LPC_PINCON->PINMODE0 |= (0x0A << 8); + + pc.printf(" pconp"); + // Reset and set to timer mode + //LPC_TIM2->CTCR = 0x0; + //LPC_TIM2->PR = 0; // No prescale + //LPC_TIM2->MR0 = 0xF0537000 ; // Match count for 100mS + //LPC_TIM2->MCR = 3; // Interrupt, Stop, and Reset on match + + + LPC_TIM2->TCR = 1; // Enable Timer0 + + // Enable the ISR vector + NVIC_SetVector (TIMER2_IRQn, (uint32_t)&Timer2_IRQHandler); + NVIC_EnableIRQ(TIMER2_IRQn); + + pc.printf("timers set"); + + while(1) { + // myled = 1; + // ir.mode(PullUp); + + //wait(1); + //pc.printf("b4 Reset = %X ",LPC_TIM2->TC); + // ir.mode(PullDown); + myled = 0; + wait(1); + + //LPC_TIM2->TC = LPC_TIM2->TC ; ; + + // ir.mode(PullUp); + +//pc.printf("\n %X",LPC_TIM2->TC); + myled = 1; + //pc.printf("After Reset = %X ",LPC_TIM2->TC); + + } +}
diff -r 000000000000 -r 820f75a424e8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Dec 01 05:09:29 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e