MCP356x1 Set and Get Register

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
Post Reply
stefan.erni
Valued Contributor
Posts: 1299
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 246 times
Been thanked: 258 times

MCP356x1 Set and Get Register

Post by stefan.erni »

Hi Ben

The MCP356x1 is a nice 24Bit Ad converter.
The AD converter is working perfect with FC11

I recorded two signals using different oversampling settings. At 32, the noise is higher, but there are no steps in the signal.
with 512 unfortunately, it's reversed but not better.

It would be convenient for me if I could read and set all the registers.

Some I2C components have a read/write command in Flowcode;
perhaps this could also be added for some other SPI components?

The same signal recorded twice with different OSR values and saved in two files
2026-10-08_17-38-30.PNG
2026-10-08_17-38-30.PNG (83.78 KiB) Viewed 57 times
Oversampling 32...512
2026-10-09_09-50-20.PNG
2026-10-09_09-50-20.PNG (20.18 KiB) Viewed 57 times

BenR
Matrix Staff
Posts: 2332
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 647 times
Been thanked: 856 times

Re: MCP356x1 Set and Get Register

Post by BenR »

Hi Stefan,

Glad it's working well for you.

This might be the perfect opportunity to show you how to modify a component to better suit your needs.

If you go to the Wiki page for the component then near the bottom of the page should be a section called component source.
https://www.flowcode.co.uk/wiki/index.p ... log_Input)

Download the component source project and open in Flowcode. I try and keep the source files up to date but if you notice one that's different from the exported public version then let me know.

The Read/Write registers command in most cases for I2C or SPI components will already exist, all you need to do is to make them public.

You can simply do this via the File -> Export -> Edit the export settings -> Interface tab. Changing the macro you want to become available to downloadable.

You can also browse through how the Read/Write macro is used in the component code to gain an understanding of how you need to handle it in your own code.

Of course if you think a change needs to be public and available for everyone then please let us know.

Typically on the MCP356X component, it wasn't this easy. The read/write macro was using a buffer that was internal to the component. So here I've done the macro change for you and modified the component so the read/write macro is now passed a buffer allowing both you and the component to work with your own unique buffers. It also hopefully is slightly more efficient on RAM usage this way. Note the first byte of the buffer is retained for the command code / address so any data you want to read/write will begin on byte index 1.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel

stefan.erni
Valued Contributor
Posts: 1299
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 246 times
Been thanked: 258 times

Re: MCP356x1 Set and Get Register

Post by stefan.erni »

Hi Ben

Very good
I already understand how to view, edit, and use the components.
I have a question about the properties in the components.
Do I have to view and edit them with a text editor, or is there another way?

Code: Select all


					<property name='AMCLK Prescaler' target='Prescaler' typeid='16' hidden='0' locked='0' info='' filter='000MCLK
001MCLK / 2
002MCLK / 4
003MCLK / 8' />
					<property name='Oversampling Ratio' target='OversamplingRatio' typeid='16' hidden='0' locked='0' info='' filter='00032
00164
002128
003256
004512
0051024
0062048
0074096
0088192
00916384
01020480
01124576
01240960
01349152
01481920
01598304' />
					<property name='ADC Gain' target='ADCGain' typeid='16' hidden='0' locked='0' info='' filter='000x1/3


stefan.erni
Valued Contributor
Posts: 1299
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 246 times
Been thanked: 258 times

Re: MCP356x1 Set and Get Register

Post by stefan.erni »

Hi Ben

Sorry, that was my fault. I didn't notice it.

doubleclick on the left side propertis open the menue.
Not working in variable part :)

Wrong place to click...
2026-10-09_17-41-27.PNG
2026-10-09_17-41-27.PNG (221.9 KiB) Viewed 30 times
Menue:
2026-10-09_17-38-14.PNG
2026-10-09_17-38-14.PNG (37.59 KiB) Viewed 30 times

Post Reply