• Main Page
  • Modules
  • Files
  • File List
  • Globals

mTouchCVD_macroLibrary_PIC16F.h

Go to the documentation of this file.
00001 /*************************************************************************
00002  *  © 2011 Microchip Technology Inc.                                       
00003  *  
00004  *  Project Name:    mTouch CVD Framework
00005  *  FileName:        mTouchCVD_macroLibrary_PIC16F1.h
00006  *  Dependencies:    mTouchCVD.h
00007  *  Processor:       See documentation for supported PIC® microcontrollers 
00008  *  Compiler:        HI-TECH Ver. 9.81 or later
00009  *  IDE:             MPLAB® IDE v8.50 (or later) or MPLAB® X                        
00010  *  Hardware:         
00011  *  Company:         
00012  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00013  *  Description:     mTouch CVD Framework Hardware Profile Header File
00014  *                   - Editting this file will make customer support for
00015  *                     your application extremely difficult. Be careful,
00016  *                     as it can also have a negative impact on your
00017  *                     system's noise susceptibility.
00018  *************************************************************************/
00019  /***********************************************************************
00020  * MICROCHIP SOFTWARE NOTICE AND DISCLAIMER: You may use this software, and 
00021  * any derivatives created by any person or entity by or on your behalf, 
00022  * exclusively with Microchip's products in accordance with applicable
00023  * software license terms and conditions, a copy of which is provided for
00024  * your referencein accompanying documentation. Microchip and its licensors 
00025  * retain all ownership and intellectual property rights in the 
00026  * accompanying software and in all derivatives hereto. 
00027  * 
00028  * This software and any accompanying information is for suggestion only. 
00029  * It does not modify Microchip's standard warranty for its products. You 
00030  * agree that you are solely responsible for testing the software and 
00031  * determining its suitability. Microchip has no obligation to modify, 
00032  * test, certify, or support the software. 
00033  * 
00034  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER 
00035  * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED 
00036  * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A 
00037  * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE, ITS INTERACTION WITH 
00038  * MICROCHIP'S PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY 
00039  * APPLICATION. 
00040  * 
00041  * IN NO EVENT, WILL MICROCHIP BE LIABLE, WHETHER IN CONTRACT, WARRANTY, 
00042  * TORT (INCLUDING NEGLIGENCE OR BREACH OF STATUTORY DUTY), STRICT 
00043  * LIABILITY, INDEMNITY, CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, 
00044  * SPECIAL, PUNITIVE, EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, 
00045  * FOR COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, 
00046  * HOWSOEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY 
00047  * OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWABLE BY LAW, 
00048  * MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS 
00049  * SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID 
00050  * DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. 
00051  * 
00052  * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF 
00053  * THESE TERMS. 
00054  *************************************************************************/
00063 #ifndef __MTOUCHCVD_MACROLIBRARY_H
00064 #define __MTOUCHCVD_MACROLIBRARY_H
00065 
00073 #define MASKBANK(var,bank)        ((var)^((bank)*80h))
00074 #define   NOBANK(var)             (var & 0x7F)
00075 
00076 
00077 // Store current state for:
00078 //  * Working register
00079 //  * STATUS register
00080 //  * PCLATH register
00081 //  * FSR register
00082 #define SAVE_STATE()                \
00083 do {                                \
00084     asm("movwf  _int_w");           \
00085     asm("swapf  _int_w, F");        \
00086     asm("movf   _STATUS, W");       \
00087     asm("clrf   _STATUS");          \
00088     asm("movwf  _int_status");      \
00089     asm("movf   _PCLATH, W");       \
00090     asm("clrf   _PCLATH");          \
00091     asm("movwf  _int_pclath");      \
00092     asm("movf   _FSR, W");          \
00093     asm("movwf  _int_fsr");         \
00094 } while (0)
00095 
00096 // Restore current state for:
00097 //  * Working register
00098 //  * STATUS register
00099 //  * PCLATH register
00100 //  * FSR register
00101 #define RESTORE_STATE()             \
00102 do {                                \
00103     asm("movf   _int_fsr,W");       \
00104     asm("movwf  _FSR");             \
00105     asm("movf   _int_pclath,W");    \
00106     asm("movwf  _PCLATH");          \
00107     asm("movf   _int_status,W");    \
00108     asm("movwf  _STATUS");          \
00109     asm("swapf  _int_w, W");        \
00110 } while (0)
00111 
00112 
00113 
00126 #define CHECK_AND_CLEAR_TMR0IF()                                                            \
00127 do {                                                                                        \
00128     if (TMR0IF == 0)                                                                        \
00129     {                              /* T0IF is not set so,                               */  \
00130         asm("ljmp END_ISR");       /* exit the mTouch ISR                               */  \
00131     } else {                       /* T0IF is set, so                                   */  \
00132         TMR0IF = 0;                /* clear it and continue with mTouch ISR service     */  \
00133     }                                                                                       \
00134 } while (0)
00135 
00153 #if defined(CVD_JITTER_ENABLE)                              // If jittering is enabled
00154     #if (CVD_JITTER_TYPE == 0)                              // Type 0: Using ADRESL as the random seed value
00155         #define JITTER_START_TIME()                                                                                         \
00156             do {                                                                                                            \
00157                 asm("BANKSEL    _ADRESL"                        );  /* Make sure we're starting in the correct bank     */  \
00158                 asm("movf   "   ___mkstr(NOBANK(_ADRESL))   ",W");  /* Load ADRESL into the working register            */  \
00159                 asm("andlw      0x3F"                           );  /* Mask its value to look at only the 5 LSb's       */  \
00160                 asm("BANKSEL    _TMR0"                          );  /* Move to Bank 0 to access TMR0 SFR                */  \
00161                 asm("addwf      _TMR0"                          );  /* Add the masked ADRESL value as an offset to TMR0 */  \
00162             } while (0)
00163     #elif (CVD_JITTER_TYPE == 1)                            // Type 1: Using a linear feedback shift register to generate a random value
00164         #define JITTER_START_TIME()                                                                                         \
00165             do {                                                                                                            \
00166                 asm("BANKSEL    _mTouchCVD_jitter"              );  /* Make sure we're starting in the correct bank     */  \
00167                 asm("bcf    "   ___mkstr(_STATUS)           ",0");  /* Clear the carry bit                              */  \
00168                 asm("rrf    "   ___mkstr(_mTouchCVD_jitter) ",W");  /* Right shift the current jitter seed value        */  \
00169                 asm("btfsc  "   ___mkstr(_STATUS)           ",0");  /* Check the carry bit - if set, perform XOR        */  \
00170                 asm("xorlw      0xB4"                           );  /* (cond) XOR the jitter seed with 0xB4             */  \
00171                 asm("movwf  "   ___mkstr(_mTouchCVD_jitter)     );  /* Store the result as the new jitter seed value    */  \
00172                 asm("andlw      0x3F"                           );  /* Grab the 5 LSb's from the seed value             */  \
00173                 asm("BANKSEL    _TMR0"                          );  /* Move to Bank 0 to access TMR0 SFR                */  \
00174                 asm("addwf      _TMR0"                          );  /* Add the masked LFSR value as an offset to TMR0   */  \
00175             } while (0)
00176     #endif
00177 #else                                                       // Do not implement the jittering function
00178     #define JITTER_START_TIME()                                                     \
00179         do {                                                                        \
00180             asm("BANKSEL    _TMR0");    /* Move to Bank 0 to access TMR0 SFR    */  \
00181             asm("clrf       _TMR0");    /* Clear TMR0                           */  \
00182         } while (0)
00183 #endif
00184 
00191 #define WAIT_FOR_GODONE_BIT()               while (GO_nDONE);
00192 
00205 #define STORE_LAST_RESULT()                                                     \
00206 do {                                                                            \
00207     last_result = (unsigned int)((ADRESH | 0x04) << 8) + ADRESL - last_result;  \
00208 } while (0)
00209 
00210 
00232 #define READ_SENSOR(indexSensor, indexRef)  READ_SENSOR_EXPANDED(__paste(CVD_SELECT_SENSOR,indexSensor),__paste(CVD_SELECT_SENSOR,indexRef),__paste(CVD_PORT_SENSOR,indexSensor),__paste(CVD_PIN_SENSOR,indexSensor),__paste(CVD_PORT_SENSOR,indexRef),__paste(CVD_PIN_SENSOR,indexRef))
00233 
00234 // Example Dedicated-Reference-Sensor Implementation:
00235 // #define READ_SENSOR(indexSensor, indexRef)  READ_SENSOR_EXPANDED(__paste(CVD_SELECT_SENSOR,indexSensor),CVD_SELECT_REFERENCE,__paste(CVD_PORT_SENSOR,indexSensor),__paste(CVD_PIN_SENSOR,indexSensor),CVD_PORT_REFERENCE,CVD_PIN_REFERENCE)
00236 
00309 #if CVD_NUMBER_SENSORS == 1
00310 #define READ_SENSOR_EXPANDED(current_channel, ref_channel, port, pin, ref_port, ref_pin)                                                            \
00311 do {                                                                    /*                   SINGLE SENSOR SCAN METHOD                      */  \
00312     asm("BANKSEL    "   ___mkstr(_VRCON)                            );  /*                                                                  */  \
00313     asm("movlw      "   ___mkstr(CVD_VRCON_MAX)                     );  /*                                                                  */  \
00314     asm("movwf      "   ___mkstr(NOBANK(_VRCON))                    );  /* VRCON = CVD_VRCON_MAX (75% of VDD)                               */  \
00315     asm("BANKSEL    "   ___mkstr(_ADCON0)                           );  /*                                                                  */  \
00316     asm("movlw      "   ___mkstr(CVD_SELECT_CVREF_NOGO)             );  /*                                                                  */  \
00317     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                   );  /* ADC Mux --> CVref                                                */  \
00318     asm("movlw      "   ___mkstr(port)                              );  /*                                                                  */  \
00319     asm("addlw          0x80"                                       );  /*                                                                  */  \
00320     asm("movwf      "   ___mkstr(_FSR)                              );  /* FSR = Sensor TRIS ( Address of port + 0x80 )                     */  \
00321     CVD_DELAY_CHOLD();                                                  /*                                                                  */  \
00322     asm("BANKSEL    "   ___mkstr(_ADCON0)                           );  /*                                                                  */  \
00323     asm("movlw      "   ___mkstr(current_channel)                   );  /* Load the sensor's ADCON0 value (do not set GO/DONE)              */  \
00324     asm("bsf        "   ___mkstr(_INDF)  ","      ___mkstr(pin)     );  /* Set the sensor to an input                                       */  \
00325     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                   );  /* ADC Mux --> Sensor                                               */  \
00326     CVD_DELAY_SETTLE();                                                 /*                                                                  */  \
00327     asm("BANKSEL    "   ___mkstr(_ADCON0)                           );  /*                                                                  */  \
00328     asm("bsf        "   ___mkstr(NOBANK(_ADCON0))          ",1"     );  /* Begin the conversion by setting the GO/DONE bit                  */  \
00329     CVD_GO_DONE_DELAY();                                                /*                                                                  */  \
00330     asm("bcf        "   ___mkstr(_INDF)  ","      ___mkstr(pin)     );  /* Set the sensor to an output                                      */  \
00331     asm("BANKSEL    "   ___mkstr(port)                              );  /*                                                                  */  \
00332     asm("bsf        "   ___mkstr(port)   ","      ___mkstr(pin)     );  /* Set the sensor to output high in preparation for next scan       */  \
00333     asm("global         decimate         "                          );  /*                                                                  */  \
00334     asm("call           decimate         "                          );  /* Perform math on the previous scan while conversion completes     */  \
00335     asm("BANKSEL    "   ___mkstr(_VRCON)                            );  /*                                                                  */  \
00336     asm("movlw      "   ___mkstr(CVD_VRCON_MIN)                     );  /*                                                                  */  \
00337     asm("movwf      "   ___mkstr(NOBANK(_VRCON))                    );  /* VRCON = CVD_VRCON_MIN (VSS)                                      */  \
00338     asm("BANKSEL    "   ___mkstr(_ADCON0)                           );  /*                                                                  */  \
00339     asm("movlw      "   ___mkstr(CVD_SELECT_CVREF_NOGO)             );  /*                                                                  */  \
00340     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                   );  /* ADC Mux --> CVref                                                */  \
00341     asm("movlw      "   ___mkstr(port)                              );  /*                                                                  */  \
00342     asm("addlw          0x80"                                       );  /*                                                                  */  \
00343     asm("movwf      "   ___mkstr(_FSR)                              );  /* FSR = Sensor TRIS ( Address of port + 0x80 )                     */  \
00344     CVD_DELAY_CHOLD();                                                  /*                                                                  */  \
00345     asm("BANKSEL    "   ___mkstr(_ADCON0)                           );  /*                                                                  */  \
00346     asm("movlw      "   ___mkstr(current_channel)                   );  /* Load the sensor's ADCON0 value (do not set GO/DONE)              */  \
00347     asm("bsf        "   ___mkstr(_INDF)  ","      ___mkstr(pin)     );  /* Set the sensor to an input                                       */  \
00348     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                   );  /* Write the sensor's ADCON0 value to ADCON0                        */  \
00349     CVD_DELAY_SETTLE();                                                 /*                                                                  */  \
00350     asm("BANKSEL    "   ___mkstr(_ADCON0)                           );  /*                                                                  */  \
00351     asm("bsf        "   ___mkstr(NOBANK(_ADCON0))          ",1"     );  /* Begin the conversion by setting the GO/DONE bit                  */  \
00352     CVD_GO_DONE_DELAY();                                                /*                                                                  */  \
00353     asm("bcf        "   ___mkstr(_INDF)  ","      ___mkstr(pin)     );  /* Set the sensor to an output                                      */  \
00354     asm("BANKSEL    "   ___mkstr(port)                              );  /*                                                                  */  \
00355     asm("bcf        "   ___mkstr(port)   ","      ___mkstr(pin)     );  /* Set the sensor to output low now that the scan is complete       */  \
00356 } while(0)
00357 #else
00358 #define READ_SENSOR_EXPANDED(current_channel, ref_channel, port, pin, ref_port, ref_pin)                        \
00359 do {                                                                        /* REFERENCE SENSOR SCAN METHOD */  \
00360     asm("BANKSEL    "   ___mkstr(_ADCON0)                               );  /*                              */  \
00361     asm("movlw      "   ___mkstr(ref_channel)                           );  /*                              */  \
00362     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                       );  /* ADC Mux --> Previous Sensor  */  \
00363     asm("bsf        "   ___mkstr(ref_port)  ","    ___mkstr(ref_pin)    );  /* Output high on reference     */  \
00364     asm("movlw      "   ___mkstr(port)                                  );  /*                              */  \
00365     asm("addlw          0x80"                                           );  /*                              */  \
00366     asm("movwf      "   ___mkstr(_FSR)                                  );  /* FSR = Sensor TRIS            */  \
00367     CVD_DELAY_CHOLD();                                                      /*                              */  \
00368     asm("movlw      "   ___mkstr(current_channel)                       );  /*                              */  \
00369     asm("bsf        "   ___mkstr(_INDF)     ","    ___mkstr(pin)        );  /* Set sensor to input          */  \
00370     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                       );  /* ADC Mux --> Sensor           */  \
00371     CVD_DELAY_SETTLE();                                                     /*                              */  \
00372     asm("bsf        "   ___mkstr(NOBANK(_ADCON0))           ",1"        );  /* Set GO/DONE bit              */  \
00373     CVD_GO_DONE_DELAY();                                                    /*                              */  \
00374     asm("bsf        "   ___mkstr(port)      ","    ___mkstr(pin)        );  /* Set sensor port to high      */  \
00375     asm("bcf        "   ___mkstr(_INDF)     ","    ___mkstr(pin)        );  /* Set sensor tris to output    */  \
00376     asm("global         decimate"                                       );  /*                              */  \
00377     asm("call           decimate"                                       );  /* decimate();                  */  \
00378     asm("BANKSEL    "   ___mkstr(_ADCON0)                               );  /*                              */  \
00379     asm("movlw      "   ___mkstr(ref_channel)                           );  /* Set ADC Mux to Reference     */  \
00380     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                       );  /*                              */  \
00381     asm("bcf        "   ___mkstr(ref_port)  ","    ___mkstr(ref_pin)    );  /* Set LAT registers            */  \
00382     asm("movlw      "   ___mkstr(port)                                  );  /* "                            */  \
00383     asm("addlw          0x80"                                           );  /* " (PORT + 0x80 is TRIS)      */  \
00384     asm("movwf      "   ___mkstr(_FSR)                                  );  /* " FSR = TRIS                 */  \
00385     CVD_DELAY_CHOLD();                                                      /*                              */  \
00386     asm("movlw      "   ___mkstr(current_channel)                       );  /*                              */  \
00387     asm("bsf        "   ___mkstr(_INDF)     ","    ___mkstr(pin)        );  /* Set sensor to input          */  \
00388     asm("movwf      "   ___mkstr(NOBANK(_ADCON0))                       );  /* ADC Mux --> Sensor           */  \
00389     CVD_DELAY_SETTLE();                                                     /*                              */  \
00390     asm("bsf        "   ___mkstr(NOBANK(_ADCON0))           ",1"        );  /* Set GO/DONE bit              */  \
00391     CVD_GO_DONE_DELAY();                                                    /*                              */  \
00392     asm("bcf        "   ___mkstr(port)      ","    ___mkstr(pin)        );  /* Set sensor port to low       */  \
00393     asm("bcf        "   ___mkstr(_INDF)     ","    ___mkstr(pin)        );  /* Set sensor tris as output    */  \
00394 } while(0)
00395 #endif
00396 
00397 
00419 #if (CVD_NUMBER_SENSORS > 1)
00420 #define CVD_DECIMATE()                                                                                                                  \
00421 do {                                                                /*                                                              */  \
00422     asm("BANKSEL    _current_sensor");                              /* Use the current_sensor variable as an index                  */  \
00423     asm("bcf        _STATUS,0");                                    /*                                                              */  \
00424     asm("rlf    "   ___mkstr(NOBANK(_current_sensor)) ",W");        /* Shifting by two because int's take up 2 bytes each           */  \
00425     asm("addlw      _sensor_data");                                 /* Adding the index to the sensor_data variable address         */  \
00426     asm("movwf      _FSR");                                         /* Pointing the FSR to the correct array location               */  \
00427     asm("movf       _INDF,W");                                      /* Getting the value from the memory location                   */  \
00428     asm("subwf      _last_result,F");                               /* Subtract the stored value from the latest reading result     */  \
00429     asm("incf       _FSR,F");                                       /*                                                              */  \
00430     asm("movf       _INDF,W");                                      /*                                                              */  \
00431     asm("btfss      _STATUS, 0");                                                                                                       \
00432     asm("addlw      1");                                                                                                                \
00433     asm("subwf      _last_result+1,W");                             /* Same as above, now just handling the high byte               */  \
00434     asm("decf       _FSR,F");                                       /*                                                              */  \
00435     asm("btfss      _STATUS,0");                                    /* Check the result of the subtraction                          */  \
00436     asm("ljmp       sensor_smaller");                               /* If the latest reading was smaller, jump.                     */  \
00437     asm("iorwf      _last_result,W");                               /*                                                              */  \
00438     asm("btfss      _STATUS,2");                                    /* If the two are equal, load nothing.                          */  \
00439     asm("movlw      1");                                            /* Otherwise (latest reading is larger), load 1 into W          */  \
00440     asm("addwf      _INDF,F");                                      /* Add 1 (or nothing) to the stored value                       */  \
00441     asm("movf       _INDF,W");                                      /* Now take the stored value and load it into last_result       */  \
00442     asm("movwf      _last_result,F");                               /*   for easy access                                            */  \
00443     asm("incf       _FSR,F");                                       /* Point to the high byte of the stored value                   */  \
00444     asm("btfsc      _STATUS,0");                                    /* If we had an overflow from the addition,                     */  \
00445     asm("incf       _INDF,F");                                      /*   increment the higher byte                                  */  \
00446     asm("movf       _INDF,W");                                      /* Now take the high byte of the stored value and load it into  */  \
00447     asm("movwf      _last_result+1");                               /*   last_result for easy access.                               */  \
00448     asm("ljmp       decimate_end");                                 /* Jump (avoid 'smaller' case code)                             */  \
00449 } while (0)                                                 
00450 
00451 #define CVD_SENSOR_SMALLER()                                                                                                            \
00452 do {                                                                /*                                                              */  \
00453     asm("movlw      1");                                            /* Perform the exact same commands as above, but this time      */  \
00454     asm("subwf      _INDF,F");                                      /*   subtract instead of add. The stored value is then loaded   */  \
00455     asm("movf       _INDF,W");                                      /*   into last_result for easy access.                          */  \
00456     asm("movwf      _last_result");                                 /*                                                              */  \
00457     asm("incf       _FSR,F");                                       /*                                                              */  \
00458     asm("btfss      _STATUS,0");                                    /*                                                              */  \
00459     asm("decf       _INDF,F");                                      /*                                                              */  \
00460     asm("movf       _INDF,W");                                      /*                                                              */  \
00461     asm("movwf      _last_result+1");                               /*                                                              */  \
00462 } while (0)                                                 
00463 
00464 #define CVD_DECIMATE_END()                                                                                                              \
00465 do {                                                                /*                                                              */  \
00466     asm("bcf        _STATUS,0");                                    /*                                                              */  \
00467     asm("rlf        _current_sensor,W");                            /* Use the current_sensor variable as an index. Since the       */  \
00468     asm("addwf      _current_sensor,W");                            /*   CVD_Acq_Filtered_Data array is of 24-bit values, we        */  \
00469     asm("addlw      _CVD_Acq_Filtered_Data");                       /*   are multiplying the index by 3, then adding it to the      */  \
00470     asm("movwf      _FSR");                                         /*   address of the accumulator array.                          */  \
00471     asm("movf       _last_result,W");                               /* Take the value in last_result (aka sensor_data, now) and     */  \
00472     asm("addwf      _INDF,F");                                      /*   add it to the accumulator array.                           */  \
00473     asm("incf       _FSR,F");                                       /*                                                              */  \
00474     asm("movf       _last_result+1,W");                             /*                                                              */  \
00475     asm("btfsc      _STATUS,0");                                                                                                        \
00476     asm("incf       _INDF,F");                                                                                                          \
00477     asm("addwf      _INDF,F");                                      /* Add with carry handles possible overflow condition.          */  \
00478     asm("incf       _FSR,F");                                       /*                                                              */  \
00479     asm("btfsc      _STATUS,0");                                    /* Handle possible overflow condition one more time since this  */  \
00480     asm("incf       _INDF,F");                                      /*   is a 24-bit array.                                         */  \
00481     asm("BANKSEL    _ADCON0");                                      /*                                                              */  \
00482     asm("btfsc    " ___mkstr(NOBANK(_ADCON0)) ",1");                /* Has the ADC scan completed?                               */  \
00483     asm("goto       $-1");                                          /* If not, we're going to wait until it is.                     */  \
00484     asm("movf     " ___mkstr(NOBANK(_ADRESH)) ",W");                /* Grab the result and offset it by 1024. This makes sure we    */  \
00485     asm("BANKSEL    _last_result");                                 /*   subtract another ADC result from this one.                 */  \
00486     asm("movwf      _last_result+1");                               /*                                                              */  \
00487     asm("BANKSEL    _ADRESL");                                      /* Finally, store the low byte as well.                         */  \
00488     asm("movf     " ___mkstr(NOBANK(_ADRESL)) ",W");                /*                                                              */  \
00489     asm("BANKSEL    _last_result");                                 /*                                                              */  \
00490     asm("movwf      _last_result");                                 /*                                                              */  \
00491     asm("return");                                                  /* Finished! Now go start the next ADC scan in READ_SENSOR().   */  \
00492 } while(0)
00493     
00494 #else                                           // Only one sensor, so no index variable manipulation is required
00495                                                 // Otherwise, code below mirrors code above.
00496     #define CVD_DECIMATE()                                      \
00497         do {                                                    \
00498             if (last_result > sensor_data[0]) {                 \
00499                 sensor_data[0]++;                               \
00500             } else {                                            \
00501                 sensor_data[0]--;                               \
00502             }                                                   \
00503             CVD_Acq_Filtered_Data[0] += sensor_data[0];         \
00504             WAIT_FOR_GODONE_BIT();                              \
00505             last_result = (unsigned int)(ADRESH << 8) + ADRESL; \
00506             asm("return");                                      \
00507         } while(0)
00508     #define CVD_SENSOR_SMALLER()
00509     #define CVD_DECIMATE_END()
00510 #endif
00511 
00512 
00518 
00526 #define STORE_SENSOR_SCALE(index, shift)                                                \
00527     do {                                                                                \
00528         CVDSensorData[index-1] = (unsigned int)(CVD_Acq_Filtered_Data[index] >> shift); \
00529         CVD_Acq_Filtered_Data[index] = 0;                                               \
00530     } while(0)
00531 
00538 #define STORE_LAST_SENSOR_SCALE(index, shift)                                                           \
00539     do {                                                                                                \
00540         CVDSensorData[CVD_NUMBER_SENSORS-1] = (unsigned int)(CVD_Acq_Filtered_Data[index] >> shift);    \
00541         CVD_Acq_Filtered_Data[index] = 0;                                                               \
00542     } while(0)
00543 
00550 #define STORE_SINGLE_SENSOR_SCALE(index, shift)                                 \
00551     do {                                                                        \
00552         CVDSensorData[0] = (unsigned int)(CVD_Acq_Filtered_Data[0] >> shift);   \
00553         CVD_Acq_Filtered_Data[0] = 0;                                           \
00554     } while(0)
00555 
00565 #if (CVD_NUMBER_SENSORS > 1)
00566     #if (CVD_SCALING == 1)
00567         #define STORE_SENSOR(index)         STORE_SENSOR_SCALE(index, 0) 
00568         #define STORE_LAST_SENSOR(index)    STORE_LAST_SENSOR_SCALE(index, 0) 
00569     #elif (CVD_SCALING == 16)
00570         #define STORE_SENSOR(index)         STORE_SENSOR_SCALE(index, 4) 
00571         #define STORE_LAST_SENSOR(index)    STORE_LAST_SENSOR_SCALE(index, 4) 
00572     #elif (CVD_SCALING == 256)
00573         #define STORE_SENSOR(index)         STORE_SENSOR_SCALE(index, 8) 
00574         #define STORE_LAST_SENSOR(index)    STORE_LAST_SENSOR_SCALE(index, 8) 
00575     #else
00576         #warning CVD_SCALING set to an invalid value. Defaulting to 16:1 scaling.
00577         #define STORE_SENSOR(index)         STORE_SENSOR_SCALE(index, 4) 
00578         #define STORE_LAST_SENSOR(index)    STORE_LAST_SENSOR_SCALE(index, 4)
00579     #endif
00580 #else
00581     #if (CVD_SCALING == 1)
00582         #define STORE_SENSOR(index)         STORE_SINGLE_SENSOR_SCALE(index, 0) 
00583     #elif (CVD_SCALING == 16)
00584         #define STORE_SENSOR(index)         STORE_SINGLE_SENSOR_SCALE(index, 4) 
00585     #elif (CVD_SCALING == 256)
00586         #define STORE_SENSOR(index)         STORE_SINGLE_SENSOR_SCALE(index, 8) 
00587     #else
00588         #warning CVD_SCALING set to an invalid value. Defaulting to 16:1 scaling.
00589         #define STORE_SENSOR(index)         STORE_SENSOR_SCALE(index, 4) 
00590     #endif
00591 #endif
00592 
00599 #define EXIT_SENSOR(index)                                                                          \
00600 do {                                                                                                \
00601     index++;                                                                                        \
00602     asm("ljmp END_ISR");                            /* Exit the ISR                             */  \
00603 } while(0)
00604 
00628 #if (CVD_NUMBER_SENSORS > 1)
00629     #define EXIT_LAST_SENSOR(index)     EXIT_LAST_SENSOR_DECINDEX(index); EXIT_LAST_SENSOR_MAIN()       // First resets the index, then updates the sample counter
00630 #else
00631     #define EXIT_LAST_SENSOR(index)     EXIT_LAST_SENSOR_MAIN()                                         // Only one sensor, so only updates the sample counter
00632 #endif
00633 
00634 #define EXIT_LAST_SENSOR_MAIN()                                                                                                 \
00635 do {                                                                                                                            \
00636     if (--sample_counter != 0)                            /* Decrement the sample counter and check if it's equal to 0      */  \
00637         asm("ljmp END_ISR");                              /* If not equal to 0, exit the ISR                                */  \
00638     sample_counter = CVD_SAMPLES_PER_SCAN;                /* If equal to 0, reset the sample counter continue with storage  */  \
00639 } while(0)
00640     
00641 #define EXIT_LAST_SENSOR_DECINDEX(index)                                                                    \
00642 do {                                                                                                        \
00643     index = 0;                                                                                              \
00644 } while(0)
00645 
00652 #define SET_DATA_READY_FLAG()                                       \
00653 do {                                                                \
00654     mTouchCVD_dataReady = 1;                                        \
00655 } while(0)
00656 
00657 
00658 
00674 #if (CVD_NUMBER_SENSORS == 1)
00675 
00676     #define GENERATE_JUMP_TABLE()       \
00677         do {                            \
00678             asm("global   sensor_0");   \
00679             asm("ljmp     sensor_0");   \
00680         } while (0)
00681      
00682     #define GENERATE_STORAGE_FUNCTION()         STORE_SENSOR(0);   
00683     
00684 #else
00685 
00686     #define CVD_ASM_JUMP_LABEL_1()      case 1:     asm("ljmp sensor_1");
00687     #define CVD_ASM_JUMP_LABEL_2()      case 2:     asm("ljmp sensor_2");
00688     #define CVD_ASM_JUMP_LABEL_3()      case 3:     asm("ljmp sensor_3");
00689     #define CVD_ASM_JUMP_LABEL_4()      case 4:     asm("ljmp sensor_4");
00690     #define CVD_ASM_JUMP_LABEL_5()      case 5:     asm("ljmp sensor_5");
00691     #define CVD_ASM_JUMP_LABEL_6()      case 6:     asm("ljmp sensor_6");
00692     #define CVD_ASM_JUMP_LABEL_7()      case 7:     asm("ljmp sensor_7");
00693     #define CVD_ASM_JUMP_LABEL_8()      case 8:     asm("ljmp sensor_8");
00694     #define CVD_ASM_JUMP_LABEL_9()      case 9:     asm("ljmp sensor_9");
00695     #define CVD_ASM_JUMP_LABEL_10()     case 10:    asm("ljmp sensor_10");
00696     #define CVD_ASM_JUMP_LABEL_11()     case 11:    asm("ljmp sensor_11");
00697     #define CVD_ASM_JUMP_LABEL_12()     case 12:    asm("ljmp sensor_12");
00698     #define CVD_ASM_JUMP_LABEL_13()     case 13:    asm("ljmp sensor_13");
00699     #define CVD_ASM_JUMP_LABEL_14()     case 14:    asm("ljmp sensor_14");
00700     #define CVD_ASM_JUMP_LABEL_15()     case 15:    asm("ljmp sensor_15");
00701     #define CVD_ASM_JUMP_LABEL_16()     case 16:    asm("ljmp sensor_16");
00702     #define CVD_ASM_JUMP_LABEL_17()     case 17:    asm("ljmp sensor_17");
00703     #define CVD_ASM_JUMP_LABEL_18()     case 18:    asm("ljmp sensor_18");
00704     #define CVD_ASM_JUMP_LABEL_19()     case 19:    asm("ljmp sensor_19");
00705     #define CVD_ASM_JUMP_LABEL_20()     case 20:    asm("ljmp sensor_20");
00706     #define CVD_ASM_JUMP_LABEL_21()     case 21:    asm("ljmp sensor_21");
00707     #define CVD_ASM_JUMP_LABEL_22()     case 22:    asm("ljmp sensor_22");
00708     #define CVD_ASM_JUMP_LABEL_23()     case 23:    asm("ljmp sensor_23");
00709     #define CVD_ASM_JUMP_LABEL_24()     case 24:    asm("ljmp sensor_24");
00710     #define CVD_ASM_JUMP_LABEL_25()     case 25:    asm("ljmp sensor_25");
00711     #define CVD_ASM_JUMP_LABEL_26()     case 26:    asm("ljmp sensor_26");
00712     #define CVD_ASM_JUMP_LABEL_27()     case 27:    asm("ljmp sensor_27");
00713     #define CVD_ASM_JUMP_LABEL_28()     case 28:    asm("ljmp sensor_28");
00714     #define CVD_ASM_JUMP_LABEL_29()     case 29:    asm("ljmp sensor_29");
00715 
00716     #define CVD_STORE_LABEL_0()         STORE_LAST_SENSOR(0);
00717     #define CVD_STORE_LABEL_1()         STORE_SENSOR(1);
00718     #define CVD_STORE_LABEL_2()         STORE_SENSOR(2);
00719     #define CVD_STORE_LABEL_3()         STORE_SENSOR(3);
00720     #define CVD_STORE_LABEL_4()         STORE_SENSOR(4);
00721     #define CVD_STORE_LABEL_5()         STORE_SENSOR(5);
00722     #define CVD_STORE_LABEL_6()         STORE_SENSOR(6);
00723     #define CVD_STORE_LABEL_7()         STORE_SENSOR(7);
00724     #define CVD_STORE_LABEL_8()         STORE_SENSOR(8);
00725     #define CVD_STORE_LABEL_9()         STORE_SENSOR(9);
00726     #define CVD_STORE_LABEL_10()        STORE_SENSOR(10);
00727     #define CVD_STORE_LABEL_11()        STORE_SENSOR(11);
00728     #define CVD_STORE_LABEL_12()        STORE_SENSOR(12);
00729     #define CVD_STORE_LABEL_13()        STORE_SENSOR(13);
00730     #define CVD_STORE_LABEL_14()        STORE_SENSOR(14);
00731     #define CVD_STORE_LABEL_15()        STORE_SENSOR(15);
00732     #define CVD_STORE_LABEL_16()        STORE_SENSOR(16);
00733     #define CVD_STORE_LABEL_17()        STORE_SENSOR(17);
00734     #define CVD_STORE_LABEL_18()        STORE_SENSOR(18);
00735     #define CVD_STORE_LABEL_19()        STORE_SENSOR(19);
00736     #define CVD_STORE_LABEL_20()        STORE_SENSOR(20);
00737     #define CVD_STORE_LABEL_21()        STORE_SENSOR(21);
00738     #define CVD_STORE_LABEL_22()        STORE_SENSOR(22);
00739     #define CVD_STORE_LABEL_23()        STORE_SENSOR(23);
00740     #define CVD_STORE_LABEL_24()        STORE_SENSOR(24);
00741     #define CVD_STORE_LABEL_25()        STORE_SENSOR(25);
00742     #define CVD_STORE_LABEL_26()        STORE_SENSOR(26);
00743     #define CVD_STORE_LABEL_27()        STORE_SENSOR(27);
00744     #define CVD_STORE_LABEL_28()        STORE_SENSOR(28);
00745     #define CVD_STORE_LABEL_29()        STORE_SENSOR(29);
00746 
00747     #if (CVD_NUMBER_SENSORS > 30)
00748         #error This version of the framework macro library unable to support more than 30 sensors at this time.
00749     #endif
00750     
00751     #if CVD_NUMBER_SENSORS < 30
00752         #undef  CVD_ASM_JUMP_LABEL_29()
00753         #define CVD_ASM_JUMP_LABEL_29()
00754         #undef  CVD_STORE_LABEL_29()
00755         #define CVD_STORE_LABEL_29()
00756     #endif
00757     #if CVD_NUMBER_SENSORS < 29
00758         #undef  CVD_ASM_JUMP_LABEL_28()
00759         #define CVD_ASM_JUMP_LABEL_28()
00760         #undef  CVD_STORE_LABEL_28()
00761         #define CVD_STORE_LABEL_28()
00762     #endif
00763     #if CVD_NUMBER_SENSORS < 28
00764         #undef  CVD_ASM_JUMP_LABEL_27()
00765         #define CVD_ASM_JUMP_LABEL_27()
00766         #undef  CVD_STORE_LABEL_27()
00767         #define CVD_STORE_LABEL_27()
00768     #endif
00769     #if CVD_NUMBER_SENSORS < 27
00770         #undef  CVD_ASM_JUMP_LABEL_26()
00771         #define CVD_ASM_JUMP_LABEL_26()
00772         #undef  CVD_STORE_LABEL_26()
00773         #define CVD_STORE_LABEL_26()
00774     #endif
00775     #if CVD_NUMBER_SENSORS < 26
00776         #undef  CVD_ASM_JUMP_LABEL_25()
00777         #define CVD_ASM_JUMP_LABEL_25()
00778         #undef  CVD_STORE_LABEL_25()
00779         #define CVD_STORE_LABEL_25()
00780     #endif
00781     #if CVD_NUMBER_SENSORS < 25
00782         #undef  CVD_ASM_JUMP_LABEL_24()
00783         #define CVD_ASM_JUMP_LABEL_24()
00784         #undef  CVD_STORE_LABEL_24()
00785         #define CVD_STORE_LABEL_24()
00786     #endif
00787     #if CVD_NUMBER_SENSORS < 24
00788         #undef  CVD_ASM_JUMP_LABEL_23()
00789         #define CVD_ASM_JUMP_LABEL_23()
00790         #undef  CVD_STORE_LABEL_23()
00791         #define CVD_STORE_LABEL_23()
00792     #endif
00793     #if CVD_NUMBER_SENSORS < 23
00794         #undef  CVD_ASM_JUMP_LABEL_22()
00795         #define CVD_ASM_JUMP_LABEL_22()
00796         #undef  CVD_STORE_LABEL_22()
00797         #define CVD_STORE_LABEL_22()
00798     #endif
00799     #if CVD_NUMBER_SENSORS < 22
00800         #undef  CVD_ASM_JUMP_LABEL_21()
00801         #define CVD_ASM_JUMP_LABEL_21()
00802         #undef  CVD_STORE_LABEL_21()
00803         #define CVD_STORE_LABEL_21()
00804     #endif
00805     #if CVD_NUMBER_SENSORS < 21
00806         #undef  CVD_ASM_JUMP_LABEL_20()
00807         #define CVD_ASM_JUMP_LABEL_20()
00808         #undef  CVD_STORE_LABEL_20()
00809         #define CVD_STORE_LABEL_20()
00810     #endif
00811     #if CVD_NUMBER_SENSORS < 20
00812         #undef  CVD_ASM_JUMP_LABEL_19()
00813         #define CVD_ASM_JUMP_LABEL_19()
00814         #undef  CVD_STORE_LABEL_19()
00815         #define CVD_STORE_LABEL_19()
00816     #endif
00817     #if CVD_NUMBER_SENSORS < 19
00818         #undef  CVD_ASM_JUMP_LABEL_18()
00819         #define CVD_ASM_JUMP_LABEL_18()
00820         #undef  CVD_STORE_LABEL_18()
00821         #define CVD_STORE_LABEL_18()
00822     #endif
00823     #if CVD_NUMBER_SENSORS < 18
00824         #undef  CVD_ASM_JUMP_LABEL_17()
00825         #define CVD_ASM_JUMP_LABEL_17()
00826         #undef  CVD_STORE_LABEL_17()
00827         #define CVD_STORE_LABEL_17()
00828     #endif
00829     #if CVD_NUMBER_SENSORS < 17
00830         #undef  CVD_ASM_JUMP_LABEL_16()
00831         #define CVD_ASM_JUMP_LABEL_16()
00832         #undef  CVD_STORE_LABEL_16()
00833         #define CVD_STORE_LABEL_16()
00834     #endif
00835     #if CVD_NUMBER_SENSORS < 16
00836         #undef  CVD_ASM_JUMP_LABEL_15()
00837         #define CVD_ASM_JUMP_LABEL_15()
00838         #undef  CVD_STORE_LABEL_15()
00839         #define CVD_STORE_LABEL_15()
00840     #endif
00841     #if CVD_NUMBER_SENSORS < 15
00842         #undef  CVD_ASM_JUMP_LABEL_14()
00843         #define CVD_ASM_JUMP_LABEL_14()
00844         #undef  CVD_STORE_LABEL_14()
00845         #define CVD_STORE_LABEL_14()
00846     #endif
00847     #if CVD_NUMBER_SENSORS < 14
00848         #undef  CVD_ASM_JUMP_LABEL_13()
00849         #define CVD_ASM_JUMP_LABEL_13()
00850         #undef  CVD_STORE_LABEL_13()
00851         #define CVD_STORE_LABEL_13()
00852     #endif
00853     #if CVD_NUMBER_SENSORS < 13
00854         #undef  CVD_ASM_JUMP_LABEL_12()
00855         #define CVD_ASM_JUMP_LABEL_12()
00856         #undef  CVD_STORE_LABEL_12()
00857         #define CVD_STORE_LABEL_12()
00858     #endif
00859     #if CVD_NUMBER_SENSORS < 12
00860         #undef  CVD_ASM_JUMP_LABEL_11()
00861         #define CVD_ASM_JUMP_LABEL_11()
00862         #undef  CVD_STORE_LABEL_11()
00863         #define CVD_STORE_LABEL_11()
00864     #endif
00865     #if CVD_NUMBER_SENSORS < 11
00866         #undef  CVD_ASM_JUMP_LABEL_10()
00867         #define CVD_ASM_JUMP_LABEL_10()
00868         #undef  CVD_STORE_LABEL_10()
00869         #define CVD_STORE_LABEL_10()
00870     #endif
00871     #if CVD_NUMBER_SENSORS < 10
00872         #undef  CVD_ASM_JUMP_LABEL_9()
00873         #define CVD_ASM_JUMP_LABEL_9()
00874         #undef  CVD_STORE_LABEL_9()
00875         #define CVD_STORE_LABEL_9()
00876     #endif
00877     #if CVD_NUMBER_SENSORS < 9
00878         #undef  CVD_ASM_JUMP_LABEL_8()
00879         #define CVD_ASM_JUMP_LABEL_8()
00880         #undef  CVD_STORE_LABEL_8()
00881         #define CVD_STORE_LABEL_8()
00882     #endif
00883     #if CVD_NUMBER_SENSORS < 8
00884         #undef  CVD_ASM_JUMP_LABEL_7()
00885         #define CVD_ASM_JUMP_LABEL_7()
00886         #undef  CVD_STORE_LABEL_7()
00887         #define CVD_STORE_LABEL_7()
00888     #endif
00889     #if CVD_NUMBER_SENSORS < 7
00890         #undef  CVD_ASM_JUMP_LABEL_6()
00891         #define CVD_ASM_JUMP_LABEL_6()
00892         #undef  CVD_STORE_LABEL_6()
00893         #define CVD_STORE_LABEL_6()
00894     #endif
00895     #if CVD_NUMBER_SENSORS < 6
00896         #undef  CVD_ASM_JUMP_LABEL_5()
00897         #define CVD_ASM_JUMP_LABEL_5()
00898         #undef  CVD_STORE_LABEL_5()
00899         #define CVD_STORE_LABEL_5()
00900     #endif
00901     #if CVD_NUMBER_SENSORS < 5
00902         #undef  CVD_ASM_JUMP_LABEL_4()
00903         #define CVD_ASM_JUMP_LABEL_4()
00904         #undef  CVD_STORE_LABEL_4()
00905         #define CVD_STORE_LABEL_4()
00906     #endif
00907     #if CVD_NUMBER_SENSORS < 4
00908         #undef  CVD_ASM_JUMP_LABEL_3()
00909         #define CVD_ASM_JUMP_LABEL_3()
00910         #undef  CVD_STORE_LABEL_3()
00911         #define CVD_STORE_LABEL_3()
00912     #endif
00913     #if CVD_NUMBER_SENSORS < 3
00914         #undef  CVD_ASM_JUMP_LABEL_2()
00915         #define CVD_ASM_JUMP_LABEL_2()
00916         #undef  CVD_STORE_LABEL_2()
00917         #define CVD_STORE_LABEL_2()
00918     #endif
00919     #if CVD_NUMBER_SENSORS < 2
00920         #undef  CVD_ASM_JUMP_LABEL_1()
00921         #define CVD_ASM_JUMP_LABEL_1()
00922         #undef  CVD_STORE_LABEL_1()
00923         #define CVD_STORE_LABEL_1()
00924     #endif
00925 
00926     #define GENERATE_JUMP_TABLE()               \
00927         do {                                    \
00928             asm("global      sensor_0,"         \
00929                             "sensor_1,"         \
00930                             "sensor_2,"         \
00931                             "sensor_3,"         \
00932                             "sensor_4,"         \
00933                             "sensor_5,"         \
00934                             "sensor_6,"         \
00935                             "sensor_7,"         \
00936                             "sensor_8,"         \
00937                             "sensor_9,"         \
00938                             "sensor_10,"        \
00939                             "sensor_11,"        \
00940                             "sensor_12,"        \
00941                             "sensor_13,"        \
00942                             "sensor_14,"        \
00943                             "sensor_15,"        \
00944                             "sensor_16,"        \
00945                             "sensor_17,"        \
00946                             "sensor_18,"        \
00947                             "sensor_19,"        \
00948                             "sensor_20,"        \
00949                             "sensor_21,"        \
00950                             "sensor_22,"        \
00951                             "sensor_23,"        \
00952                             "sensor_24,"        \
00953                             "sensor_25,"        \
00954                             "sensor_26,"        \
00955                             "sensor_27,"        \
00956                             "sensor_28,"        \
00957                             "sensor_29 ");      \
00958             switch (current_sensor)             \
00959             {                                   \
00960                 case 0: asm("ljmp sensor_0");   \
00961                 CVD_ASM_JUMP_LABEL_1();         \
00962                 CVD_ASM_JUMP_LABEL_2();         \
00963                 CVD_ASM_JUMP_LABEL_3();         \
00964                 CVD_ASM_JUMP_LABEL_4();         \
00965                 CVD_ASM_JUMP_LABEL_5();         \
00966                 CVD_ASM_JUMP_LABEL_6();         \
00967                 CVD_ASM_JUMP_LABEL_7();         \
00968                 CVD_ASM_JUMP_LABEL_8();         \
00969                 CVD_ASM_JUMP_LABEL_9();         \
00970                 CVD_ASM_JUMP_LABEL_10();        \
00971                 CVD_ASM_JUMP_LABEL_11();        \
00972                 CVD_ASM_JUMP_LABEL_12();        \
00973                 CVD_ASM_JUMP_LABEL_13();        \
00974                 CVD_ASM_JUMP_LABEL_14();        \
00975                 CVD_ASM_JUMP_LABEL_15();        \
00976                 CVD_ASM_JUMP_LABEL_16();        \
00977                 CVD_ASM_JUMP_LABEL_17();        \
00978                 CVD_ASM_JUMP_LABEL_18();        \
00979                 CVD_ASM_JUMP_LABEL_19();        \
00980                 CVD_ASM_JUMP_LABEL_20();        \
00981                 CVD_ASM_JUMP_LABEL_21();        \
00982                 CVD_ASM_JUMP_LABEL_22();        \
00983                 CVD_ASM_JUMP_LABEL_23();        \
00984                 CVD_ASM_JUMP_LABEL_24();        \
00985                 CVD_ASM_JUMP_LABEL_25();        \
00986                 CVD_ASM_JUMP_LABEL_26();        \
00987                 CVD_ASM_JUMP_LABEL_27();        \
00988                 CVD_ASM_JUMP_LABEL_28();        \
00989                 CVD_ASM_JUMP_LABEL_29();        \
00990                 default: break;                 \
00991             }                                   \
00992         } while (0)
00993 
00994 
00995     #define GENERATE_STORAGE_FUNCTION()         \
00996         do {                                    \
00997             CVD_STORE_LABEL_0();                \
00998             CVD_STORE_LABEL_1();                \
00999             CVD_STORE_LABEL_2();                \
01000             CVD_STORE_LABEL_3();                \
01001             CVD_STORE_LABEL_4();                \
01002             CVD_STORE_LABEL_5();                \
01003             CVD_STORE_LABEL_6();                \
01004             CVD_STORE_LABEL_7();                \
01005             CVD_STORE_LABEL_8();                \
01006             CVD_STORE_LABEL_9();                \
01007             CVD_STORE_LABEL_10();               \
01008             CVD_STORE_LABEL_11();               \
01009             CVD_STORE_LABEL_12();               \
01010             CVD_STORE_LABEL_13();               \
01011             CVD_STORE_LABEL_14();               \
01012             CVD_STORE_LABEL_15();               \
01013             CVD_STORE_LABEL_16();               \
01014             CVD_STORE_LABEL_17();               \
01015             CVD_STORE_LABEL_18();               \
01016             CVD_STORE_LABEL_19();               \
01017             CVD_STORE_LABEL_20();               \
01018             CVD_STORE_LABEL_21();               \
01019             CVD_STORE_LABEL_22();               \
01020             CVD_STORE_LABEL_23();               \
01021             CVD_STORE_LABEL_24();               \
01022             CVD_STORE_LABEL_25();               \
01023             CVD_STORE_LABEL_26();               \
01024             CVD_STORE_LABEL_27();               \
01025             CVD_STORE_LABEL_28();               \
01026             CVD_STORE_LABEL_29();               \
01027         } while (0)
01028 #endif
01029 
01030 #endif
01031 
01032 
01033 
01034 

mTouch CVD Framework v1.1 documentation by  Click here to visit our website at www.microchip.com