Fabien Lepoutre
/
Programme_Test
Test carte
Embed:
(wiki syntax)
Show/hide line numbers
LibTest.cpp
00001 #include <LibTest.h> 00002 00003 00004 AnalogIn In15(p15); 00005 AnalogIn In16(p16); 00006 AnalogIn In17(p17); 00007 AnalogOut Out18(p18); 00008 AnalogIn In19(p19); 00009 AnalogIn In20(p20); 00010 00011 int i_IntroTest(){ 00012 int choix; 00013 pc.printf("\n\n\r Programme de test \n\n\r"); 00014 pc.printf("Selectionner le test a effectuer: \n\r"); 00015 pc.printf("1. CAN / CNA \n\r"); 00016 00017 pc.printf("Choix : "); 00018 pc.scanf("%d", &choix); 00019 pc.printf("%d \n \r", choix); 00020 00021 00022 return choix; 00023 } 00024 00025 void v_TestCAN_CNA(){ 00026 char char1 = 0; 00027 float val=1; 00028 int aff = 0; 00029 pc.printf("\033[2J"); 00030 pc.printf("\033[H"); 00031 00032 while(char1 != 'q'){ 00033 00034 00035 pc.printf("valeur testee = %f : \n\r", val); 00036 00037 int result = i_TestPorts(val, aff); 00038 aff =0; 00039 if((result == 6)&&val<3.3){ 00040 pc.printf("Il y a %d ports defaillants et V < 3,3V => Probleme sur Port Analog Out ", result); 00041 } 00042 00043 pc.printf("Continuer? y / q voir valeur des ports : v \r\n"); 00044 char1 = pc.getc(); 00045 if(char1 == 'v'){ 00046 aff = 1; 00047 } 00048 00049 val = val + 0.2; 00050 if(val >= 3.3){ 00051 val = 0; 00052 } 00053 00054 pc.printf("\033[2J"); 00055 pc.printf("\033[H"); 00056 00057 } 00058 } 00059 00060 00061 int i_TestPorts(float val, int aff){ 00062 int ret = 0; 00063 val = val/3.3; 00064 Out18 = val; 00065 00066 printf("Compte rendu du test : \r\n"); 00067 if((In15.read() < (val-0.01))||(In15 > val + 0.01)){ 00068 printf("Port p15 inexact \n\r"); 00069 ret ++; 00070 } 00071 if((In16.read() < (val-0.01))||(In16 > val + 0.01)){ 00072 printf("Port p16 inexact \n\r"); 00073 ret ++; 00074 } 00075 00076 if((In17.read() < (val-0.01))||(In17 > val + 0.01)){ 00077 printf("Port p17 inexact \n\r"); 00078 ret ++; 00079 } 00080 00081 if((Out18.read() < (val-0.01))||(Out18.read() > val + 0.01)){ 00082 printf("Port p18 inexact \n\r"); 00083 ret ++; 00084 } 00085 00086 if((In19.read() < (val-0.01))||(In19 > val + 0.01)){ 00087 printf("Port p19 inexact \n\r"); 00088 ret ++; 00089 } 00090 00091 if((In20.read() < (val-0.01))||(In20 > val + 0.01)){ 00092 printf("Port p20 inexact \n\r"); 00093 ret ++; 00094 } 00095 if(aff ==1){ 00096 printf("p15 = %f, \r\n", In15.read()*3.3); 00097 printf("p16 = %f, \r\n", In16.read()*3.3); 00098 printf("p17 = %f, \r\n", In17.read()*3.3); 00099 printf("p18 = %f, \r\n", Out18.read()*3.3); 00100 printf("p19 = %f, \r\n", In19.read()*3.3); 00101 printf("p20 = %f, \r\n", In20.read()*3.3); 00102 } 00103 00104 return ret; 00105 00106 }
Generated on Tue Jul 12 2022 20:38:48 by 1.7.2