![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fault final (may be)
Fork of fault_man by
main.cpp@1:cde488f73488, 2014-12-02 (annotated)
- Committer:
- sakthipriya
- Date:
- Tue Dec 02 07:25:23 2014 +0000
- Revision:
- 1:cde488f73488
- Parent:
- 0:e5e97851bbd6
- Child:
- 2:12445d744dfd
fault
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sakthipriya | 0:e5e97851bbd6 | 1 | #include "mbed.h" |
sakthipriya | 0:e5e97851bbd6 | 2 | #include "rtos.h" |
sakthipriya | 0:e5e97851bbd6 | 3 | |
sakthipriya | 0:e5e97851bbd6 | 4 | #define FAULT1 D0 |
sakthipriya | 0:e5e97851bbd6 | 5 | #define FAULT2 D1 |
sakthipriya | 0:e5e97851bbd6 | 6 | #define FAULT3 D2 |
sakthipriya | 0:e5e97851bbd6 | 7 | #define FAULT4 D3 |
sakthipriya | 0:e5e97851bbd6 | 8 | #define FAULT5 D4 |
sakthipriya | 0:e5e97851bbd6 | 9 | #define FAULT6 D5 |
sakthipriya | 0:e5e97851bbd6 | 10 | #define FAULT7 D6 |
sakthipriya | 0:e5e97851bbd6 | 11 | #define FAULT8 D7 |
sakthipriya | 0:e5e97851bbd6 | 12 | |
sakthipriya | 0:e5e97851bbd6 | 13 | #define FAULT_CLEAR1 D8 |
sakthipriya | 1:cde488f73488 | 14 | #define FAULT_CLEAR2 D9 |
sakthipriya | 1:cde488f73488 | 15 | #define FAULT_CLEAR3 D10 |
sakthipriya | 1:cde488f73488 | 16 | #define FAULT_CLEAR4 D11 |
sakthipriya | 1:cde488f73488 | 17 | #define FAULT_CLEAR5 D12 |
sakthipriya | 1:cde488f73488 | 18 | #define FAULT_CLEAR6 D13 |
sakthipriya | 1:cde488f73488 | 19 | #define FAULT_CLEAR7 PTC10 |
sakthipriya | 1:cde488f73488 | 20 | #define FAULT_CLEAR8 PTC11 |
sakthipriya | 0:e5e97851bbd6 | 21 | |
sakthipriya | 1:cde488f73488 | 22 | Serial pc(USBTX,USBRX); |
sakthipriya | 0:e5e97851bbd6 | 23 | |
sakthipriya | 0:e5e97851bbd6 | 24 | DigitalIn fault1(FAULT1); |
sakthipriya | 0:e5e97851bbd6 | 25 | DigitalIn fault2(FAULT2); |
sakthipriya | 0:e5e97851bbd6 | 26 | DigitalIn fault3(FAULT3); |
sakthipriya | 0:e5e97851bbd6 | 27 | DigitalIn fault4(FAULT4); |
sakthipriya | 0:e5e97851bbd6 | 28 | DigitalIn fault5(FAULT5); |
sakthipriya | 0:e5e97851bbd6 | 29 | DigitalIn fault6(FAULT6); |
sakthipriya | 0:e5e97851bbd6 | 30 | DigitalIn fault7(FAULT7); |
sakthipriya | 0:e5e97851bbd6 | 31 | DigitalIn fault8(FAULT8); |
sakthipriya | 0:e5e97851bbd6 | 32 | |
sakthipriya | 0:e5e97851bbd6 | 33 | |
sakthipriya | 0:e5e97851bbd6 | 34 | DigitalOut clear1(FAULT_CLEAR1); |
sakthipriya | 0:e5e97851bbd6 | 35 | DigitalOut clear2(FAULT_CLEAR2); |
sakthipriya | 0:e5e97851bbd6 | 36 | DigitalOut clear3(FAULT_CLEAR3); |
sakthipriya | 0:e5e97851bbd6 | 37 | DigitalOut clear4(FAULT_CLEAR4); |
sakthipriya | 0:e5e97851bbd6 | 38 | DigitalOut clear5(FAULT_CLEAR5); |
sakthipriya | 0:e5e97851bbd6 | 39 | DigitalOut clear6(FAULT_CLEAR6); |
sakthipriya | 0:e5e97851bbd6 | 40 | DigitalOut clear7(FAULT_CLEAR7); |
sakthipriya | 0:e5e97851bbd6 | 41 | DigitalOut clear8(FAULT_CLEAR8); |
sakthipriya | 0:e5e97851bbd6 | 42 | |
sakthipriya | 1:cde488f73488 | 43 | /*bool fault1 = 0; |
sakthipriya | 1:cde488f73488 | 44 | bool fault2 = 0; |
sakthipriya | 1:cde488f73488 | 45 | bool fault3 = 0; |
sakthipriya | 1:cde488f73488 | 46 | bool fault4 = 0; |
sakthipriya | 1:cde488f73488 | 47 | bool fault5 = 0; |
sakthipriya | 1:cde488f73488 | 48 | bool fault6 = 0; |
sakthipriya | 1:cde488f73488 | 49 | bool fault7 = 0; |
sakthipriya | 1:cde488f73488 | 50 | bool fault8 = 0; */ |
sakthipriya | 1:cde488f73488 | 51 | |
sakthipriya | 0:e5e97851bbd6 | 52 | |
sakthipriya | 0:e5e97851bbd6 | 53 | void FAULTS(void const *args) |
sakthipriya | 0:e5e97851bbd6 | 54 | { |
sakthipriya | 0:e5e97851bbd6 | 55 | while(1) |
sakthipriya | 0:e5e97851bbd6 | 56 | { |
sakthipriya | 1:cde488f73488 | 57 | Thread :: signal_wait(0x1); |
sakthipriya | 1:cde488f73488 | 58 | printf("\nEntered fault thred\n"); |
sakthipriya | 1:cde488f73488 | 59 | //if(fault1 == 0) |
sakthipriya | 1:cde488f73488 | 60 | { clear1 = !fault1; } |
sakthipriya | 1:cde488f73488 | 61 | //if(fault2 == 0) |
sakthipriya | 1:cde488f73488 | 62 | { clear2 = !fault2; } |
sakthipriya | 1:cde488f73488 | 63 | //if(fault3 == 0) |
sakthipriya | 1:cde488f73488 | 64 | { clear3 = !fault3; } |
sakthipriya | 1:cde488f73488 | 65 | //if(fault4 == 0) |
sakthipriya | 1:cde488f73488 | 66 | { clear4 = !fault4; } |
sakthipriya | 1:cde488f73488 | 67 | //if(fault5 == 0) |
sakthipriya | 1:cde488f73488 | 68 | { clear5 = !fault5; } |
sakthipriya | 1:cde488f73488 | 69 | //if(fault6 == 0) |
sakthipriya | 1:cde488f73488 | 70 | { clear6 = !fault6; } |
sakthipriya | 1:cde488f73488 | 71 | //if(fault7 == 0) |
sakthipriya | 1:cde488f73488 | 72 | { clear7 = !fault7; } |
sakthipriya | 1:cde488f73488 | 73 | //if(fault8 == 0) |
sakthipriya | 1:cde488f73488 | 74 | { clear8 = !fault8; } |
sakthipriya | 0:e5e97851bbd6 | 75 | |
sakthipriya | 0:e5e97851bbd6 | 76 | } |
sakthipriya | 0:e5e97851bbd6 | 77 | } |
sakthipriya | 1:cde488f73488 | 78 | |
sakthipriya | 1:cde488f73488 | 79 | //void faults_2_cdms(void const *args) |
sakthipriya | 1:cde488f73488 | 80 | //{ |
sakthipriya | 1:cde488f73488 | 81 | int main() |
sakthipriya | 1:cde488f73488 | 82 | { |
sakthipriya | 1:cde488f73488 | 83 | |
sakthipriya | 1:cde488f73488 | 84 | Thread f1(FAULTS, (void *) "faults"); |
sakthipriya | 1:cde488f73488 | 85 | while(1) |
sakthipriya | 1:cde488f73488 | 86 | { |
sakthipriya | 1:cde488f73488 | 87 | //Thread :: wait(5000); |
sakthipriya | 1:cde488f73488 | 88 | f1.signal_set(0x1); |
sakthipriya | 1:cde488f73488 | 89 | |
sakthipriya | 1:cde488f73488 | 90 | //printf(" %d %d %d %d %d %d %d %d \n",clear1,clear2,clear3,clear4,clear5,clear6,clear7,clear8); |
sakthipriya | 1:cde488f73488 | 91 | |
sakthipriya | 1:cde488f73488 | 92 | } |
sakthipriya | 1:cde488f73488 | 93 | } |