Library for working with the HYCON HY3116/8 24-bit weigh-scales ADC series.
Diff: HY3116.cpp
- Revision:
- 2:2da9fbab02b7
- Parent:
- 1:1967c3f48465
- Child:
- 3:535ed9a0ce59
--- a/HY3116.cpp Thu May 12 13:40:12 2016 +0000 +++ b/HY3116.cpp Mon Jun 13 00:43:19 2016 +0000 @@ -1,7 +1,7 @@ #include "HY3116.h" // Define I2C pins (SDA,SCL) -static I2C i2c(p30,p7); // nRF51-DK +static I2C i2c(p6,p5); // nRF51-DK // Single-byte write helper function void HY3116::writeByte(uint8_t address, uint8_t subAddress, uint8_t data) @@ -83,24 +83,24 @@ // Set-up the SYS register writeByte(HY3116_ADDRESS, SYS, 0b00011100); // Enable the ADC & LDO - wait_ms(100); // wait 100 ms to stabilize + wait_ms(1); // wait 100 ms to stabilize // Set-up the ADC1 register writeByte(HY3116_ADDRESS, ADC1, 0b00001000); // Set inputs to AIN1 & AIN2 - wait_ms(100); // wait 100 ms to stabilize + wait_ms(1); // wait 100 ms to stabilize // Set-up the ADC2 register writeByte(HY3116_ADDRESS, ADC2, 0b01010000); // Set pos. ref. voltage to VDDA, neg. ref. to VSSA, DC offset to 0VRef - wait_ms(100); // wait 100 ms to stabilize + wait_ms(1); // wait 100 ms to stabilize // Set-up the ADC3 register - writeByte(HY3116_ADDRESS, ADC3, 0b01111111); // Set to int. osc. 327kHz, full ref. range, PGA to 32x, pre-amp to 1x - wait_ms(100); // wait 100 ms to stabilize + writeByte(HY3116_ADDRESS, ADC3, 0b00111111); // Set to int. osc. 327kHz, full ref. range, PGA to 32x, pre-amp to 2x + wait_ms(1); // wait 100 ms to stabilize // Set-up the ADC4 register - writeByte(HY3116_ADDRESS, ADC4, 0b01011110); // Set LDO to 3.0V, REFO = 1.2V, conv. rate = 327kHz, SPS = 40 - wait_ms(100); // wait 100 ms to stabilize + writeByte(HY3116_ADDRESS, ADC4, 0b01001100); // Set LDO to 3.0V, REFO = 1.2V, conv. rate = 327kHz, SPS = 40 + wait_ms(1); // wait 100 ms to stabilize resetChip(); - wait_ms(100); + wait_ms(1); } \ No newline at end of file