CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Need help for i2c communication with FDC2214
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ressas



Joined: 15 Nov 2019
Posts: 135

View user's profile Send private message

PostPosted: Tue Feb 04, 2020 2:17 am     Reply with quote

Hello to everyone. Fdc2112 integration was corrupted. So I had a break. I made a new experiment with a new integrated.
I have not made any changes to the above code.
The code worked properly. Thank you to everyone who helped. Very Happy Under this heading we have run both FDC2214 and FDC2112 integrations. We can close the title here.
However, if you want to continue; let me ask you a question Smile
As output in FDC2214 IC; We were getting 32-bit data like "15505207, 15639900, 15257648, 15034281". The last 3 digits were constantly changing.
In FDC2112 IC (in the code above), we get values between "0-255".
I couldn't get a result by changing the variable types.
Datasheet also writes that I can make a reading of 12 bits. How can I do that? Very Happy Very Happy
ressas



Joined: 15 Nov 2019
Posts: 135

View user's profile Send private message

PostPosted: Tue Feb 04, 2020 5:44 am     Reply with quote

Let me also state that in order not to waste time.
Combining the variables "Dummy" and "Reading" with the make32 command only grows the number. However, sensitivity does not change.
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Tue Feb 04, 2020 7:02 am     Reply with quote

Of course it won't.
On the high accuracy chip there is an extra word to read.
On the low accuracy chip there isn't. However the data sheet implies
that this value should be read or there may be issues. Hence it is read into
'dummy', to ensure this doesn't cause a problem, but the value is useless.
ressas



Joined: 15 Nov 2019
Posts: 135

View user's profile Send private message

PostPosted: Tue Feb 04, 2020 7:41 am     Reply with quote

Thank you Ttelmah.
Can you tell me from which page of datasheet you learned this information? Question
ressas



Joined: 15 Nov 2019
Posts: 135

View user's profile Send private message

PostPosted: Tue Feb 04, 2020 7:48 am     Reply with quote

Because datasheet also writes that this integrated is 12 bits. Therefore, I should read between 0-4096 and not between 0-255. Question Question
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Tue Feb 04, 2020 8:53 am     Reply with quote

The data sheet is the note:
Quote:

(2) The DATA_CHx.DATAx register must always be read first, followed by the DATA_LSB_ CHx.DATAx register of the same channel to
ensure data coherency.


Now when you are only actually using the DATA_CHx.DATAx value, it is not
said whether this is still required. Felt it was safer to do the extra read to be
sure.

On the value, yes it should return 0 to 4095. Probably something in your
code like printing using %d, rather than using %ld, or an integer definition
somewhere so the extra byte is being lost.
ressas



Joined: 15 Nov 2019
Posts: 135

View user's profile Send private message

PostPosted: Wed Feb 05, 2020 3:52 am     Reply with quote

The value I normally get was this;
Quote:

215 ,4095
213 ,4095
209 ,4095
208 ,4095
208 ,4095
208 ,4095
208 ,4095
209 ,4095
209 ,4095
214 ,4095
215 ,4095

Here the values on the right are the values from the first channel. Since the values on the left are not connected to the coil, it always comes as 4095.

I read the "gain offset" section on the data sheet page 17. There is a change in profit by shifting 12-bit data.
write16FDC(FDC2214_RESET_DEV,0b0000011000000000);
In this way, I obtained the following data;
Quote:

3440 ,4095
3437 ,4095
3434 ,4095
3431 ,4095
3402 ,4095
3319 ,4095
3322 ,4095
3325 ,4095
3327 ,4095
3331 ,4095
3330 ,4095
3407 ,4095
3430 ,4095
3438 ,4095

The change was about 30 units in the initial values.
About 300 units after Gain offset. Increase and decrease seems to be 1 unit. This means that "gain offset" works.

Those who want to use can continue by adding "gain offset" above.

However, if I get 4095 in channel 2 in the first value, I should get a value in channel 1, not 215, but 4000. I couldn't understand this part. Question
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Wed Feb 05, 2020 4:20 am     Reply with quote

All this means is that you are really reading a value of 208. You have now
multiplied this by 16 so it displays as 3340, but now if a larger signal
comes in, the top bits of this will be lost.
This is great if your signal is never going to go over 255, but if it does
data will be lost. So you have restricted the maximum signal the system can
now handle. Implies there was nothing wrong with the maths or display,
it was just your signal was too small....

The unit is displaying the whole 12bit value fine. Hence 4095 in the unused
channel. It's just that the actual signal you have only gives a reading of
208.
ressas



Joined: 15 Nov 2019
Posts: 135

View user's profile Send private message

PostPosted: Wed Feb 05, 2020 5:34 am     Reply with quote

What you say yes is correct. However, I did not directly multiply the data by 16. If this were the case, the change that occurred when the object approached would be 16 units. However, it changes one by one.
Secondly, it will never exceed 255. Because its idle value is 255. The value decreases as the object approaches.
What I do not understand; if I see 4095 in one channel, I should see a value close to that value from the other channel. But after the "offset" operation, I see values like 3000. I was hoping to get similar values without using "offset"

Thanks for helping me with my search Ttelmah.
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Wed Feb 05, 2020 8:30 am     Reply with quote

Yes. The advantage of the shift, is you actually access the extra 4 bits of the
ADC. The '12bit' chip has a 16bit ADC. It just only ever outputs 12bits
of this. However the point was the the reason you are needing this is the
signal is only covering about 1/5th the input range, and you therefore
need to be very careful if you are not going to over range this input.
The 4095 from the second channel is almost certainly a sign that
it is simply going 'full scale', which implies this channel is not seeing a
signal. You need to look carefully at how this is actually wired/configured.
You 'as standard' get the 28bit value.65536. With the shift applied, you
instead get the 28bit value over 4096.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group