This program measures the +ve and -ve Pulsewidth of a signal using the capture inputs and 32 bit timers. This program has been designed to work with the RenBed using the LPC11U24
Dependencies: LCD_Wait PulseWidthCapture TextLCD_16x4_Wait USBDevice mbed
main.cpp@1:039945c19b7b, 2014-12-11 (annotated)
- Committer:
- Ellor1
- Date:
- Thu Dec 11 10:51:54 2014 +0000
- Revision:
- 1:039945c19b7b
- Parent:
- 0:d9a1b4b588ae
Program to measure the +ve and -ve Pulsewidth of a signal using the capture pins. This program is for use with the RenBed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ellor1 | 0:d9a1b4b588ae | 1 | #include "mbed.h" |
Ellor1 | 0:d9a1b4b588ae | 2 | #include "LCD_Wait.h" |
Ellor1 | 0:d9a1b4b588ae | 3 | #include "TextLCD_16x4.h" |
Ellor1 | 0:d9a1b4b588ae | 4 | #include "USBSerial.h" |
Ellor1 | 0:d9a1b4b588ae | 5 | #include "PulseWidthCapture.h" |
Ellor1 | 0:d9a1b4b588ae | 6 | |
Ellor1 | 0:d9a1b4b588ae | 7 | //USBSerial serial; |
Ellor1 | 0:d9a1b4b588ae | 8 | |
Ellor1 | 0:d9a1b4b588ae | 9 | LCD_Wait wa; |
Ellor1 | 0:d9a1b4b588ae | 10 | Capture c1; |
Ellor1 | 0:d9a1b4b588ae | 11 | |
Ellor1 | 0:d9a1b4b588ae | 12 | //TextLCD lcd(P0_21, P0_20, P1_15, P0_19, P0_5, P0_4, TextLCD::LCD16x4); // rs, e, d4, d5, d6, d7 |
Ellor1 | 0:d9a1b4b588ae | 13 | |
Ellor1 | 0:d9a1b4b588ae | 14 | //DigitalOut led3(P0_7); |
Ellor1 | 0:d9a1b4b588ae | 15 | |
Ellor1 | 0:d9a1b4b588ae | 16 | int main() { |
Ellor1 | 0:d9a1b4b588ae | 17 | |
Ellor1 | 0:d9a1b4b588ae | 18 | c1.Start_1(); |
Ellor1 | 0:d9a1b4b588ae | 19 | c1.Start_2(); |
Ellor1 | 0:d9a1b4b588ae | 20 | |
Ellor1 | 0:d9a1b4b588ae | 21 | while(1) { |
Ellor1 | 0:d9a1b4b588ae | 22 | |
Ellor1 | 0:d9a1b4b588ae | 23 | /* |
Ellor1 | 0:d9a1b4b588ae | 24 | led3 = 1; |
Ellor1 | 0:d9a1b4b588ae | 25 | wa.Wait(500); |
Ellor1 | 0:d9a1b4b588ae | 26 | led3 = 0; |
Ellor1 | 0:d9a1b4b588ae | 27 | wa.Wait(1000); |
Ellor1 | 0:d9a1b4b588ae | 28 | |
Ellor1 | 0:d9a1b4b588ae | 29 | lcd.cls(); |
Ellor1 | 0:d9a1b4b588ae | 30 | lcd.locate(0,0); |
Ellor1 | 0:d9a1b4b588ae | 31 | lcd.printf("hello"); |
Ellor1 | 0:d9a1b4b588ae | 32 | */ |
Ellor1 | 0:d9a1b4b588ae | 33 | |
Ellor1 | 0:d9a1b4b588ae | 34 | c1.Wait(); |
Ellor1 | 0:d9a1b4b588ae | 35 | |
Ellor1 | 0:d9a1b4b588ae | 36 | // serial.printf("hello"); |
Ellor1 | 0:d9a1b4b588ae | 37 | } |
Ellor1 | 0:d9a1b4b588ae | 38 | |
Ellor1 | 0:d9a1b4b588ae | 39 | } |