Test software for PCF8591 and SAA1064

Dependencies:   PCF8591 SAA1064 mbed

Files at this revision

API Documentation at this revision

Comitter:
wim
Date:
Mon Sep 23 20:01:02 2013 +0000
Parent:
0:cbacd2d41523
Commit message:
Cleaned up documentation

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r cbacd2d41523 -r 7dd6c7104fef main.cpp
--- a/main.cpp	Mon Sep 23 19:24:28 2013 +0000
+++ b/main.cpp	Mon Sep 23 20:01:02 2013 +0000
@@ -98,7 +98,7 @@
 
   init_interfaces();
     
-  //heartbeat_start();
+  heartbeat_start();
           
   clear_screen(); 
     
@@ -120,13 +120,11 @@
    LED.splash(6);
    wait(1.0);    
 
-//   pc.printf("Ctrl    = 0x%02X ", PCF8591_CTRL_DEF);        //0x40
-//   pc.printf("ADC Adr = 0x%02X ", PCF8591_ADC1);            //0x01
 
-
-//812 BUG: seems a delay is needed between write ADC register and read ADC or ADC results are unstable, DAC values leaking through...    
+//LPC812 I2C BLOCKWRITE BUG: ADC results are unstable, DAC values leaking through...    
 //The Heartbeat Interrupt also seems to make the problem worse
 
+// Test for PCF8591          
   while(1) {
     float ana;  
     //pc.putc('*');            
@@ -146,16 +144,12 @@
   }
   
 
-          
-  while(1) {
-//   myled1 = 0;
-//   wait(0.1);      
-//   myled1 = 1;
-//   wait(0.9);
-               
+// Test for SAA1064 and PCF8591          
+  while(0) {
+              
     //pc.printf("*");        
     pc.putc('*');            
-    wait(0.2);    
+    wait_ms(200);    
 
     buf[0] = count;
     i2c_bus.write(slave_address, buf, 1);
@@ -165,18 +159,12 @@
     LED.writeInt(-150 + count, 3);    //suppress leading zero
     
     adc_dac.write(count);                 // write D/A value
-//    pc.printf("md=0x%02X ", adc_dac._mode);
-
-//812 BUG: seems a delay is needed between write DAC and read ADC or ADC results are unstable, DAC values leaking through...    
-//The Heartbeat Interrupt also seems to make the problem worse
-//    wait_ms(25);        
 
 //    analog = adc_dac.read(PCF8591_ADC0);  // read A/D value for Channel 0 (LDR)
     analog = adc_dac.read(PCF8591_ADC1);  // read A/D value for Channel 1 (potmeter)   
-//    pc.printf("ma=0x%02X ", adc_dac._mode);    
     pc.printf("%d ", analog);        
-    
+   
   }
   
-  //pc.printf("Bye World!\n\r");   
+//  pc.printf("Bye World!\n\r");   
 }