test
Dependencies: MINI8I8O5A000 mbed EEPROM_P4 IICLCD_LOWCOST
Diff: main.cpp
- Revision:
- 9:dfb7951e8532
- Parent:
- 8:055a85e600dd
- Child:
- 10:c58ec47d206c
diff -r 055a85e600dd -r dfb7951e8532 main.cpp --- a/main.cpp Tue Oct 11 02:46:12 2016 +0000 +++ b/main.cpp Wed Oct 12 10:53:48 2016 +0000 @@ -336,9 +336,9 @@ int main() { - + int i=0; - + OUT1=0; LiquidCrystal_I2C_SETUP(0x27,20,4); LiquidCrystal_I2Cinit(); @@ -348,7 +348,7 @@ sprintf (str, " SCHAFFNER "); LCDI2C4Bit_printIn(str); LiquidCrystal_I2CsetCursor(0,0); - sprintf (str, "SerailDIO v:%.2f ",1.00) ; + sprintf (str, "SerailVIS v:%.2f ",1.01) ; LCDI2C4Bit_printIn(str); #ifdef USBSerialOption @@ -370,10 +370,125 @@ #define BUZZER_EN 0 +// while(1); + +#define MANUAL_RUNEANABLE + +#ifdef MANUAL_RUNEANABLE +CAMTRIGGER=1; // set signal ready for cam trigger +float analog= 0; +float analogPG=0; -CAMTRIGGER=1; // set signal ready for cam trigger -while(1); +load_eeprom(); +while(1) +{ + analog=ain0; //read trigger switch ( analog key ) + analogPG=ain1; //read program number by analog switch + + if (eedata[0]==0) + { + PRGLINE3=PRG_OFF;PRGLINE2=PRG_OFF; PRGLINE1=PRG_OFF; PRGLINE0=PRG_OFF; + LiquidCrystal_I2CsetCursor(0,1); + //sprintf (str, "an:%f ",analog); + sprintf (str, "PG0 "); + LCDI2C4Bit_printIn(str); + + //save_eeprom(); + } + else + { + PRGLINE3=PRG_OFF;PRGLINE2=PRG_OFF; PRGLINE1=PRG_OFF; PRGLINE0=PRG_ON; + LiquidCrystal_I2CsetCursor(0,1); + // sprintf (str, "an:%f ",analog); + sprintf (str, "PG1 "); + LCDI2C4Bit_printIn(str); + } + +if (IN4==0) +{ + if (eedata[0]==0) + { + eedata[0]=1; + } + else + { + eedata[0]=0; + } + save_eeprom(); + while(IN4==0); + wait(0.5); + +} + +if (analog<0.6) +{ + //++++++++++++++++++++++++++++++++++++++++ + //pulse trigger + CAMTRIGGER=0; //edge trigger + i=0; + while(1) //wait camera run busy + { + Input_sampling(8); + if(CAMBUSY!=0) break; + if (i++>IDELBUSYLOOP) + { + CAMERROR=1; + break; + } + } + //cmaera process run + CAMTRIGGER=1; //edge trigger + i=0; + while(1) //wait camera complete run + { + Input_sampling(8); + if(CAMBUSY==0) break; + if (i++>IDELBUSYLOOP) + { + CAMERROR=1; + break; + } + } + LiquidCrystal_I2CsetCursor(0,0); + sprintf (str, "Trig.. ") ; + LCDI2C4Bit_printIn(str); + + wait(1.0); //wait cam finish process + Input_sampling(8); + if (IN0) // Total result + { + LiquidCrystal_I2CsetCursor(0,0); + sprintf (str, "FAIL.. ") ; + LCDI2C4Bit_printIn(str); + + CAMTOTAL=1; + OUT1=0; + } + else + { + LiquidCrystal_I2CsetCursor(0,0); + sprintf (str, "PASS.. ") ; + LCDI2C4Bit_printIn(str); + + CAMTOTAL=0; + OUT1=1; + wait(1.0); + OUT1=0; + } + + LiquidCrystal_I2Cinit(); + LiquidCrystal_I2Cbacklight(); + LiquidCrystal_I2CsetCursor(0,0); + sprintf (str, "Ready..") ; + LCDI2C4Bit_printIn(str); + + //++++++++++++++++++++++++++++++++ +} +} +#endif + + while(0) {