Difference between revisions of "Component: LED (Generic, RGB) (LED)"

From Flowcode Help
Jump to navigationJump to search
 
(13 intermediate revisions by the same user not shown)
Line 15: Line 15:
 
An LED with red, green and blue elements that can be mixed together to produce almost any colour at any brightness.
 
An LED with red, green and blue elements that can be mixed together to produce almost any colour at any brightness.
  
==Detailed description==
+
==Component Source Code==
  
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_RGB_LED.fcfx FC_Comp_Source_RGB_LED.fcfx]
  
 +
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_RGB_LED.fcfx FC_Comp_Source_RGB_LED.fcfx]
  
 +
==Detailed description==
  
  
''No detailed description exists yet for this component''
 
  
==Examples==
 
  
  
Line 30: Line 31:
  
  
Tricolour LEDs generally have four pins and come in both common anode and common cathode configurations and must be wired to suit. The RGBLED component has a property allowing you to configure which LED type your using.
 
  
[[File:TriLED.jpg]]
 
  
  
An active high LED will light when the microcontroller pin is outputting a logic 1 and be off when the microcontroller pin is outputting a logic 0 or in input mode.
 
  
  
An active low LED will light when the microcontroller pin is outputting a logic 0 and be off when the microcontroller pin is outputting a logic 1 or in input mode.
 
  
  
Six pin tricolour LEDs can simply be treated as three individual standards LEDs.
 
  
  
The series resistor acts to protect each individual LED from damage due to excess current. The value of resistor used can be changed based on the brightness of the LED and power consumption. Usually the three colour LEDs have different characteristics from each other so a different protection resistor should be provided for each LED to balance the LEDs output.
 
  
  
