Operating range: –50 to +300 mmHg
Excitation voltage: 2 to 10 V DC
Sensitivity (full range): 5 µV/V/mmHg
So, If my excitation voltage is 5V DC then I get
5uV * 5 = 25uV for 5V and it is equal to 1 mmHg?
If yes, then range is -50 to 300 mmHg = 350
So, 25uV * 350 = 8750 uV = 8.75mV?
So, I need to amplify this value to 5V for ADC input?
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 // LCD module connections sbit LCD_RS at LATB4_bit; sbit LCD_EN at LATB5_bit; sbit LCD_D4 at LATB0_bit; sbit LCD_D5 at LATB1_bit; sbit LCD_D6 at LATB2_bit; sbit LCD_D7 at LATB3_bit; sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Direction at TRISB5_bit; sbit LCD_D4_Direction at TRISB0_bit; sbit LCD_D5_Direction at TRISB1_bit; sbit LCD_D6_Direction at TRISB2_bit; sbit LCD_D7_Direction at TRISB3_bit; // End LCD module connections sbit Read_Blood_Pressure_Switch at RC0_bit; sbit Read_Blood_Pressure_Switch_Direction at TRISC0_bit; sbit GO_DONE_bit at ADCON0.B1; //#define BASIC_TEST #ifndef BASIC_TEST #define FULL_TEST #endif #define Blood_Pressure_Threshold 246.00 #define Max_BP_Transducer_Output_Voltage 2.50 #define Max_OpAmp_Output_Voltage 5.00 #define Max_BP_Reading_In_mmHg 250.00 #define ADC_Resolution 1023.0 #define DAC_Resolution 1023.0 typedef struct { unsigned int rawAdcValue; unsigned int oldRawAdcValue; double bpValueInMmHg; double bpTransducerOutputVoltage; unsigned int maxAdcReading; unsigned int oldMaxAdcReading; }ADC_TYPE; typedef struct { unsigned int dacValue; }DAC_TYPE; typedef struct { unsigned int timer1ReloadValue; unsigned int oldTimer1ReloadValue; }TIMER1_TYPE; typedef struct { unsigned int timer3ReloadValue; unsigned int oldTimer2ReloadValue; }TIMER3_TYPE; typedef struct { ADC_TYPE adc; DAC_TYPE dac; TIMER1_TYPE timer1; TIMER3_TYPE timer3; }BLOOD_PRESSURE_MONITOR_TYPE; BLOOD_PRESSURE_MONITOR_TYPE bpMonitor; unsigned char flagReg = 0; char txt[23]; sbit readBloodPressure at flagReg.B0; sbit toggleDacOutput at flagReg.B1; const code char txt1[] = " BP Monitor "; const code char txt2[] = "BP: "; const code char txt3[] = "SV: "; //Timer1 //Prescaler 1:1; TMR1 Preload = 55536; Actual Interrupt Time : 5 ms void InitTimer1() { T1CON = 0x00; TMR1IF_bit = 0; TMR1H = 0x00; TMR1L = 0x00; TMR1IE_bit = 1; } //Timer3 //Prescaler 1:1; TMR3 Preload = 65336; Actual Interrupt Time : 100 us void InitTimer3() { T3CON = 0x00; TMR3IF_bit = 0; TMR3H = 0xFF; TMR3L = 0x38; TMR3IE_bit = 1; } long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } void interrupt() { if((ADIE_bit) && (ADIF_bit)) { ADIF_bit = 0; bpMonitor.adc.rawAdcValue = (unsigned int)(ADRESH << 8) + ADRESL; if(bpMonitor.adc.oldMaxAdcReading < bpMonitor.adc.rawAdcValue) { bpMonitor.adc.oldMaxAdcReading = bpMonitor.adc.rawAdcValue; } if(bpMonitor.adc.rawAdcValue <= Blood_Pressure_Threshold) { if(toggleDacOutput == 0) { bpMonitor.dac.dacValue = (unsigned int)map((long)bpMonitor.adc.rawAdcValue, 0, 246, 1023, 0); bpMonitor.timer1.timer1ReloadValue = (unsigned int)map((long)bpMonitor.adc.rawAdcValue, 0, 246, 15536, 55536); bpMonitor.timer3.timer3ReloadValue = (unsigned int)map((long)bpMonitor.adc.rawAdcValue, 0, 246, 61536, 65336); } if(bpMonitor.timer1.timer1ReloadValue != bpMonitor.timer1.oldTimer1ReloadValue) { bpMonitor.timer1.oldTimer1ReloadValue = bpMonitor.timer1.timer1ReloadValue; if(TMR1ON_bit == 0) { TMR1H = 0xFE; TMR1L = 0xFF; TMR1ON_bit = 1; } } } } if((TMR1IE_bit) && (TMR1IF_bit)) { TMR1IF_bit = 0; TMR1H = bpMonitor.timer1.timer1ReloadValue >> 8; TMR1L = bpMonitor.timer1.timer1ReloadValue; toggleDacOutput = ~toggleDacOutput; if(toggleDacOutput) { DAC1REFH = bpMonitor.dac.dacValue >> 8; DAC1REFL = bpMonitor.dac.dacValue; TMR3H = bpMonitor.timer3.timer3ReloadValue >> 8; TMR3L = bpMonitor.timer3.timer3ReloadValue; DAC1LD_bit = 1; TMR3ON_bit = 1; } GO_DONE_bit = 1; } if((TMR3IE_bit) && (TMR3IF_bit)) { TMR3IF_bit = 0; TMR3ON_bit = 0; DAC1REFH = 0; DAC1REFL = 0; DAC1LD_bit = 1; } } // copy const to ram string char *CopyConst2Ram(char *dest, const code char *src) { char *d; d = dest; for(;*dest++ = *src++;); return d; } void initailizePorts() { TRISA = 0x37; TRISB = 0x00; TRISC = 0x21; TRISD = 0x00; TRISE = 0x00; PORTA = 0x00; PORTB = 0x00; PORTC = 0x00; PORTD = 0x00; PORTE = 0x00; LATA = 0x00; LATB = 0x00; LATC = 0x00; LATD = 0x00; LATE = 0x00; ODCONA = 0x00; ODCONB = 0x00; ODCONC = 0x00; ODCOND = 0x00; ODCONE = 0x00; WPUA = 0x00; WPUB = 0x00; WPUC = 0x01; WPUD = 0x00; WPUE = 0x00; HIDRVB = 0x00; SLRCONA = 0x00; SLRCONB = 0x00; SLRCONC = 0x00; SLRCOND = 0x00; SLRCONE = 0x00; } void initailizeADC() { ANSELA = 0x37; ANSELB = 0x00; ANSELC = 0x60; ANSELD = 0x00; ANSELE = 0x00; ADCON0 = 0x00; ADCON1 = 0b11010000; ADCON2 = 0x00; } void initailizeDAC() { FVRCON = 0x00; DAC1CON0 = 0xA0; DAC1REFH = 0x00; DAC1REFL = 0x00; DAC1OE1_bit = 1; DAC1LD_bit = 1; } void initailizeOPAMP() { OPA1CON = 0x80; OPA1ORS = 0x00; OPA1NCHS = 0x00; OPA1PCHS = 0x00; OPA3CON = 0x90; OPA3ORS = 0x00; OPA3NCHS = 0x00; OPA3PCHS = 0x00; } void initializeVariables() { bpMonitor.adc.rawAdcValue = 0; bpMonitor.adc.oldRawAdcValue = 0; bpMonitor.adc.bpValueInMmHg = 0.0; bpMonitor.adc.maxAdcReading = 0; bpMonitor.adc.oldMaxAdcReading = 0; bpMonitor.adc.bpTransducerOutputVoltage = 0.0; } void main() { OSCCON = 0x73; OSCSTAT = 0x11; OSCTUNE = 0x00; initailizePorts(); initailizeADC(); initailizeDAC(); initailizeOPAMP(); initializeVariables(); Delay_ms(200); Lcd_Init(); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1,1,CopyConst2Ram(txt,txt1)); Lcd_Out(2,1,CopyConst2Ram(txt,txt2)); Lcd_Out(2,9,CopyConst2Ram(txt,txt3)); Sound_Init(&PORTC, 2); Sound_Play(800,800); ADIF_bit = 0; ADIE_bit = 0; ADON_bit = 1; while(1) { if(/*(bpMonitor.adc.oldRawAdcValue != bpMonitor.adc.rawAdcValue) && */(bpMonitor.adc.rawAdcValue < bpMonitor.adc.oldMaxAdcReading)) { bpMonitor.adc.bpValueInMmHg = (double)bpMonitor.adc.oldMaxAdcReading * Max_BP_Reading_In_mmHg / ADC_Resolution; bpMonitor.adc.bpTransducerOutputVoltage = (double)bpMonitor.adc.oldMaxAdcReading * Max_BP_Transducer_Output_Voltage / ADC_Resolution; sprintf(txt, "%3.0f", bpMonitor.adc.bpValueInMmHg); Ltrim(txt); Rtrim(txt); strcat(txt," "); Lcd_Out(2,5,txt); sprintf(txt, "%5.2f", bpMonitor.adc.bpTransducerOutputVoltage); Ltrim(txt); Rtrim(txt); strcat(txt," "); Lcd_Out(2,13,txt); bpMonitor.adc.oldMaxAdcReading = 0; bpMonitor.adc.oldRawAdcValue = bpMonitor.adc.rawAdcValue; } if(Read_Blood_Pressure_Switch == 0) { Delay_ms(50); while(Read_Blood_Pressure_Switch == 0); toggleDacOutput = 0; ADIF_bit = 0; ADIE_bit = ~ADIE_bit; if(ADIE_bit) { InitTimer1(); InitTimer3(); PEIE_bit = 1; GIE_bit = 1; GO_DONE_bit = 1; } else { PEIE_bit = 0; GIE_bit = 0; GO_DONE_bit = 0; TMR1ON_bit = 0; TMR3ON_bit = 0; DAC1REFH = 0; DAC1REFL = 0; DAC1LD_bit = 1; } } } }
#define Blood_Pressure_Threshold 246.00
#define Blood_Pressure_Threshold 246.00
#define Max_BP_Transducer_Output_Voltage 2.50
#define Max_OpAmp_Output_Voltage 5.00
#define Max_BP_Reading_In_mmHg 250.00
#define ADC_Resolution 1023.0
#define DAC_Resolution 1023.0
if(bpMonitor.adc.rawAdcValue <= Blood_Pressure_Threshold) {
if(toggleDacOutput == 0) {
bpMonitor.dac.dacValue = (unsigned int)map((long)bpMonitor.adc.rawAdcValue, 0, 246, 1023, 113);
The ammount of produced heat will not be less when you connect two 7805 in parallel.Two 7805's are used because LCD backlight draws more current and if single is used it will heat up.
I expectThe Stimulator circuit posted gives -18V to +18V Bi-Polar signal when DAC output is 5V currently.
I don´t understand this.0 to 60 mmHg BP = 0 to 246 raw adc value = +/-18V to +/-2V Bi-Polar signal is the requirement (How should I change the circuit for this?)
Hi,
The ammount of produced heat will not be less when you connect two 7805 in parallel.
And if you claim that 7805 will get hot, then - according your circuit - 7818 and 7809 will dissipate more power (generate more heat) than one (or two) 7805.
--> in my eyes it makes no sense.
I expect
* close to -18V ouput at 0V input
* close to +18V output when 5V input
so far so good...
* but it will be
* -18V for every DAC ouput from 0V ... 2.5V
* +18V for every DAC output from 2.5V ... 5V
I don´t understand this.
What about a hand drawn sketch?
Klaus
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?