khalid el horri
/
nucleo_F746ZG_TDC502_port_programm_test
programme tdc502
main.cpp@0:893cddb940f0, 2017-05-16 (annotated)
- Committer:
- schnf30
- Date:
- Tue May 16 09:56:45 2017 +0000
- Revision:
- 0:893cddb940f0
- Child:
- 1:346b69769c2e
Nucleo F746ZG exemple et driver Port fot TDC502
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
schnf30 | 0:893cddb940f0 | 1 | #include "mbed.h" |
schnf30 | 0:893cddb940f0 | 2 | #include "TDC502.h" |
schnf30 | 0:893cddb940f0 | 3 | Serial pc(USBTX,USBRX); |
schnf30 | 0:893cddb940f0 | 4 | |
schnf30 | 0:893cddb940f0 | 5 | DigitalOut ale(PE_0,1); |
schnf30 | 0:893cddb940f0 | 6 | TDC502 tdc502(PortD, 0x00FF, //PD_7, PD_6, PD_5, PD_4, PD_3, PD_2, PD_1, PD_0, DataD7 - D0 |
schnf30 | 0:893cddb940f0 | 7 | PortA, 0x00F0, //PA_7,PA_6,PA_5,PA_4, adresse AD3 à AD0 |
schnf30 | 0:893cddb940f0 | 8 | |
schnf30 | 0:893cddb940f0 | 9 | PD_11,PD_12,PD_13, // rdn wrn csn |
schnf30 | 0:893cddb940f0 | 10 | PE_2, PA_0 ); // INTFLAG TDC_READY |
schnf30 | 0:893cddb940f0 | 11 | int main() |
schnf30 | 0:893cddb940f0 | 12 | { |
schnf30 | 0:893cddb940f0 | 13 | |
schnf30 | 0:893cddb940f0 | 14 | pc.baud(115200); |
schnf30 | 0:893cddb940f0 | 15 | tdc502.TestPerformanceWrite(); |
schnf30 | 0:893cddb940f0 | 16 | tdc502.TestPerformanceRead(); |
schnf30 | 0:893cddb940f0 | 17 | tdc502.init(); |
schnf30 | 0:893cddb940f0 | 18 | tdc502.ReadAllRegister(); |
schnf30 | 0:893cddb940f0 | 19 | tdc502.StartMesure(); |
schnf30 | 0:893cddb940f0 | 20 | while(1) |
schnf30 | 0:893cddb940f0 | 21 | if (tdc502.data_ready()) { |
schnf30 | 0:893cddb940f0 | 22 | tdc502.ReadData(); |
schnf30 | 0:893cddb940f0 | 23 | wait(10.0); |
schnf30 | 0:893cddb940f0 | 24 | tdc502.StartMesure(); |
schnf30 | 0:893cddb940f0 | 25 | } |
schnf30 | 0:893cddb940f0 | 26 | } |