This LED Calculator tool is a good resource for calculating the correct LED series protection resistor.
 
  
[http://led.linear1.org/1led.wiz LED Resistor Calculator Tool]
 
  
  
  
  
This example for the RGB LED uses three analogue sliders to set the output colour of the LED.
+
''No detailed description exists yet for this component''
  
{{Fcfile|RGB_LED.fcfx|RGB LED Example}}
+
==Examples==
  
  
The LED Colour is output to the LED using the Timer interrupt which calls the RGB LED Tick function.
 
  
  
The RGB LED properties include a setting for "Colour Bit Size" which sets the period for the LED colour PWM. The "Rollover Value" property shows the number of interrupts required for each PWM period so the timer interrupt should be running fast enough to allow the LED to output several periods per second. Persistence of vision can normally no longer detect any flickering light above approx 24Hz.
 
  
  
For a constant none flickering LED you can work out the minimum interrupt frequency like this.
 
  
30Hz * Rollover Value = Minimum interrupt frequency
 
  
30Hz * 256 = 7680Hz
 
  
60Hz * 64 = 3840Hz
 
  
  
Each LED colour channel can be set from 0 (minimum) to the rollover value - 1 (maximum). Therefore with a colour channel bit size of 8 there are theoretically 16777216 colours available 2^(8*3). With a colour bit size of 4 the available number of colours that can be generated drops to 4096, 2^(4*3).
 
  
==Downloadable macro reference==
 
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Disable'''
 
|-
 
| colspan="2" | Disables the RGB LED.  It will no longer respond to color changes. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Enable'''
 
|-
 
| colspan="2" | Enables the RGB LED.  This must be done before the LED can be lit or the color changed. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Tick'''
 
|-
 
| colspan="2" | Call this macro at regular intervals to illuminate the LED with the chosen color. Turns each pin on and off to generate a simple PWM signal for each color - when done rapidly, this gives the illusion of the chosen color. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetColor'''
 
|-
 
| colspan="2" | Set the target color for the LED.  Each of the Red, Blue and Green channels can be set to any value from 0 (off) to 255 (full brightness). 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | red
 
|-
 
| colspan="2" | Red component of RGB LED local to this macro 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | green
 
|-
 
| colspan="2" | Green component of RGB LED local to this macro 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | blue
 
|-
 
| colspan="2" | Blue component of RGB LED local to this macro 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteMicroseconds'''
 
|-
 
| colspan="2" | Sets the PWM output of one of the PCA9685 pins based on the input microseconds, output is not precise 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Output
 
|-
 
| colspan="2" | One of the PWM output pins - Range: 0 to 15 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Microseconds
 
|-
 
| colspan="2" | The number of Microseconds to turn the PWM output ON 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetPWM'''
 
|-
 
| colspan="2" | Sets the PWM output of one of the PCA9685 pins 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Output
 
|-
 
| colspan="2" | One of the PWM output pins - Range: 0 to 15 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | On
 
|-
 
| colspan="2" | At what point in the 4096-part cycle to turn the PWM output ON 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Off
 
|-
 
| colspan="2" | At what point in the 4096-part cycle to turn the PWM output OFF 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Sets up the I2C ready for communications to begin 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
Tricolour LEDs generally have four pins and come in both common anode and common cathode configurations and must be wired to suit. The RGBLED component has a property allowing you to configure which LED type your using.
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
[[File:TriLED.jpg]]
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WakeUp'''
 
|-
 
| colspan="2" | Wakes the module from Sleep mode 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
An active high LED will light when the microcontroller pin is outputting a logic 1 and be off when the microcontroller pin is outputting a logic 0 or in input mode.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetPin'''
 
|-
 
| colspan="2" | Sets pin without having to deal with on/off tick placement and properly handles a zero value as completely off and 4095 as completely on. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Output
 
|-
 
| colspan="2" | One of the PWM output pins - Range: 0 to 15 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Duty
 
|-
 
| colspan="2" | The number of ticks out of 4096 to be active 
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Invert
 
|-
 
| colspan="2" | 0=Normal, 1=Inverted 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
An active low LED will light when the microcontroller pin is outputting a logic 0 and be off when the microcontroller pin is outputting a logic 1 or in input mode.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawRectangle2D'''
 
|-
 
| colspan="2" | Draws a basic 2D rectangle onto the LEDs 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | X1
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Y1
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | X2
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Y2
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | DrawStyle
 
|-
 
| colspan="2" | Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | R
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | G
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | B
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
Six pin tricolour LEDs can simply be treated as three individual standards LEDs.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs2D'''
 
|-
 
| colspan="2" | Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | X
 
|-
 
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Y
 
|-
 
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | DataMode
 
|-
 
| colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
The series resistor acts to protect each individual LED from damage due to excess current. The value of resistor used can be changed based on the brightness of the LED and power consumption. Usually the three colour LEDs have different characteristics from each other so a different protection resistor should be provided for each LED to balance the LEDs output.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLEDIndex3D'''
 
|-
 
| colspan="2" | Gets the index of a single LED in RAM as a 3D array. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | X
 
|-
 
| colspan="2" | LED Column to change the colour / Range: 0 to (LED Column - 1) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Y
 
|-
 
| colspan="2" | LED Row to change the colour / Range: 0 to (LED Row - 1) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Z
 
|-
 
| colspan="2" | LED Layer to change the colour / Range: 0 to (LED Layer - 1) 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
This LED Calculator tool is a good resource for calculating the correct LED series protection resistor.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DrawCuboid3D'''
 
|-
 
| colspan="2" | Draws a basic 3D cuboid onto the LEDs 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | X1
 
|-
 
| colspan="2" | Start X pixel coordinate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Y1
 
|-
 
| colspan="2" | Start Y pixel coordinate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Z1
 
|-
 
| colspan="2" | Start Z pixel coordinate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | X2
 
|-
 
| colspan="2" | End X pixel coordinate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Y2
 
|-
 
| colspan="2" | End Y pixel coordinate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Z2
 
|-
 
| colspan="2" | End Z pixel coordinate 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | DrawStyle
 
|-
 
| colspan="2" | Sets the draw style - 0=Soild, 1=Edge, 2=Corners 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | R
 
|-
 
| colspan="2" | Red Colour Channel 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | G
 
|-
 
| colspan="2" | Green Colour Channel 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | B
 
|-
 
| colspan="2" | White Colour Channel 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
[http://led.linear1.org/1led.wiz LED Resistor Calculator Tool]
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Inisialises the RGB colour RAM to 0,0,0 = LED Off and clocks out the data to  initialise all the LED ICs in the chain. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ShiftLEDs3D'''
 
|-
 
| colspan="2" | Shifts the contents of the display by the number of vertices specified ***Please Note that Wrap mode is currently unavailable*** 
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | X
 
|-
 
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Y
 
|-
 
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Z
 
|-
 
| colspan="2" | Number of pixels to shift the display -1 to 1 / 0 = No Shift 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | DataMode
 
|-
 
| colspan="2" | 0=ResetToZero, 1=WrapAroundDisplay, 2=Smear 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
This example for the RGB LED uses three analogue sliders to set the output colour of the LED.
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
{{Fcfile|RGB_LED.fcfx|RGB LED Example}}
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Sets up the data memory and draws the simulated LED cube on the panel. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
The LED Colour is output to the LED using the Timer interrupt which calls the RGB LED Tick function.  
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Starts up the formula flowcode PWM for motor control and performs the wait for button press 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
The RGB LED properties include a setting for "Colour Bit Size" which sets the period for the LED colour PWM. The "Rollover Value" property shows the number of interrupts required for each PWM period so the timer interrupt should be running fast enough to allow the LED to output several periods per second. Persistence of vision can normally no longer detect any flickering light above approx 24Hz.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | The Init macro must be called once to initialise the Graphical LCD display before any other Graphical LCD component macros are called. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
For a constant none flickering LED you can work out the minimum interrupt frequency like this.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | The Init macro must be called once to initialise the Graphical LCD display before any other Graphical LCD component macros are called. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
30Hz * Rollover Value = Minimum interrupt frequency
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
30Hz * 256 = 7680Hz
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | The Init macro must be called once to initialise the Graphical LCD display before any other Graphical LCD component macros are called. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
60Hz * 64 = 3840Hz
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | The Init macro must be called once to initialise the Graphical LCD display before any other Graphical LCD component macros are called. 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
Each LED colour channel can be set from 0 (minimum) to the rollover value - 1 (maximum). Therefore with a colour channel bit size of 8 there are theoretically 16777216 colours available 2^(8*3). With a colour bit size of 4 the available number of colours that can be generated drops to 4096, 2^(4*3).
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros  
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros  
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros  
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MODPMSHAPE'''
 
|-
 
| colspan="2" | Sets PM waveform shape to; 0 = SINE, 1 = SQUARE, 2 = RAMPUP, 3 = RAMPDN, 4 = TRIANG, 5 = NOISE, 6 = DC, 7 = SINC, 8 = EXPRISE, 9 = LOGRISE, 10 = ARB1,  11 = ARB2, 12 = ARB3, 13= ARB4. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Shape
 
|-
 
| colspan="2" | Sets PM waveform shape (1 = SINE, 2 = SQUARE, 3 = RAMPUP, 4 = RAMPDN, 5 = TRIANG, 6 = NOISE, 7 = DC, 8 = SINC, 9 = EXPRISE, 10 = LOGRISE, 11 = ARB1, 12 = ARB2, 13 = ARB3, 14= ARB4). 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ARB4'''
 
|-
 
| colspan="2" | Loads the binary-data to an existing arbitrary waveform memory location ARB4. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Waveform
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
==Macro reference==
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CLKSRRet'''
 
|-
 
| colspan="2" | Returns the clock source <INT> or <EXT>.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
  
 +
===Disable===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MODPMDEV'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Disable'''
 
|-
 
|-
| colspan="2" | Sets PM waveform deviation to <nrf> degrees. (Lower limit: -360° - Upper limit: 360°).&nbsp;
+
| colspan="2" | Disables the RGB LED.  It will no longer respond to color changes.&nbsp;
 
|-
 
|-
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Degrees
 
|-
 
| colspan="2" | Sets PM waveform deviation in degrees (-360 - 360).&nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 652: Line 148:
  
  
 +
===Enable===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MSTLOCK'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Enable'''
 
|-
 
|-
| colspan="2" | Sends signal to SLAVE generator to get synchronised&nbsp;
+
| colspan="2" | Enables the RGB LED.  This must be done before the LED can be lit or the color changed.&nbsp;
 
|-
 
|-
 
|-
 
|-
Line 665: Line 162:
  
  
 +
===SetColor===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''HILVL'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetColor'''
 
|-
 
|-
| colspan="2" | Sets the amplitude-high-level to <nrf> Volts. (Lower limit: -0.490 V - Upper limit: 5.000 V).&nbsp;
+
| colspan="2" | Set the target color for the LED.  Each of the Red, Blue and Green channels can be set to any value from 0 (off) to 255 (full brightness).&nbsp;
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | HighLevel
 
|-
 
| colspan="2" | Sets the amplitude-high-level in Volts(V) (-0.490 V - 5.000 V).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ARB3'''
 
|-
 
| colspan="2" | Loads the binary-data to an existing arbitrary waveform memory location ARB3.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Waveform
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WAVE'''
 
|-
 
| colspan="2" | Sets the waveform type.  0 = SINE, 1 = SQUARE, 2 = RAMP, 3 = TRIANG, 4 = PULSE, 5 = NOISE, 6 = ARB&nbsp;
 
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | WaveType
+
| width="90%" | red
|-
 
| colspan="2" | 0 = SINE, 1 = SQUARE, 2 = RAMP, 3 = TRIANG, 4 = PULSE, 5 = NOISE, 6 = ARB.&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CALADJ'''
 
|-
 
| colspan="2" | Adjust the selected calibration value by <nrf> (Lower limit: -100 - Upper limit: 100).&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Calibrate
 
|-
 
| colspan="2" | Adjust the selected calibration value (-100 - 100).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''STBRet'''
 
|-
 
| colspan="2" | Returns the value of the Status Byte Register in <nr1> numeric format.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ARB2'''
 
|-
 
| colspan="2" | Loads the binary-data to an existing arbitrary waveform memory location ARB2.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Waveform
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EERRet'''
 
|-
 
| colspan="2" | Query and clear execution error number register.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MODFMSRC'''
 
|-
 
| colspan="2" | Sets FM waveform source to; 0 INT, 1 = EXT.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Source
 
|-
 
| colspan="2" | Sets FM waveform source (0 = INT, 1 = EXT).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MODAMFREQ'''
 
|-
 
| colspan="2" | Sets AM waveform frequency to <nrf> Hz. (Lower limit: 1uHz - Upper limit: 20kHz).&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Frequency
 
|-
 
| colspan="2" | Sets AM waveform frequency in Hertz(Hz) (1uHz - 20kHz).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ESE'''
 
|-
 
| colspan="2" | Sets the Standard Event Status Enable Register to the value of <nrf>.&nbsp;
 
 
|-
 
|-
 +
| colspan="2" | Red component of RGB LED local to this macro&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Value
+
| width="90%" | green
|-
 
| colspan="2" | Value of register 0-255&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ARB1'''
 
|-
 
| colspan="2" | Loads the binary-data to an existing arbitrary waveform memory location ARB1.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Waveform
 
|-
 
| colspan="2" | 16 Bit binary number for arbitrary waveform.&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ARB4DEFRet'''
 
|-
 
| colspan="2" | Returns user specified waveform name, waveform pint interpolation state and waveform length of ARB4.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CLS'''
 
|-
 
| colspan="2" | Clears status byte register of the interface.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MSTRELOCK'''
 
|-
 
| colspan="2" | Resynchronises the two generators in MASTER-SLAVE mode.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''NOISLVL'''
 
|-
 
| colspan="2" | Sets the output noise level to <nr1> %. (Lower limit: 0% - Upper limit: 50%)&nbsp;
 
 
|-
 
|-
 +
| colspan="2" | Green component of RGB LED local to this macro&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Percent
+
| width="90%" | blue
 
|-
 
|-
| colspan="2" | Sets the output noise level in percent. (0 - 50)&nbsp;
+
| colspan="2" | Blue component of RGB LED local to this macro&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 910: Line 191:
  
  
 +
===Tick===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LOCKMODE'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Tick'''
 
|-
 
|-
| colspan="2" | Sets the synchronising mode to; 0 = MASTER, 1 = SLAVE, 2 = INDEP.&nbsp;
+
| colspan="2" | Call this macro at regular intervals to illuminate the LED with the chosen color. Turns each pin on and off to generate a simple PWM signal for each color - when done rapidly, this gives the illusion of the chosen color.&nbsp;
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Mode
 
|-
 
| colspan="2" | Sets the synchronising mode (0 = MASTER, 1 = SLAVE, 2 = INDEP).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ADDRESSRet'''
 
|-
 
| colspan="2" | Returns the instruments address&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MODPMSRC'''
 
|-
 
| colspan="2" | Sets PM waveform source to; 0 INT, 1 = EXT.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Source
 
|-
 
| colspan="2" | Sets PM waveform source (0 = INT, 1 = EXT).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MODPWMSRC'''
 
|-
 
| colspan="2" | Sets PWM waveform source to; 0 = INT, 1 = EXT.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Source
 
|-
 
| colspan="2" | Sets PWM waveform source (0 = INT, 1 = EXT).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MOD'''
 
|-
 
| colspan="2" | Sets modulation to; 0 = OFF, 1 = AM, 2 = FM, 3 = PM, 4 = FSK, 5 = PWM.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Modulation
 
|-
 
| colspan="2" | Sets modulation (0 = OFF, 1 = AM, 2 = FM, 3 = PM, 4 = FSK, 5 = PWM).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ISTRet'''
 
|-
 
| colspan="2" | Returns IST local message as defined by IEEE Std. 488.2. The syntax of the response is 0<rmt>, if the local message is false, or 1<rmt>, if the local message is true.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LRNRet'''
 
|-
 
| colspan="2" | Returns the complete setup of the instrument as a binary data block&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OPCRet'''
 
|-
 
| colspan="2" | Query Operation Complete status. The response is always 1<rmt> and will be available immediately the command is executed because all commands are sequential.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SWPTYPE'''
 
|-
 
| colspan="2" | Sets the sweep type to; 0 = LINUP, 1 = LINDN, 2 = LINUPDN, 3 = LINDNUP, 4 = LOGUP, 5 = LOGDN, 6 = LOGUPDN, 7 = LOGDNUP.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Type
 
|-
 
| colspan="2" | Set the sweep type (0 = LINUP, 1 = LINDN, 2 = LINUPDN, 3 = LINDNUP, 4 = LOGUP, 5 = LOGDN, 6 = LOGUPDN, 7 = LOGDNUP).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PULSRANGE'''
 
|-
 
| colspan="2" | Sets PWM waveform source to <1>, <2> or <3>; 1 = 1, 2 = 2, 3 = 3.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Range
 
|-
 
| colspan="2" | Sets the pulse rise and fall range. (1, 2 or 3)&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TSTRet'''
 
|-
 
| colspan="2" | The generator has no self test capability and the response is always 0 <rmt>.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BSTTRGPOL'''
 
|-
 
| colspan="2" | Sets the burst trigger slope to; 0 = POS, 1 = NEG.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Slope
 
|-
 
| colspan="2" | Set the burst trigger slope (0 = POS, 1 = NEG).&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ARB3Ret'''
 
|-
 
| colspan="2" | Returns the binary-data from an existing abbitrary wavefrom memory location.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BSTPHASE'''
 
|-
 
| colspan="2" | Sets the burst phase to <nrf> degrees. (Lower limit: -360 - Upper limit: 360)&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Degrees
 
|-
 
| colspan="2" | Sets the burst phase in degrees (-360 - 360)&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IDNRet'''
 
|-
 
| colspan="2" | Returns the instrument identification. The IDN is saved to the variable passed from the function 'ReturnIDN'. The return parameter is TRUE when the IDN is successfully returned.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | ReturnIDN
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SWPTRGPER'''
 
|-
 
| colspan="2" | Sets the sweep trigger period to <nrf> seconds&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Seconds
 
|-
 
| colspan="2" | Set the sweep trigger period in seconds.&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PULSDLY'''
 
 
|-
 
|-
| colspan="2" | Sets the waveform delay to <nrf> sec&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:]] -
 
| width="90%" | Sec
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Opens the COM port ready for communications.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
  
  
Line 1,207: Line 211:
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 +
|-
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Pin Connections
 
|-
 
|-
 
|-
 
|-
Line 1,223: Line 231:
 
|-
 
|-
 
| colspan="2" | Pin tha the Blue pin is connected to.&nbsp;
 
| colspan="2" | Pin tha the Blue pin is connected to.&nbsp;
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Misc
 +
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Line 1,239: Line 251:
 
| colspan="2" | The number of unique colours each R/G/B channel can output. Range: 0 to (Rollover Value - 1).&nbsp;
 
| colspan="2" | The number of unique colours each R/G/B channel can output. Range: 0 to (Rollover Value - 1).&nbsp;
 
|-
 
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
 
 
|-
 
|-
 
|-
 
|-

Latest revision as of 13:12, 7 February 2023

Author Matrix Ltd
Version 1.3
Category LED


LED (Generic, RGB) component

An LED with red, green and blue elements that can be mixed together to produce almost any colour at any brightness.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_RGB_LED.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_RGB_LED.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Tricolour LEDs generally have four pins and come in both common anode and common cathode configurations and must be wired to suit. The RGBLED component has a property allowing you to configure which LED type your using.

TriLED.jpg


An active high LED will light when the microcontroller pin is outputting a logic 1 and be off when the microcontroller pin is outputting a logic 0 or in input mode.


