- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to edit an existing component to replace a hardware digital input pin with a digital input terminal, so I can control it from my schematic directly, rather than connecting it to a hardware GPIO. But how do I access the value of the terminal from inside the component? It doesn't have a read() function like a pin does? Do I need to connect it to a control register or something? All it does is read a true or false value from the surrounding circuit.
It would be simpler if I didn't need the terminal at all. Is there a way to have a component get a truth value from the containing schematic/program other than using a terminal? Maybe the component exposes a function that lets the containing project modify it's internal state? But the opposite would be better: if the component could query the containing project's state.
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which existing component are you trying to modify?
Pin components in an existing component can be replaced with a terminal symbol on the schematic. In this case, it is not available to get the status of these input pins and specify the logic level of these output pins. You can add a Status Register component to the input terminal to get the status and a Control Register component to the output terminal to specify the logic level.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which existing component are you trying to modify?
Pin components in an existing component can be replaced with a terminal symbol on the schematic. In this case, it is not available to get the status of these input pins and specify the logic level of these output pins. You can add a Status Register component to the input terminal to get the status and a Control Register component to the output terminal to specify the logic level.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. Is there a programmatic way to communicate with a component that I'm not thinking of? So a component can call a function internally that gets some state from the outside circuit that contains it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JoBr,
You can use a buried Pin inside the component. You can find an example of the buried pin example here:
ButtonSw32: button switch debouncer component
Basically, drop a Pin into component schematic (name Pin1), and set Hardware connection to False.
Reading value of the pin:
result =`$INSTANCE_NAME`_Pin1_Read(),
where `$INSTANCE_NAME` is the name of your component.
It can be read directly from the main.c or wrapped into component's *.h and *.c files.
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Basically, drop a Pin into component schematic, and set Hardware connection to False.
How do you do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JoBr,
You mentioned that there is existing component with schematic, which you would like to modify. So open that achematic, and drop a standard digital input Pin (a little square with green wire). Dbl-click it to open Settings an uncheck property hardware connection. The pin will look as a small square.
That's all. Now in the Design Wide Resources->Pins you can see this pin. And you can read this pin as shown in the previous message.
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think that's the opposite of what I want? The component already has a pin inside it that maps to an external GPIO in the DWR. I want it to NOT connect to an external GPIO, so I'm not wasting pins.
I managed to turn it into a terminal with a Status Register so it can be routed internally instead, and that seems to be working well.