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.
Fork of MAX11410-test by
Diff: main.cpp
- Revision:
- 9:5d9509c15e8a
- Parent:
- 8:882a6cdb1bf3
- Child:
- 11:1050ffc0e9ef
--- a/main.cpp Tue Feb 06 02:51:26 2018 +0000
+++ b/main.cpp Fri Mar 16 20:18:44 2018 +0000
@@ -137,39 +137,39 @@
pc.printf("reg %02x, val %02x, set to %02x\r\n",REG_PGA,adc1.read8bits(REG_PGA,&int_state),pga_config);
// for each channel 1-5
- for(int n=0;n<5;n++)
- {
- //select channel
- char p_ch = 2*n<<4;
- char n_ch = 2*n+1;
- adc1.write8bitReg(REG_MUX_CTRL0, p_ch | n_ch );
-
- //select data output register and begin conversion
- adc1.write8bitReg(REG_CONV_START, (_DEST(n) | SINGLE_CONV) );
-
- //optional: cal Gain
-
- //optional: cal Offset
-
- //optional: store cal parameters
-
- //begin conversion
-
- //wait for interrupt
- while(!adc1.interrupt() )
- {
- wait_ms(CONV_DELAY_MS);//do nothing
-// pc.printf("waiting for int");
- }
-
- //read conversion
- channel_data[n] = adc1.read24bitsSigned(REG_DATA0+n,&int_state);
- pc.printf("%d, ",channel_data[n]);
- } //channel sweep
- pc.printf("\r\n");
-
-
- //config ADC 2: repeat above
+/// for(int n=0;n<5;n++)
+/// {
+/// //select channel
+/// char p_ch = 2*n<<4;
+/// char n_ch = 2*n+1;
+/// adc1.write8bitReg(REG_MUX_CTRL0, p_ch | n_ch );
+///
+/// //select data output register and begin conversion
+/// adc1.write8bitReg(REG_CONV_START, (_DEST(n) | SINGLE_CONV) );
+///
+/// //optional: cal Gain
+///
+/// //optional: cal Offset
+///
+/// //optional: store cal parameters
+///
+/// //begin conversion
+///
+/// //wait for interrupt
+/// while(!adc1.interrupt() )
+/// {
+/// wait_ms(CONV_DELAY_MS);//do nothing
+///// pc.printf("waiting for int");
+/// }
+///
+/// //read conversion
+/// channel_data[n] = adc1.read24bitsSigned(REG_DATA0+n,&int_state);
+/// pc.printf("%d, ",channel_data[n]);
+/// } //channel sweep
+/// pc.printf("\r\n");
+///
+///
+/// //config ADC 2: repeat above
@@ -181,8 +181,8 @@
{
//read each channel
//select channel
- char p_ch = 2*n<<4;
- char n_ch = 2*n+1;
+ char p_ch = 2*n+1<<4;
+ char n_ch = 2*n;
adc1.write8bitReg(REG_MUX_CTRL0, p_ch | n_ch );
//select data output register and begin conversion
@@ -211,8 +211,8 @@
{
//read each channel
//select channel
- char p_ch = 2*n<<4;
- char n_ch = 2*n+1;
+ char p_ch = 2*n+1<<4;
+ char n_ch = 2*n;
adc2.write8bitReg(REG_MUX_CTRL0, p_ch | n_ch );
//select data output register and begin conversion
