Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches
dmt_asm.s
1;/*******************************************************************************
2;
3;DMT Generated Driver Header File
4;
5; @file dmt_asm.s
6;
7; @defgroup dmtdriver DMT Driver
8;
9; @brief Assembly language optimized helper routines required for calibration
10;
11; @skipline @version Firmware Driver Version 1.2.1
12;
13; @skipline @version PLIB Version 1.1.0
14;
15; @skipline Device : dsPIC33CH512MP506
16;
17;*******************************************************************************/
18;
19;// DOM-IGNORE-BEGIN
20;/*******************************************************************************
21; Copyright (C) 2016 Microchip Technology Inc.
22;
23; MICROCHIP SOFTWARE NOTICE AND DISCLAIMER: You may use this software, and any
24; derivatives created by any person or entity by or on your behalf, exclusively
25; with Microchip's products. Microchip and its licensors retain all ownership
26; and intellectual property rights in the accompanying software and in all
27; derivatives here to.
28;
29; This software and any accompanying information is for suggestion only. It
30; does not modify Microchip's standard warranty for its products. You agree
31; that you are solely responsible for testing the software and determining its
32; suitability. Microchip has no obligation to modify, test, certify, or
33; support the software.
34;
35; THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
36; EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED
37; WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR
38; PURPOSE APPLY TO THIS SOFTWARE, ITS INTERACTION WITH MICROCHIP'S PRODUCTS,
39; COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
40;
41; IN NO EVENT, WILL MICROCHIP BE LIABLE, WHETHER IN CONTRACT, WARRANTY, TORT
42; (INCLUDING NEGLIGENCE OR BREACH OF STATUTORY DUTY), STRICT LIABILITY,
43; INDEMNITY, CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, SPECIAL, PUNITIVE,
44; EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, FOR COST OR EXPENSE OF
45; ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWSOEVER CAUSED, EVEN IF
46; MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.
47; TO THE FULLEST EXTENT ALLOWABLE BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
48; CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF
49; FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
50;
51; MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
52; TERMS.
53;*******************************************************************************/
54
55
56/**
57 * ;uint32_t DMT_CalibratedCounterGet(void);
58 * Gets the count of DMT counter just before calling CalibratedCounterGet function
59 *
60 * @param none
61 * @return 32-bit (unsigned long) caliberated count
62 *
63 * Registers used: w0 w1 w2
64 *
65 */
66
67 .global _DMT_CounterGet
68 .global _DMT_CalibratedCounterGet
69 .global _calibOffset
70 .type _DMT_CalibratedCounterGet, @function
71 reset
72
73 _DMT_CalibratedCounterGet:
74 rcall _DMT_CounterGet
75 push w2
76 mov _calibOffset, w2
77 SUBR w2, w0, w0
78 mov #0x0, w2
79 SUBBR w2, w1, w1
80 pop w2
81 return
82
83/**
84 * ;void DMT_Calibrate(void);
85 * Calculates and stores offset value during DMT_CounterGet function call
86 *
87 * Registers used: w0 w1 w2
88 *
89 */
90
91 .global _DMT_CounterGet
92 .global _DMT_Calibrate
93 .global _calibOffset
94 .type _DMT_Calibrate, @function
95 .extern DMTCNTL
96 reset
97
98 _DMT_Calibrate:
99 push w0
100 push w1
101 push w2
102 mov DMTCNTL, w0
103 push w0
104 rcall _DMT_CounterGet
105 pop w2
106 sub w0, w2, w2
107 dec w2, w2
108 mov w2, _calibOffset
109 pop w2
110 pop w1
111 pop w0
112 return;
113