- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the hardware design (PSoC Creator 3.3, PSoC 4 Prototyping Kit) I use some digital components with external inputs to decide how to set a digital output with hardware connection outside the PSoC. This works quite good. Now I want to read this output and use the value in the c-program to display additional stuff on the LCD-Display. But I have no luck in getting a value from the output-pin.
I start with defining a variable...
int CutOffVariable = 1
and later I'm polling the digital output "Cut_Off" with...
CutOffVariable = Cut_Off_Read();
but the variable doesn't change although I measure that the the hardware pin has changed it's status.
I tried also with ...
CutOffVariable = Cut_Off_ReadDataReg()
but I had no luck, probably don't understand the format of the returned value.
Any ideas how to solve this problem?
Cheers
Thomas
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are quite right with your estimation.
When you want to see which value you set the pin to, use Pin_ReadDataReg (). I do not know whether this API works when the pin was set by an internal signal (as your mentioned flip-flop), but I think you cannot read back the signal value.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post your complete project or a reduced excerpt that shows the error, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quite easy: You just have to enable the "Digital Input" in the Cut_Off pin configuration.
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sounds easy, so I enabled the digital input of the Cut_Off pin, but when I code ...
CutOffVariable = Cut_Off_Read();
... the CutOffVariable is always 0, although the Cut_Off pin is connected to a LED that is changing its's status???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What digital value do you expect when an LED is connected to the pin? Even with a removed LED there will be no correct Hi-level.
Way out(s):
- Measure the voltage and use a comparator at the input.
- Use an ADC
- Remove the LED or use another pin for it. (Set the drive mode to resistive pull up or pull down)
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, using a second pin parallel to the Cut_Off pin helped.
The Cut_Off pin is in open drain drive mode. I did expect to read a 0 or 1 from the digital pin but only got 0 in any case.
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Everything is working fine here 🙂
Just to be sure I understand the principle correct: When I read out a pin with a component-API, I don't get the signal that is driving the pin (for instance a signal coming from a Flip-Flop to the pin) but the signal that is actually present at the physical pin?
Thanks a lot!
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are quite right with your estimation.
When you want to see which value you set the pin to, use Pin_ReadDataReg (). I do not know whether this API works when the pin was set by an internal signal (as your mentioned flip-flop), but I think you cannot read back the signal value.
Bob