Wait function that uses 16 Bit Timer 1 instead of using 32 bit Timer 0 to be used in conjunction with 'TextLCD16x4_Wait' and 'PulseWidthCapture' to measure the +ve and -ve Pulsewdth of a signal
Dependents: PulseWidthCapture_Program
Revision 2:46e8391685c4, committed 2014-12-11
- Comitter:
- Ellor1
- Date:
- Thu Dec 11 08:59:33 2014 +0000
- Parent:
- 1:57aba608a20d
- Commit message:
- Wait Library for TextLCD16x4;
Changed in this revision
LCD_Wait.cpp | Show annotated file Show diff for this revision Revisions of this file |
LCD_Wait.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/LCD_Wait.cpp Wed Dec 10 11:00:33 2014 +0000 +++ b/LCD_Wait.cpp Thu Dec 11 08:59:33 2014 +0000 @@ -1,9 +1,14 @@ +/*********************************************************************************************************************** +This library has been created to create a new wait function that uses the 16 bit Timer 1 rather that the traditional 32 Bit Timer 0. +This library is intended for use with the 'TextLCD_16x4' Library to get the lcd to work alongside the 'PulseWidthCapture' Program. + +Created by +Callum Ellor +**************************************************************************************************************************/ + #include "mbed.h" -//#include "TextLCD_16x4.h" #include "LCD_Wait.h" -//LCD_Wait *LCD_Wait::instance; - LCD_Wait::LCD_Wait(void) //LCD_Wait constructor { @@ -12,8 +17,7 @@ LPC_CT16B1->PR = 48000; // Set prescale value to give 1ms clock. } - - + void LCD_Wait::Wait(float num_wait) { // wait function LPC_CT16B1->TC = 0; //set Timer Counter register to 0
--- a/LCD_Wait.h Wed Dec 10 11:00:33 2014 +0000 +++ b/LCD_Wait.h Thu Dec 11 08:59:33 2014 +0000 @@ -3,33 +3,35 @@ #include "mbed.h" - class LCD_Wait { public: LCD_Wait(void); void Wait(float num_wait); -private: - -//static void _Wait_ISR(void); -//void Wait_ISR(void); -//static LCD_Wait *instance; -//unsigned int wait_n; - /* Private Macros ------------------------------------------------------------- */ /* --------------------- BIT DEFINITIONS -------------------------------------- */ - +/*********************************************************************//** + * Macro defines for CT16B1->IR Interrupt tegister + **********************************************************************/ #define CT16B1_IR_MR0INT ((uint32_t)(1<<0)) +/*********************************************************************//** + * Macro defines for SYSCON->SYSAHBCLKDIV register bits LPC11U24 page 30 + **********************************************************************/ #define CT16B1_CLK_ENABLE ((uint32_t)(1<<8)) +/*********************************************************************//** + * Macro defines for CT16B1->TCR register bits LPC11U24 page 335 + **********************************************************************/ #define CT16B1_TCR_CEN 1UL +/*********************************************************************//** + * Macro defines for CT16B1->MCR register bits LPC11U24 page 337 + **********************************************************************/ #define CT16B1_MR0I ((uint32_t)(1<<0)) - #define CT16B1_MR0R ((uint32_t)(1<<1))