PRESA Raphaël
/
FSK_EX
exemple gene carre
main.cpp@0:a882c1c6acaa, 2016-05-23 (annotated)
- Committer:
- rpresa
- Date:
- Mon May 23 06:16:46 2016 +0000
- Revision:
- 0:a882c1c6acaa
exemple gene carre
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rpresa | 0:a882c1c6acaa | 1 | #include "mbed.h" |
rpresa | 0:a882c1c6acaa | 2 | |
rpresa | 0:a882c1c6acaa | 3 | |
rpresa | 0:a882c1c6acaa | 4 | DigitalOut FSK(p20); |
rpresa | 0:a882c1c6acaa | 5 | |
rpresa | 0:a882c1c6acaa | 6 | |
rpresa | 0:a882c1c6acaa | 7 | void myIRQ() { |
rpresa | 0:a882c1c6acaa | 8 | LPC_TIM0->IR |= 1 << 0; |
rpresa | 0:a882c1c6acaa | 9 | FSK = !FSK; |
rpresa | 0:a882c1c6acaa | 10 | } |
rpresa | 0:a882c1c6acaa | 11 | |
rpresa | 0:a882c1c6acaa | 12 | |
rpresa | 0:a882c1c6acaa | 13 | int main() { |
rpresa | 0:a882c1c6acaa | 14 | |
rpresa | 0:a882c1c6acaa | 15 | |
rpresa | 0:a882c1c6acaa | 16 | |
rpresa | 0:a882c1c6acaa | 17 | while (1) { |
rpresa | 0:a882c1c6acaa | 18 | |
rpresa | 0:a882c1c6acaa | 19 | LPC_TIM0->MR0 = 104; // Match count for 114kHz |
rpresa | 0:a882c1c6acaa | 20 | LPC_TIM0->MCR = 3; // Interrupt and Reset on Match |
rpresa | 0:a882c1c6acaa | 21 | LPC_TIM0->TCR = 1; // Enable Timer0 |
rpresa | 0:a882c1c6acaa | 22 | NVIC_SetVector(TIMER0_IRQn,(uint32_t)&myIRQ); |
rpresa | 0:a882c1c6acaa | 23 | NVIC_EnableIRQ(TIMER0_IRQn); |
rpresa | 0:a882c1c6acaa | 24 | } |
rpresa | 0:a882c1c6acaa | 25 | |
rpresa | 0:a882c1c6acaa | 26 | } |