Hi, I am working with another obscure i2C based chip and made up some generic i2C macros, others may find these helpful, especially if your are new to i2C.
I know there are loads of examples and you can instead use the ReceiveTransaction and Send transaction macros but I have traditionally done it using the discrete i2C macros.
They Only send a single data byte or read a single data byte.
But if, like me, your working on a new chip and want to quickly read/write some test bytes using i2C, this might be a good starting point.
I based it on a ECIO40P, and used B4=Data, B3=Clock. but target chip can be anything, you choose.
J.
Simple i2C - Single Byte read and Write
-
- Posts: 3
- Joined: Wed Aug 09, 2017 7:30 pm
Re: Simple i2C - Single Byte read and Write
Thanks for the I2C example code. We have been having fits reliably reading I2C data from an MicroChip MCP9600 thermocouple chip. What we get is around 9 to 10 returns with missing bit 3, then a couple of good readings. Scoping this out shows strange behavior and we think the issue is with the FlowCode7 component. Very frustrating to troubleshoot.
Have you had any random bad readings from the chip you are using?
Have you had any random bad readings from the chip you are using?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Simple i2C - Single Byte read and Write
Hello,
Have you seen the blog post here on I2C communications it explains the basics and how to read a device datasheet.
https://www.matrixtsl.com/blog/simplifi ... c-and-spi/
If the blog doesn't help then can you post your program so we can double check the I2C protocol is being followed correctly in your firmware.
Also what value of pull up resistor are you using?
Have you seen the blog post here on I2C communications it explains the basics and how to read a device datasheet.
https://www.matrixtsl.com/blog/simplifi ... c-and-spi/
No it sounds like something is potentially wrong here.Have you had any random bad readings from the chip you are using?
If the blog doesn't help then can you post your program so we can double check the I2C protocol is being followed correctly in your firmware.
Also what value of pull up resistor are you using?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel