Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX113XX_Pixi max32630fthr
Fork of MAX11301_Demo by
Diff: main.cpp
- Revision:
- 3:b3fbff9ab12e
- Parent:
- 2:5362460b01ef
- Child:
- 4:4899e8165b98
--- a/main.cpp Thu Aug 17 20:04:52 2017 +0000
+++ b/main.cpp Mon Aug 21 14:18:36 2017 +0000
@@ -14,21 +14,18 @@
MAX113XX_I2C * pixi;
pixi = new MAX113XX_I2C(i2cBus, MAX113XX_I2C::MAX11301, 0x38, P5_5);
-
+
+ pixi->dacWrite(MAX113XX_Pixi::PORT0, 0x000); // Pixi PORT0 is -5V
+ pixi->dacWrite(MAX113XX_Pixi::PORT1, 0xFFF); // Pixi PORT1 is +5V
uint16_t adcData, idx;
float adcVoltage;
while(1) {
-
- for(idx = 0; idx <= 0xFFF; idx++) {
- pixi->dacWrite(MAX113XX_Pixi::PORT0, idx); // Write idx to PORT0
- pixi->singleEndedADCRead(MAX113XX_Pixi::PORT9, adcData); // Read value from PORT9
- adcVoltage = -5 + 2.442e-3 * adcData; // Convert ADC val to a voltage
- pc.printf("ADC Voltage is %1.3f V, Count is 0x%x \r\n", adcVoltage, idx);
- }
- pc.printf("\r\n\r\nSweep complete, starting new sweep\r\n\r\n");
- wait(2.0);
+ pixi->singleEndedADCRead(MAX113XX_Pixi::PORT9, adcData); // Read value from PORT9
+ adcVoltage = -5 + 2.442e-3 * adcData; // Convert ADC val to a voltage
+ pc.printf("ADC Voltage is %1.3f V, Count is 0x%x \r\n", adcVoltage, idx);
+ wait(0.05);
}
}
