Pin Sharing

Pin sharing is the way, how multiple beans can use one pin of the CPU. Processor Expert supports the following ways of pin sharing:

InputPin bean

This bean supports reading of input pin signal without any previous pin initialization. The feature can be used only if the pin (port) contains RAW DATA register, which allows reading the input pin signal in any settings of related peripherals. See bean documentation for more details. Note: InputPin bean is included in the installation of Processor Expert only if any target CPU supports the feature mentioned above.

Design-Time and Run-Time Sharing

There is also possible to select pin sharing for the pin in the bean inspector, which is shared with another bean (denoted "main" bean). In this case the pin must be allocated and initialized by the main bean. The shared bean provides CPU specific verification testing if pin sharing is supported on target CPU with the main bean and decides, if the sharing can be set in the initialization (design- time sharing), or if it is necessary to invoke a method to select switch between main and shared bean (run-time sharing). It's allowed to set sharing of one pin for several beans as well.

Pin sharing is advanced usage of the CPU peripherals and should be done only by skilled users. Pin sharing allows advanced usage of the pins even on small CPU packages and allows application-specific usage of the pins.

Pin sharing can be set in the bean inspector. The bean inspector must be switched into EXPERT mode, and then the pin sharing button must be switched down. See picture, button at the right side of the second column.

 

Figure 1 - Pin Sharing Button

Design-time sharing does not need any user action in run-time. Some CPUs support usage of the pin by more peripherals. For example input pin can be used as an input for capture and at the same time as an input for another counter (EventCounter). Design-time sharing is indicated by single-color icon on the button

Run-time sharing means, that it's necessary to invoke bean method ConnectPin to connect bean to the shared pin. And it's necessary to invoke main bean method to connect pin back to main bean. In fact the bean can usually operate simultaneously, but they have no connection to the shared pins unless ConnectPin method is executed. Run-time sharing is indicated by three-color icon on the button

If more beans share one pin, it's better to invoke method ConnectPin before any bean usage. It's allowed to invoke this method also during design-time sharing - the method has no effect in this case. The method ConnectPin is not generated by default and it must be turned on manually.

Shared pins are presented in the Target CPU view as well. The bean to pin connection line is red.


 

 

[top of page]