Good morning all,
I have tried to use the I2C Master for my application and I have some questions concerning it.
My dspic reads I2C data, but the sequence of data changes as a function of the operating mode.
The state machine has 6 modes and these modes are identified by numbers: 1,2,3,4,5 and 6
In practice I have 2 sequences:
- The 1st for the operating mode numbers 2, 4 and 6. The dspic must read 12 words in these modes.
- The 2nd for the operating mode numbers 1, 3 and 5. The dspic must read 18 words in these modes.
At present, I have no available simulink model and I don't see how to manage this with the I2C master.
Maybe that anybody can help me ? Thank you in advance.
Johan
Question about I2C
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: Question about I2C
Hi Johan,
On the example I have build, I read only
- 4 data for states 1 ; 3 and 5
- 2 data for states 2 ; 3 and 6
But you can easily adapt it to read 18 and 12 data.
I use an Enabled Subsystem to choose wether I am reading 4 or 2 data. The model : I use a bus to gather the data. When reading only 2 data, I place 0 into into the unfilled data.
Using a bus with a constant width of 4 is up to you. You could use the I2C data in a different way. The merge block output the most recent data (refere to simulink help)
On the example I have build, I read only
- 4 data for states 1 ; 3 and 5
- 2 data for states 2 ; 3 and 6
But you can easily adapt it to read 18 and 12 data.
I use an Enabled Subsystem to choose wether I am reading 4 or 2 data. The model : I use a bus to gather the data. When reading only 2 data, I place 0 into into the unfilled data.
Using a bus with a constant width of 4 is up to you. You could use the I2C data in a different way. The merge block output the most recent data (refere to simulink help)
Re: Question about I2C
Hello Lubin and thank you for your answer.
I will test your model and adapt it to my need.
Thank you.
Johan
I will test your model and adapt it to my need.
Thank you.
Johan
Who is online
Users browsing this forum: Google [Bot] and 45 guests