An active low LED will light when the microcontroller pin is outputting a logic 0 and be off when the microcontroller pin is outputting a logic 1 or in input mode.


Six pin tricolour LEDs can simply be treated as three individual standards LEDs.


The series resistor acts to protect each individual LED from damage due to excess current. The value of resistor used can be changed based on the brightness of the LED and power consumption. Usually the three colour LEDs have different characteristics from each other so a different protection resistor should be provided for each LED to balance the LEDs output.


This LED Calculator tool is a good resource for calculating the correct LED series protection resistor.

LED Resistor Calculator Tool



This example for the RGB LED uses three analogue sliders to set the output colour of the LED.

FC6 Icon.png RGB LED Example


The LED Colour is output to the LED using the Timer interrupt which calls the RGB LED Tick function.


The RGB LED properties include a setting for "Colour Bit Size" which sets the period for the LED colour PWM. The "Rollover Value" property shows the number of interrupts required for each PWM period so the timer interrupt should be running fast enough to allow the LED to output several periods per second. Persistence of vision can normally no longer detect any flickering light above approx 24Hz.


For a constant none flickering LED you can work out the minimum interrupt frequency like this.

30Hz * Rollover Value = Minimum interrupt frequency

30Hz * 256 = 7680Hz

60Hz * 64 = 3840Hz


