Building Components - Step by Step Guide

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

Moderator: Benj

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Building Components - Step by Step Guide

Post by kersing »

Igor,

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,

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

― C.S. Lewis

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

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
TCA6408A2.jpg (54.51 KiB) Viewed 8079 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:
- SDA
- SCL
- 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
TCA6408A1.jpg (96.72 KiB) Viewed 8079 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
TCA6408A3.jpg (87.86 KiB) Viewed 8079 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.

Regards
Dave

andeug
Posts: 1
Joined: Thu Mar 11, 2021 9:07 am
Location: Stockholm (SE)
Has thanked: 1 time
Contact:

Re: Building Components - Step by Step Guide

Post by andeug »

Hi Dave,


I am user of Flowcode 9 and I wonder if anyone has built an up-to-date guide for this version of software.
Also, within your guide they are some strange characters, as I have shown in the attached picture. Is it possible to generate again the .pdf or to share the .doc or .docx instead?


Thank you,
Andreas
Attachments
Screenshot 2021-03-11 at 10.17.54.png
Screenshot 2021-03-11 at 10.17.54.png (266.1 KiB) Viewed 5258 times

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: Building Components - Step by Step Guide

Post by johnsondav »

Hi Andeug

Please find copy of document as requested.
Component Creation 1.pdf
(2.9 MiB) Downloaded 232 times
Best Regards
Dave

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times
Contact:

Re: Building Components - Step by Step Guide

Post by johnsondav »

Hi Everyone.

Just to add some interest. The RS232 port could be an important component to master, as I am currently working on the RC2014 Z80. Well, not relevant to Flowcode you might say. What I have found is a very cheap way to make a graphics card for approximately £5 using a Raspberry Pi Zero and the firmware called PiGFX.

Here is a link to the firmware:

https://github.com/fbergama/pigfx

Scroll down and have a read. It is so simple to do it should be very easy to include with a PIC RS232 port. I have tested it with a USB keyboard and a modern computer monitor with an HDMI port and works like a dream. Just need to develop a flowcode component to go with it.

It works by getting a character from the keyboard and sends it out via its Tx on the serial port and waits for a reply on the Rx pin. That way you can get your pic to read a USB keyboard and output the graphics text using the power of the Pi Zero.

Dave

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Building Components - Step by Step Guide

Post by mnf »

Looks an interesting project..

Good luck and keep us informed. I might have a go at making one if it works....

Martin

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: Building Components - Step by Step Guide

Post by chipfryer27 »

Hi Dave

Thanks for posting the document again.

The original, and subsequent ones never opened properly for me due to fonts and what not. Couldn't open in Acrobat or Foxit or anything. Large chunks would be missing.

This opens perfectly and I can now see why it was praised so highly. A good job well done.

Thanks again for posting.

Regards

Post Reply