Jump to content

koumember

Members
  • Content Count

    7
  • Joined

  • Last visited

  1. ? connect tp1(5v) resistor then serial to Drain(d203s) and a condansator Drain(d203s) to gnd;;after a resistor Source(d203s) to gnd,Source(d203s) to P1.7(for to adc);;Ground(d203s) to gnd;;finally board gnd to msp gnd;;but my motion sensor detect very closely,how ? can improve distance to detection???please help me!!!! my code #include // Header file for this device #include // Intrinsic functions #include void main (void) { WDTCTL = WDTPW | WDTHOLD; P1DIR =0x01; P1OUT=0x00; int c,b,a=15; ADC10CTL0 = SREF_0 | ADC10SHT_2 | ADC10ON; ADC10CTL1 = INCH_7 | SHS_0 | ADC10DIV_0 | ADC10SSEL_0 | CONSEQ_0; ADC10AE0 = BIT7; ADC10CTL0_bit.ENC = 1; for (; { ADC10CTL0_bit.ADC10SC = 1; while (ADC10CTL1_bit.ADC10BUSY == 1) { } c=ADC10MEM; a=154; b=c-a; abs(; if(b>5) P1OUT=0x01; else P1OUT=0x00; } }
  2. how ? connect msp430launchpad and p?r sensor?can you help me about circuit?
  3. ? have this code #include #define LED_OUT BIT0 // Bit location for LED #define SENSOR_PWR BIT7 // Bit location for power to sensor #define THRESHOLD 50 // Threshold for motion static unsigned int result_old = 0; // Storage for last conversion char LED_ENABLE = 1; // LED control void main(void) { WDTCTL = WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL; // ACLK/32768, int timer: ~10s BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz DCOCTL = CALDCO_1MHZ; BCSCTL1 |= DIVA_2; // ACLK = VLO/4 BCSCTL3 |= LFXT1S_2; P1OUT = 0x10; // P1OUTs P1SEL = 0x08; // Select VREF function P1DIR = 0xEF; // Unused pins as outputs P1REN |= 0x10; // P1.4 pullup P1IE |= 0x10; // P1.4 interrupt enabled P1IES |= 0x10; // P1.4 Hi/lo edge P1IFG &= ~0x10; // P1.4 IFG cleared P2OUT = 0x00 + SENSOR_PWR; // P2OUTs P2SEL &= ~SENSOR_PWR; // P2.7 = GPIO P2DIR = 0xff; // Unused pins as outputs SD16CTL = SD16VMIDON + SD16REFON + SD16SSEL_1;// 1.2V ref, SMCLK SD16INCTL0 = SD16GAIN_4 + SD16INCH_4; // PGA = 4x, Diff inputs A4- & A4+ SD16CCTL0 = SD16SNGL + SD16IE; // Single conversion, 256OSR, Int enable SD16CTL &= ~SD16VMIDON; // VMID off: used to settle ref cap SD16AE = SD16AE1 + SD16AE2; // P1.1 & P1.2: A4+/- SD16_A inputs // Wait for PIR sensor to settle: 1st WDT+ interval P1SEL |= LED_OUT; // Turn LED on with ACLK (for low Icc) while(!(IFG1 & WDTIFG)); // ~5.4s delay: PIR sensor settling P1SEL &= ~LED_OUT; // Turn LED off with ACLK (for low Icc) // Reconfig WDT+ for normal operation: interval of ~341msec WDTCTL = WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1;// ACLK/512, int timer: 341msec BCSCTL1 |= DIVA_3; // ACLK = VLO/8 IE1 |= WDTIE; // Enable WDT interrupt _BIS_SR(LPM3_bits + GIE); // Enter LPM3 with interrupts } /****************************************************** // SD16_A interrupt service routine ******************************************************/ #pragma vector = SD16_VECTOR __interrupt void SD16ISR(void) { unsigned int result_new; SD16CTL &= ~SD16REFON; // Turn off SD16_A ref result_new = SD16MEM0; // Save result (clears IFG) if (result_new > result_old) // Get difference between samples result_old = result_new - result_old; else result_old = result_old - result_new; if (result_old > THRESHOLD) // If motion detected... if (LED_ENABLE & 0x01) P1OUT |= LED_OUT; // Turn LED on result_old = SD16MEM0; // Save last conversion __bis_SR_register_on_exit(SCG1+SCG0); // Return to LPM3 after reti } /****************************************************** // Watchdog Timer interrupt service routine ******************************************************/ #pragma vector=WDT_VECTOR __interrupt void watchdog_timer(void) { if (!(P1OUT & LED_OUT)) // Has motion already been detected? { SD16CTL |= SD16REFON; // If no, turn on SD16_A ref SD16CCTL0 |= SD16SC; // Set bit to start new conversion __bic_SR_register_on_exit(SCG1+SCG0); // Keep DCO & SMCLK on after reti } else P1OUT &= ~LED_OUT; // If yes, turn off LED, measure on next loop } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { LED_ENABLE ^= 0x01; // Toggle LED enable for current measurement P1IFG &= ~0x10; // P1.4 IFG cleared } but ? dont convert this code for using launchpad.this code convert analog sinyal to 16bit but launcpad has 10bit ADC so ? dont know enough knowledge adc conversion.? am trying to convert this code using to launchpad, also ? would be glad if you help me.
  4. ? found Rs=R2=100k,R1=1k and C1=100nF,C2=10uF values ,is it right ?
  5. and msp430launchpad dont have negative adc input so how ? solve this problem
  6. ? find a hardware design about this project but ? didnt solve resistors and capacitor values(http://coecsl.ece.illinois.edu/ge423/datasheets/MSP430Ref_Guides/motion2013/slaa283.pdf)(fig.1)
  7. my project is motion detection using p?r sensor(D203B etc.) with msp430launcpad.but ? dont have any knowledge this subject.? would like you to help my project.for example how to connect launcpad and p?r sensor,its code.? am waiting your answers.thanks
×
×
  • Create New...