Generic I2C Component

Please add any feature requests for Flowcode version 7 here

Moderator: Benj

Post Reply
Quartz
Posts: 18
Joined: Sat May 20, 2017 7:39 pm
Contact:

Generic I2C Component

Post by Quartz »

I understand that component creation is possible through a step by step walk through of a tutorial or video but having wanted to control various I2C chips I found it very confusing and not easy! I have yet to be able to create one to control a MCP23008 or a MCP3221.

How about.....
An I2C component that allows you to;-
Select to send start, restart and stop
Select how many bytes to send (and enter those bytes or variables)
Select the I2C address to use
Select what order to send them
etc etc.

The component could then be used for any I2C component without having to create a custom component each time we use a different chip.

I'm sure then those of us that can control the chips outside of FC can work out how to do it within FC without having to learn something we may only use occasionally. OK I know we can use C within FC but for me the idea of using FC is to step away from writing code as much as possible.

Chris

User avatar
Benj
Matrix Staff
Posts: 14848
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Generic I2C Component

Post by Benj »

Hi Chris,

Doesn't the I2C Master component do all this for you already?

This blog post may help.
https://www.matrixtsl.com/blog/simplifi ... c-and-spi/

Creating a component for an I2C device usually adds more then the basic comms in that we generally try and add a level of simulation too.

Quartz
Posts: 18
Joined: Sat May 20, 2017 7:39 pm
Contact:

Re: Generic I2C Component

Post by Quartz »

Hi Benj

Thanks for the link, it just shows that almost everything is there, if you know where to look.... :-)

I did have a look at the I2C master component before and didn't get very far, the link could make all the difference.
And having looked around for examples / help I only found stuff that was just as confusing as other I2C tutorials.

One thing that slows me down is having only just jumped from FC V4 to FC V7 I haven't seen what the other versions have been like along the way and so when I see examples for the likes of FC V6 that may well work in V7 and there are slight differences in the program or menus I don't know if I should spend the hours trying them and working how to get them to work or just accept that they may not work and look else where.

My first thought (before taking a look at the link you gave) was to have a maco builder type thing where you can select what commands and data to send to the device (or get from the device). Once the details are set in a window a macro is built using that info.

I have cobbled a picture of the kind of thing I had in mind, I know it's not exact or complete but it's just what I had started to wish I had when I wasn't getting anywhere. I'm sure from this you can understand my thinking.
I2C.jpg
I2C.jpg (121.25 KiB) Viewed 2578 times

Thanks again
Chris

Quartz
Posts: 18
Joined: Sat May 20, 2017 7:39 pm
Contact:

Re: Generic I2C Component

Post by Quartz »

I have realised I didn't explain some of the picture...

In the picture those command entries with an enable tick box next to them are drop down selection boxes that have the various commands like Start, Restart, Stop etc in each so that the user doesn't have to work out what they can use it's in front of them.

The data box entries can be as many as needed and are added then enabled by the tick boxes so that only those with a tick will be used, makes for an easy way of trying options out and / or building several macros that are similar or have the same base..

Any of the values could be a value, hard coded (if there is only a small range allowed) or a variable.

Some options, amount of data entries, data values or the commands and command order could be more specific for a device if there was a device selection box too.

Anyway as I said this is where my thoughts was drifting to when I was stuck and frustrated....

Regards
Chris

Post Reply