psoc1,how to get a pin input value?
select StdCPU and High Z Analog?
What is StdCPUInput?
Welcome in the forum!
StdCPU means: the pin's logical value can be read by the CPU. To get a digital input pin set the drive-mode to High-Z.
You read a pin by reading the complete port and mask out all unused pins by
PRTnDR & (0x01 << PinNumber) where n is the port number 0,1 etc and PinNumber is 0..7
Thank you Bob!
But I fail again. I set P7 stdcpu stong,P8 stdcpu High Z Analog,P9 stdcpu stong.And I connect P7 and P8,then P9 havent set high final.I can measure P7 is high. Please help.
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
#define P7_1() P7_Data_ADDR |= P7_MASK
#define P7_0() P7_Data_ADDR &= (~P7_MASK)
#define P8_1() P8_Data_ADDR |= P8_MASK
#define P8_0() P8_Data_ADDR &= (~P8_MASK)
#define P9_1() P9_Data_ADDR |= P9_MASK
#define P9_0() P9_Data_ADDR &= (~P9_MASK)
#define Get_P8() P8_Data_ADDR & P8_MASK
void Delay_ms(int x)
for (y=0; y<x; y++)
for (z=0; z<51; z++) //1ms delay when CPUCLK=24MHz
// Insert your main routine code here.
By the way,I am using cy8c20446.
Please do not provide code snippets only. Can you post your complete project, so that we all can have a look at all of your settings? To do so, use
and attach the resulting file.
Are you trying to learn PSoC? If so, I would suggest you to use a (more modern) prototyping kit which allows you to debug your program.