[其他产品] Microchip C语言编译器论坛

[复制链接]
 楼主| 斧王FUWANG 发表于 2022-5-31 17:17 | 显示全部楼层 |阅读模式
xc16问题
dspic器件,在xc16编译器下的.S源文件里怎么定义一个结构体变量??谁试过这是官网上扣的一个例程,感觉和普通的汇编编程风格很不同额,比方说一些伪指令前面都加个“.”还有就是程序中的ExampleHPFFilter是个结构体变量么,如何定义的?

 楼主| 斧王FUWANG 发表于 2022-5-31 17:18 | 显示全部楼层
  1. /*******************************************************************************

  2. High Pass Filter coefficients file

  3. //高通滤波系数文件

  4. Company:

  5. Microchip Technology Inc.

  6. File Name:

  7. examplehpf.s

  8. Summary:

  9. Consists of coefficients used by the filter function

  10. //包含了滤波函数的系数

  11. Description:

  12. This file composes of the high pass filter coefficients that are used

  13. by the IIRTransposed filter function to filter the incoming analog

  14. signal. These coefficients reside in the x-memory area.

  15. //这些系数存在于X-memory存储区域

  16. *******************************************************************************/

  17. /*******************************************************************************

  18. Copyright (c) 2012 released Microchip Technology Inc.  All rights reserved.

  19. Microchip licenses to you the right to use, modify, copy and distribute

  20. Software only when embedded on a Microchip microcontroller or digital signal

  21. controller that is integrated into your product or third party product

  22. (pursuant to the sublicense terms in the accompanying license agreement).

  23. You should refer to the license agreement accompanying this Software for

  24. additional information regarding your rights and obligations.

  25. SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,

  26. EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF

  27. MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.

  28. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER

  29. CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR

  30. OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES

  31. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR

  32. CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF

  33. SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES

  34. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

  35. *******************************************************************************/

  36. ; *****************************************************************************

  37. ; *****************************************************************************

  38. ; Section: Constants

  39. ; *****************************************************************************

  40. ; *****************************************************************************

  41. .equ ExampleHPFNumSections, 5

  42. ; ..............................................................................

  43. ;

  44. ; Allocate and initialize filter coefficients

  45. ;

  46. ; These coefficients have been designed for use in the Transpose filter only

  47. .section .xdata, xmemory, data  ;THIS line was modified

  48. ;to be compatible with C30 v1.3x

  49. ExampleHPFCoefs:

  50. .hword  0x2392  ; b( 1,0)/2

  51. .hword  0xB8FF  ; b( 1,1)/2

  52. .hword  0x3D5F  ; a( 1,1)/2

  53. .hword  0x2392  ; b( 1,2)/2

  54. .hword  0xEF39  ; a( 1,2)/2

  55. .hword  0x2FBB  ; b( 2,0)/2

  56. .hword  0xA1F2  ; b( 2,1)/2

  57. .hword  0x579D  ; a( 2,1)/2

  58. .hword  0x2FBB  ; b( 2,2)/2

  59. .hword  0xDA17  ; a( 2,2)/2

  60. .hword  0x3818  ; b( 3,0)/2

  61. .hword  0x9344  ; b( 3,1)/2

  62. .hword  0x68F9  ; a( 3,1)/2

  63. .hword  0x3818  ; b( 3,2)/2

  64. .hword  0xCC0D  ; a( 3,2)/2

  65. .hword  0x3C51  ; b( 4,0)/2

  66. .hword  0x8C80  ; b( 4,1)/2

  67. .hword  0x7150  ; a( 4,1)/2

  68. .hword  0x3C51  ; b( 4,2)/2

  69. .hword  0xC52E  ; a( 4,2)/2

  70. .hword  0x3E73  ; b( 5,0)/2

  71. .hword  0x8920  ; b( 5,1)/2

  72. .hword  0x7583  ; a( 5,1)/2

  73. .hword  0x3E73  ; b( 5,2)/2

  74. .hword  0xC175  ; a( 5,2)/2

  75. ; ..............................................................................

  76. ; Allocate states buffers in (uninitialized) Y data space

  77. .section .yconst

  78. ExampleHPFStates1:

  79. .space ExampleHPFNumSections*2

  80. ExampleHPFStates2:

  81. .space ExampleHPFNumSections*2

  82. ; ..............................................................................

  83. ; Allocate and intialize filter structure

  84. ;配置和初始化,滤波器结构体

  85. .section .data

  86. .global _ExampleHPFFilter

  87. ;这个是对ExampleHPFFilter定义么????否则该变量是在哪里定义的??

  88. _ExampleHPFFilter:

  89. .hword ExampleHPFNumSections-1

  90. .hword ExampleHPFCoefs

  91. .hword 0xFF00

  92. .hword ExampleHPFStates1

  93. .hword ExampleHPFStates2

  94. .hword 0x0000

  95. ; ..............................................................................

  96. ; Sample assembly language calling program

  97. ;  The following declarations can be cut and pasted as needed into a program

  98. ;               .extern _IIRTransposeFilterInit

  99. ;               .extern _BlockIIRTransposeFilter

  100. ;               .extern _ExampleHPFFilter

  101. ;

  102. ;               .section        .bss

  103. ;

  104. ;        The input and output buffers can be made any desired size

  105. ;          the value 40 is just an example - however, one must ensure

  106. ;          that the output buffer is at least as long as the number of samples

  107. ;          to be filtered (parameter 4)

  108. ;input:         .space  40

  109. ;output:        .space  40

  110. ;               .text

  111. ;

  112. ;

  113. ;  This code can be copied and pasted as needed into a program

  114. ;

  115. ;

  116. ; Set up pointers to access input samples, filter taps, delay line and

  117. ; output samples.

  118. ;               mov     #_ExampleHPFFilter, W0  ; Initalize W0 to filter structure

  119. ;               call    _IIRTransposeFilterInit ; call this function once

  120. ;

  121. ; The next 4 instructions are required prior to each subroutine call

  122. ; to _BlockIIRTransposeFilter

  123. ;               mov     #_ExampleHPFFilter, W0  ; Initalize W0 to filter structure

  124. ;               mov     #input, W1      ; Initalize W1 to input buffer

  125. ;               mov     #output, W2     ; Initalize W2 to output buffer

  126. ;               mov     #20, W3 ; Initialize W3 with number of required output samples

  127. ;               call    _BlockIIRTransposeFilter        ; call as many times as needed
sadicy 发表于 2022-6-3 09:08 | 显示全部楼层
很少看s文件
橘子阿小 发表于 2022-6-7 08:04 | 显示全部楼层
它是一个子函数
chenqianqian 发表于 2022-6-7 08:09 来自手机 | 显示全部楼层
楼主还用汇编写代码?
豌豆爹 发表于 2022-6-7 10:13 | 显示全部楼层
为什么你贴的代码底纹是黑色的,
lcczg 发表于 2022-6-8 17:01 | 显示全部楼层
具体格式解释,汇编器的用户手册应该会讲。
活跃的老崔 发表于 2022-6-27 08:58 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

39

主题

277

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部

39

主题

277

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部