Each LED colour channel can be set from 0 (minimum) to the rollover value - 1 (maximum). Therefore with a colour channel bit size of 8 there are theoretically 16777216 colours available 2^(8*3). With a colour bit size of 4 the available number of colours that can be generated drops to 4096, 2^(4*3).






Macro reference

Disable

Fc9-comp-macro.png Disable
Disables the RGB LED. It will no longer respond to color changes. 
Fc9-void-icon.png - VOID Return


Enable

Fc9-comp-macro.png Enable
Enables the RGB LED. This must be done before the LED can be lit or the color changed. 
Fc9-void-icon.png - VOID Return


SetColor

Fc9-comp-macro.png SetColor
Set the target color for the LED. Each of the Red, Blue and Green channels can be set to any value from 0 (off) to 255 (full brightness). 
Fc9-u8-icon.png - BYTE red
Red component of RGB LED local to this macro 
Fc9-u8-icon.png - BYTE green
Green component of RGB LED local to this macro 
Fc9-u8-icon.png - BYTE blue
Blue component of RGB LED local to this macro 
Fc9-void-icon.png - VOID Return


Tick

Fc9-comp-macro.png Tick
Call this macro at regular intervals to illuminate the LED with the chosen color. Turns each pin on and off to generate a simple PWM signal for each color - when done rapidly, this gives the illusion of the chosen color. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Pin Connections
Fc9-type-5-icon.png Red
Pin that the red LED is connected to. 
Fc9-type-5-icon.png Green
Pin that the green LED is connected to. 
Fc9-type-5-icon.png Blue
Pin tha the Blue pin is connected to. 
Fc9-conn-icon.png Misc
Fc9-type-16-icon.png Polarity
Active High: Use for common cathode LEDs - Pin true = LED On. Active Low: Use for common anode LEDs - Pin false = LED On. 
Fc9-type-16-icon.png Color bit size
Color bit depth. Sets the resolution of the virtual PWM signals driving the LEDs. Lower values mean that the 'Tick' macro can be called less often, but reduced the number of colours that can be created. 
Fc9-type-14-icon.png Rollover value
The number of unique colours each R/G/B channel can output. Range: 0 to (Rollover Value - 1). 
Fc9-conn-icon.png Simulation
Fc9-type-17-icon.png Target
Create custom LED shapes by pointing this property at any object on your panel. This also works with groups of objects - all children of the group will change color. 
Fc9-type-16-icon.png Shape
Choose a simple shape for the LED when there is no 'Target' selected. 
Fc9-type-15-icon.png Width
Width of the LED shape. 
Fc9-type-15-icon.png Height
Height of the LED shape. 
Fc9-type-15-icon.png Depth
Depth of the LED shape.