本帖最后由 zhaoruzhe 于 2017-2-7 12:22 编辑
读写PSoC的寄存器,主要是使用:CY_GET_REG32(uint32 Register_Address)
CY_SET_REG32(uint32 Register_Address, uint32 Data)
用例如下,可以使用Debug查看CapSense_Start()、CapSense_Stop()前后,CSD模块的相关寄存器值变化。
在一些特殊的应用、调试的场合,直接对寄存器操作也有重要作用。
PSoC的寄存器详细介绍主要在各个PSoC产品的TRM里面,例如PSoC4000的Register TRM:
http://www.cypress.com/documenta ... technical-reference
- #include <project.h>
- uint32 CapSense_Registers[4]={0x40080000,0x40080004,0x40080008,0x4008000C};
- uint32 CapSense_Registers_GetI[4]={};
- uint32 CapSense_Registers_GetII[4]={};
- uint32 CapSense_Registers_GetIII[4]={};
- int main()
- {
- /* Enable Global interrupts */
- CyGlobalIntEnable;
- CyDelay(20);
-
- uint8 status_i;
-
- for(;;)
- {
- for(status_i=0u;status_i<4u;status_i++)
- {
- CapSense_Registers_GetI[status_i] = CY_GET_REG32(CapSense_Registers[status_i]);
- }
- ;
- CapSense_Start();
- CyDelay(200);
- ;
- for(status_i=0u;status_i<4u;status_i++)
- {
- CapSense_Registers_GetII[status_i] = CY_GET_REG32(CapSense_Registers[status_i]);
- }
- ;
- CapSense_Stop();
- CyDelay(200);
- ;
- for(status_i=0u;status_i<4u;status_i++)
- {
- CapSense_Registers_GetIII[status_i] = CY_GET_REG32(CapSense_Registers[status_i]);
- }
- ;
- }
- }
|