Building Components - Step by Step Guide

A forum where Flowcode v7 user created components can be shared, discussed and reviewed.

Moderator: Benj

Valued Contributor
Valued Contributor
Posts: 1957
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands

Re: Building Components - Step by Step Guide

Post by kersing »


Multiple components accessing the same MCU pin is not a good idea at all. (In my opinion it is a disaster waiting to happen) I doubt very much that would be a supported use of components. Keep in mind component code might change to fix bugs or because of a Flowcode update and things may behave completely different. So my advice is not to go there.

Flowcode at the moment only sets the TRIS registers for the required operation (input or output), if you need pull up or anything like it you will need to use a C code block and add the required code yourself.
If you need open collector pins you first need to check the data sheet of the MCU to see if it is supported. If it is supported you will need to add C code to set the pin for this.

Best regards,

“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Posts: 186
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham

Re: Building Components - Step by Step Guide

Post by johnsondav »

Hi Igor

I am curious as to how you are connecting your device to the MCU. Looking at the data sheet, it shows these connections - four:
TCA6408A2.jpg (54.51 KiB) Viewed 2583 times
. On the MCU side, there are four required connection for this device (TCA6408A).

Therefore, I would design my component to have just three connections:
- Reset

As shown above, the reset pin would be missing from the standard FC7 I2C component. This would need to be included in the design of the new component for the TCA6408A to allow power-up function to work correctly. This would leave only the interrupt connection to by added be the user of the component in their project. The standard FC7 I2C component does not have a reset connection available. Therefore, during the building of your component, a 'Digital I/O pin would be added to handle the reset function for the component. When the component is placed into a project, FC7 will allow the user to select an available pin to perform this 'Reset' function, following the functionality designed into the component.
TCA6408A1.jpg (96.72 KiB) Viewed 2583 times
The interrupt I would leave this off your component design and allow the user to connect the interrupt directly using one of the available interrupt pins on the MCU. The user of your component, when writing their code will place an interrupt icon to allow the MCU to begin dealing with the connected device (An interrupt handling routine), as shown here:
TCA6408A3.jpg (87.86 KiB) Viewed 2583 times
Designing a FC7 component for the above device in this way may not suit everyone, but will give you an opportunity to review its performance before getting bogged down in detail. Therefore, get communication to work first, then review.

If I understand the devices start-up function correctly, all port pins of the TCA6408A are set as 'Inputs', may be wrong on that, its how I have read it. Once power-up is complete, programing of the device can begin to set which are input and which are output. From this, the component will have an 'Initialisation' macro which allows the power up function to be performed in a timely manner, then the user can program the I/P's accordingly afterwards by calling further macro calls to the component you will have added during the design of the component.

Hope this helps.


Post Reply