external delay reference PIC10F202

Discussion in 'Programmer's Corner' started by praondevou, Jan 26, 2012.

  1. praondevou

    Thread Starter AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    I use a PIC10F202 to generate a 10us pulse every 25ms (at GP0). This pulse is fed to a US-sensor (Ultrasonic). I get a pulse signal from the sensor whose width corresponds to the distance to an obstacle. (goes to GP1)
    The response signal is positive logic. When the response signal is shorter than 5ms for a certain time (250ms) I set GP2, when it's longer than 5ms for a few seconds I reset GP2.

    I wrote a code in Assembler that compares the response signal pulse width to a fixed time (about 5ms). This works as intended.

    Now my question:
    I would like to externally be able to adjust the 5ms reference from 1ms to 10ms. The only way I see is to trigger a monostable (e.g. 555) after each pulse of GP0, feed the output of the monostable to GP3 and check the state of the US-sensor (GP1) at the falling edge of GP3.

    Is there another way? The 555 is already very simple but can it get simpler than that (less components)?

    Thanks
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    If you upgraded to a PIC10F222 you could put a potentiometer on an analog input to adjust the time.
    There is also some code sample that lets you use a digital pin to measure a resistance by how fast it charges a capacitor, however code space is pretty low on PIC10s. I'll see if I can find it if you want.
     
  3. praondevou

    Thread Starter AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    Nice idea, that means it needs to be schmitt trigger input right? Would be nice if you find more details about that method.

    I want to use what I have at hand, and right now that's the 202.
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I've had a look and the best I could find is near the top of AN234. I'm not sure if it will be good enough, but it might be worth a shot.
     
    praondevou likes this.
Loading...