Difference between revisions of "IO Properties"

From Flowcode Help
Jump to navigationJump to search
Line 40: Line 40:
 
Click OK and OK again to close the Detailed Description and Edit Property windows.
 
Click OK and OK again to close the Detailed Description and Edit Property windows.
  
You now have a new pin connection available on the properties window.
+
You should now have a new pin connection available on the properties window complete with tooltip.
  
 
[[File:Prop3.jpg]]
 
[[File:Prop3.jpg]]
 
  
 
===Referencing the property===
 
===Referencing the property===

Revision as of 09:59, 6 August 2018

Introduction

Most embedded components will require some form of connection to the real world. This is usually done via the standard input/output pins of the microcontroller.

This topic will deal with creating properties to allow your component to interact with the microcontroller pins specified by the user of the component.


Single Digital Pin

The first type of pin connection we will look at is a single digital pin, this can be used for input or output purposes and is the most common type of pin connection.

Creating a property

First click on a blank area of the 2D or 3D panels to select the root "Panel" object. You can also use the drop down menu at the top of the Properties window.

Open up the properties window and click the drop down arrow next to the Properties item in the window.

Prop1.jpg

Select Add New from the menu.

Give the property a cosmetic name, we have used Pin Connection

Select single digital pin from the drop down list

Give the property a property variable, we have used Pin

Prop2.jpg

Next click the drop down arrow next to the cosmetic name.

Prop7.jpg

Enter a detailed description of what the pin will be used for.

This defines the property tooltip that is shown to inform the user the purpose of the property.

Prop8.jpg

Click OK and OK again to close the Detailed Description and Edit Property windows.

You should now have a new pin connection available on the properties window complete with tooltip.

Prop3.jpg

Referencing the property

To reference the property simply use the variable name inside a calculation icon.

To output a logic low to the pin connection simply use an equals character to assign the value 0 to the pin.

Prop4.jpg


To output a logic high to the pin connection simply use an equals character to assign 1 to the pin.

Prop5.jpg


To read the logic level of an input voltage connected to the pin simply use an equals character to assign the pin to a variable.

Prop6.jpg