Getting raw value as full resolution for ADS1115

mark0328
2021-03-04
2025-05-22
  • mark0328 - 2021-03-04

    Hello,

    I have configured and tested the ADS1115 by looking at the forums below.
    https://forge.codesys.com/forge/talk/Runtime/thread/f1400b71b6/?limit=25#9623

    As a result, I was able to get a full scale 2048 count with the FSR_2048mV setting, however, due to the low resolution, we would like to change this full scale to 32767. How can I get the raw AD count value as it is?

     
  • mark0328 - 2021-04-01

    Hi Ian,
    Thank you for your advice.
    We could change the resolution to 32000 from 2000 on our environment.
    This version is 1.0.0.1, please refer attach library and device profile.

     
  • abuckie - 2025-05-22

    I just found this and I am getting a value larger than 16 bit, around 81000 something. I am reading a 5 volt value and I am using level shifters for the i2c bus.

    This is how I have the channel configured:

    ADS1115.usiAddress := 16#48;
    ADS1115.ChannelConfigs[0].Active := TRUE;
    ADS1115.ChannelConfigs[0].PGA := FSR_6144mV;
    ADS1115.ChannelConfigs[0].InputMux := Single_0;
    RawAnalogValue := ADS1115.Channels[0].Value;

    It looks like every value is a multiple of 3. Any idea where to look to fix this?

    I think i found what I want to change in UpdateChannels

    Channels[FChannelNo].Value := INT_TO_REAL(WORD_TO_INT(LValue) * GetFullScaleRange(ChannelConfigs[FChannelNo].PGA)) / 2048.0;

    I try to edit it but I can't, sorry if this is a basic question, I am new to CODESYS.

     

    Last edit: abuckie 2025-05-22

Log in to post a comment.