编辑: 梦里红妆 | 2018-12-05 |
9 of
11 译器自动遵循此要求. 汇编语言程序员也必须确保其代码遵守这一策略. 虽然一些用户模块 API 函数可以保留 A 和X不变,但是无法保证它们将来也会如此. SCBLOCK_Start 说明: 设置此用户模块的功耗水平,并执行所有必需的初始化. C 原型: void SCBLOCK_Start (BYTE bPowerSetting) 汇编: mov A, bPowerSetting lcall SCBLOCK_Start 参数: bPowerSetting: 用于指定功率电平的一个字节. 在复位和配置之后,关闭分配的模拟 PSoC 模块的 电源. 下表包含了在 C 语言和汇编语言中提供的符号名称及其相关值. 功耗水平会影响模拟性能. 必须为每个应用程序确定正确的功耗设置. 返回值: 无 副作用: 此函数可能更改 A 和X寄存器. SCBLOCK_SetPower 说明: 设置 SCBLOCK 用户模块的功耗水平. C 原型: void SCBLOCK_SetPower (BYTE bPowerSetting) 汇编: mov A, bPowerSetting lcall SCBLOCK_SetPower 参数: bPowerSetting : 与用于 启动 进入点的 bPowerSetting 参数相同. 允许用户在运行模块时更改 功耗水平. 符号名 值SCBLOCK_OFF
0 SCBLOCK_LOWPOWER
1 SCBLOCK_MEDPOWER
2 SCBLOCK_HIGHPOWER
3 [+] Feedback Analog Switched Capacitor PSoC Block Document Number: 001-66406 Rev. ** Page
10 of
11 返回值: 无 副作用: 此函数可能更改 A 和X寄存器. SCBLOCK_Stop 说明: 将功耗水平设置为 0FF. C 原型: void SCBLOCK_Stop() 汇编: lcall SCBLOCK_Stop 参数: 无 返回值: 无 副作用: 此函数可能更改 A 和X寄存器. 固件源代码示例 以下是一个使用 C 语言编写的示例程序,该程序使用了 SCBLOCK: #include SCBLOCK.h void main(void) { SCBLOCK_Start(SCBLOCK_HIGHPOWER);
// Turn on SCBlock power // User code SCBLOCK_Stop();
// Turn off SCBlock power } 此示例代码首先启动 SCBLOCK 用户模块,然后等到计数达
255 次后停止 SCBLOCK: ;
;
;
Sample Code for the SCBLOCK include SCBLOCK.inc include m8c.inc export _main _main: mov A,SCBLOCK_HIGHPOWER ;
Set Power call SCBLOCK_Start ;
Turn on SCBLOCK mov A,ffh ;
Set loop counter loop1: dec A jnz loop1 call SCBLOCK_Stop ;
Turn off SCBlock [+] Feedback Analog Switched Capacitor PSoC Block Document Number: 001-66406 Rev. ** Revised January 5,
2011 Page
11 of
11 Copyright ? 2002-2011 Cypress Semiconductor Corporation. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. PSoC Designer? and Programmable System-on-Chip? are trademarks and PSoC? is a registered trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are property of the respective corporations. Any Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress rese........