Difference between revisions of "IO Properties"

From Flowcode Help
Jump to navigationJump to search
Line 65: Line 65:
  
 
[[File:Prop6.jpg]]
 
[[File:Prop6.jpg]]
 +
 +
 +
==Digital Port Byte==
 +
 +
The next type of pin connection we will look at is a digital port byte, this can be used for input or output purposes and allows 8 pins from the same port byte to be utilized in a single command.
 +
 +
===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.
 +
 +
[[File:Prop1.jpg]]
 +
 +
Select Add New from the menu.
 +
 +
Give the property a cosmetic name, we have used Port Connection
 +
 +
Select digital port byte from the drop down list
 +
 +
Give the property a property variable, we have used Port
 +
 +
[[File:Prop9.jpg]]
 +
 +
Next click the drop down arrow next to the cosmetic name.
 +
 +
[[File:Prop10.jpg]]
 +
 +
Enter a detailed description of what the port will be used for.
 +
 +
This defines the property tooltip that is shown to inform the user the purpose of the property.
 +
 +
[[File:Prop11.jpg]]
 +
 +
Click OK and OK again to close the Detailed Description and Edit Property windows.
 +
 +
You should now have a new port connection available on the properties window complete with tooltip.
 +
 +
[[File:Prop12.jpg]]
 +
 +
===Referencing the property===
 +
 +
To reference the property simply use the variable name inside a calculation icon.
 +
 +
To output a logic low to the port pins simply use an equals character to assign the value 0 to the port.
 +
 +
[[File:Prop13.jpg]]
 +
 +
 +
To output a logic high to the port pins simply use an equals character to assign 255 to the port.
 +
 +
[[File:Prop14.jpg]]
 +
 +
 +
To read the logic level of an input voltage connected to the port pins simply use an equals character to assign the port to a variable.
 +
 +
[[File:Prop15.jpg]]

Revision as of 10:09, 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.

You could simply use Input and Output flowchart icons to do this but this fixes the functionality to specific pins.

To allow the pin connections to be changed by the user we need a way to dereference the input/output commands from the pin connections.

This topic will deal with creating properties to allow your component macro code to interact with the microcontroller pins as 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


Digital Port Byte

The next type of pin connection we will look at is a digital port byte, this can be used for input or output purposes and allows 8 pins from the same port byte to be utilized in a single command.

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 Port Connection

Select digital port byte from the drop down list

Give the property a property variable, we have used Port

Prop9.jpg

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

Prop10.jpg

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

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

Prop11.jpg

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

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

Prop12.jpg

Referencing the property

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

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

Prop13.jpg


To output a logic high to the port pins simply use an equals character to assign 255 to the port.

Prop14.jpg


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

Prop15.jpg