alj alj / Mbed 2 deprecated CPMG_T2

Dependencies:   mbed

Committer:
alj
Date:
Mon Jan 27 13:55:02 2014 +0000
Revision:
0:6ed68c99564e
Child:
1:b6541b5d9934
Basic version 271214

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alj 0:6ed68c99564e 1 /* *************************************************************************************
alj 0:6ed68c99564e 2 CPMG_T2 Basic standard sequence, VERSION 1, October 22th 2012
alj 0:6ed68c99564e 3 CPMG SPIN ECHO PULSE SEQUENCE FOR T2 MEASURMENT IN NMR SPECTROMETRIE.
alj 0:6ed68c99564e 4 {D1 - P1 - [D2 - P2 - D2]n - FID }NS
alj 0:6ed68c99564e 5 Homonuclear sequence : (p1, P2 --> same channel)
alj 0:6ed68c99564e 6 DESIGN FOR NXPLPC1768 ARM CORTEX M3 MCU BOARD:
alj 0:6ed68c99564e 7 INPUT : NONE (reset on board)
alj 0:6ed68c99564e 8 OUTPUT : ACQU ---> P26 AND LED1
alj 0:6ed68c99564e 9 : PULSES P1 & P2 ---> P25
alj 0:6ed68c99564e 10 : Emmitter ---> P24, P23
alj 0:6ed68c99564e 11 : Transmitter ---> P24, P23
alj 0:6ed68c99564e 12 ***** IN THIS VERSION RECEIVER AND TRANSMITTER HAVE THE SAME PHASE CYCLE *****
alj 0:6ed68c99564e 13 *************************************************************************************
alj 0:6ed68c99564e 14 Alain LOUIS-JOSEPH
alj 0:6ed68c99564e 15 CNRS
alj 0:6ed68c99564e 16 Laboratoire de Physique de la Matière Condensée PMC
alj 0:6ed68c99564e 17 Ecole Polytechnique
alj 0:6ed68c99564e 18 91128 Palaiseau CEDEX France
alj 0:6ed68c99564e 19 *************************************************************************************
alj 0:6ed68c99564e 20 UNLESS OTHERWISE SPECIFIED THE PARAMETERS OF THE PULSE SEQUENCE ARE SET :
alj 0:6ed68c99564e 21 D1 : relaxation delay ( ms to s)
alj 0:6ed68c99564e 22 D2, D3,etc, : fixed delay (ms to s)
alj 0:6ed68c99564e 23 DE : fixed delay before acqusisition
alj 0:6ed68c99564e 24 DW : Dwell time period for sampled t2 acquisition time domain
alj 0:6ed68c99564e 25 D0 : incremenatble delay ( from 1us to s)(t1 time domain dimension for 2D experiment)
alj 0:6ed68c99564e 26 NS : Number of scan
alj 0:6ed68c99564e 27 VD : Variable delay using a file list
alj 0:6ed68c99564e 28 PW : Pulse length (us)
alj 0:6ed68c99564e 29 P90 : 90° transmitter or decoupler pulse length
alj 0:6ed68c99564e 30 P180 : 180° transmitter or decoupler pulse length
alj 0:6ed68c99564e 31 P3 P4 : 90°, 180°, X-nucleus pulses length
alj 0:6ed68c99564e 32 DO : Decoupler gated off or on
alj 0:6ed68c99564e 33 HD : HomoDecoupling in time sharing during acqusition
alj 0:6ed68c99564e 34 HG : HomoGating decoupling with receiver gated OFF
alj 0:6ed68c99564e 35 BB : Broadband modulation gate
alj 0:6ed68c99564e 36 CW : Continuous wave
alj 0:6ed68c99564e 37 FID : Free Induction Decay acquisition (data acquisition for time AQ
alj 0:6ed68c99564e 38 AQ : Acquisition time (physical t2 acquisition time domain dimension)
alj 0:6ed68c99564e 39 PHn : Phase for pulse number n (ie : PH1 for pulse P1)
alj 0:6ed68c99564e 40 PH0 : Receiver phase
alj 0:6ed68c99564e 41 *************************************************************************************
alj 0:6ed68c99564e 42 For CPMG sequence :
alj 0:6ed68c99564e 43 For best SNR, Transmitter Pulse phase PH1 and Acquisition receiver phase (PH0) should follow the standard quadrature phase cycle,
alj 0:6ed68c99564e 44 QP : 0, 0, 180°, 180°, 90°, 90°, 270°,270°
alj 0:6ed68c99564e 45 PH2 phase should be : 90°, 90°, 90°, 90°, 180°, 180°, 180°, 180°
alj 0:6ed68c99564e 46 n must be even
alj 0:6ed68c99564e 47 optimise D2 to eliminate J modulation and/or diffusion effect
alj 0:6ed68c99564e 48 ***** IN THIS VERSION RECEIVER AND TRANSMITTER HAVE THE SAME PHASE CYCLE and are cycled 0°, 90°, 180°, 270°*****
alj 0:6ed68c99564e 49 *************************************************************************************
alj 0:6ed68c99564e 50 */
alj 0:6ed68c99564e 51
alj 0:6ed68c99564e 52
alj 0:6ed68c99564e 53 #include "mbed.h"
alj 0:6ed68c99564e 54
alj 0:6ed68c99564e 55 #define D1 0.0005 /* Relaxation delay in second */
alj 0:6ed68c99564e 56 #define Fs 48000 /* Sample frequency in Hz NOT USE */
alj 0:6ed68c99564e 57 #define DW 1 /* DW time period in us */
alj 0:6ed68c99564e 58 #define NS 8.0 /* 8 accumulations */
alj 0:6ed68c99564e 59 #define D2 0.000010 /* echo delay in ms */
alj 0:6ed68c99564e 60 #define n 1
alj 0:6ed68c99564e 61 #define AQ 0.0005
alj 0:6ed68c99564e 62 #define P90 0.000005
alj 0:6ed68c99564e 63
alj 0:6ed68c99564e 64
alj 0:6ed68c99564e 65
alj 0:6ed68c99564e 66 DigitalOut Relaxation(LED1); /* Delay on pin 26 ??? and flash LED1 during relaxation delay */
alj 0:6ed68c99564e 67 BusOut Acqu(p26, LED2) ; /* */
alj 0:6ed68c99564e 68 DigitalOut p1(p25);
alj 0:6ed68c99564e 69 DigitalOut p2(p25); /* Only for reason of clarity P2 =2*P1 */
alj 0:6ed68c99564e 70 BusOut PH1PH2(p24, p23) ; // transmitter and receiver phases are the same
alj 0:6ed68c99564e 71
alj 0:6ed68c99564e 72 int main()
alj 0:6ed68c99564e 73 {
alj 0:6ed68c99564e 74
alj 0:6ed68c99564e 75 // while (1) {
alj 0:6ed68c99564e 76 p1 =0 ;
alj 0:6ed68c99564e 77 Relaxation = 0 ;
alj 0:6ed68c99564e 78 Acqu=0x00;
alj 0:6ed68c99564e 79 PH1PH2=0x00; //0 init
alj 0:6ed68c99564e 80
alj 0:6ed68c99564e 81 for (float i = 0.0f ; i < NS ; i += 1.0f) {
alj 0:6ed68c99564e 82
alj 0:6ed68c99564e 83 Relaxation = 1; /* LED1 light*/
alj 0:6ed68c99564e 84 wait(D1); // relaxation
alj 0:6ed68c99564e 85 Relaxation = 0; // turn off the led
alj 0:6ed68c99564e 86
alj 0:6ed68c99564e 87
alj 0:6ed68c99564e 88 p1=1;
alj 0:6ed68c99564e 89 wait(P90); // 90°
alj 0:6ed68c99564e 90 p1=0;
alj 0:6ed68c99564e 91
alj 0:6ed68c99564e 92 wait(D2); // delay D2
alj 0:6ed68c99564e 93
alj 0:6ed68c99564e 94 p2=1;
alj 0:6ed68c99564e 95 wait(2*P90); //180°
alj 0:6ed68c99564e 96 p2=0;
alj 0:6ed68c99564e 97
alj 0:6ed68c99564e 98 wait(D2); // delay
alj 0:6ed68c99564e 99
alj 0:6ed68c99564e 100 Acqu=0x11; // Acquire FID (we can write 3 in decimal)
alj 0:6ed68c99564e 101 wait(AQ);
alj 0:6ed68c99564e 102 Acqu=0x00;
alj 0:6ed68c99564e 103
alj 0:6ed68c99564e 104 PH1PH2=PH1PH2+1; //Phase cycling
alj 0:6ed68c99564e 105
alj 0:6ed68c99564e 106 }
alj 0:6ed68c99564e 107 //wait(1); //for slow test
alj 0:6ed68c99564e 108 }
alj 0:6ed68c99564e 109 //}
alj 0:6ed68c99564e 110
alj 0:6ed68c99564e 111 /* INCREMENTATION DE LA DUREE D'ECLAIREMENT DE LED1 AVEC PwmOut
alj 0:6ed68c99564e 112 PwmOut led(LED1);
alj 0:6ed68c99564e 113
alj 0:6ed68c99564e 114 int main() {
alj 0:6ed68c99564e 115 while(1) {
alj 0:6ed68c99564e 116 for(float p = 0.0f; p < 1.0f; p += 0.1f) {
alj 0:6ed68c99564e 117 led = p;
alj 0:6ed68c99564e 118 wait(0.1);
alj 0:6ed68c99564e 119 }
alj 0:6ed68c99564e 120 }
alj 0:6ed68c99564e 121 } */
alj 0:6ed68c99564e 122
alj 0:6ed68c99564e 123 /* Digital I/O
alj 0:6ed68c99564e 124
alj 0:6ed68c99564e 125 DigitalOut - Configure and control a digital output pin.
alj 0:6ed68c99564e 126 DigitalIn - Configure and control a digital input pin.
alj 0:6ed68c99564e 127 DigitalInOut - Bi-directional digital pins
alj 0:6ed68c99564e 128
alj 0:6ed68c99564e 129 BusIn - Flexible way to read multiple DigitalIn pins as one value
alj 0:6ed68c99564e 130 BusOut - Flexible way to write multiple DigitalIn pins as one value
alj 0:6ed68c99564e 131 BusInOut - Flexible way to read/write multiple DigitalIn pins as one value
alj 0:6ed68c99564e 132
alj 0:6ed68c99564e 133 PortIn - Fast way to read multiple DigitalIn pins as one value
alj 0:6ed68c99564e 134 PortOut - Fast way to write multiple DigitalIn pins as one value
alj 0:6ed68c99564e 135 PortInOut - Fast way to read/write multiple DigitalIn pins as one value
alj 0:6ed68c99564e 136
alj 0:6ed68c99564e 137 PwmOut - Pulse-width modulated output */
alj 0:6ed68c99564e 138
alj 0:6ed68c99564e 139 /* Features
alj 0:6ed68c99564e 140
alj 0:6ed68c99564e 141 NXP LPC1768 MCU
alj 0:6ed68c99564e 142 High performance ARM® Cortex™-M3 Core
alj 0:6ed68c99564e 143 96MHz, 32KB RAM, 512KB FLASH
alj 0:6ed68c99564e 144 Ethernet, USB Host/Device, 2xSPI, 2xI2C, 3xUART, CAN, 6xPWM, 6xADC, GPIO
alj 0:6ed68c99564e 145 Prototyping form-factor
alj 0:6ed68c99564e 146 40-pin 0.1" pitch DIP package, 54x26mm
alj 0:6ed68c99564e 147 5V USB or 4.5-9V supply
alj 0:6ed68c99564e 148 Built-in USB drag 'n' drop FLASH programmer
alj 0:6ed68c99564e 149 mbed.org Developer Website
alj 0:6ed68c99564e 150 Lightweight Online Compiler
alj 0:6ed68c99564e 151 High level C/C++ SDK
alj 0:6ed68c99564e 152 Cookbook of published libraries and projects
alj 0:6ed68c99564e 153 */