Announcement

Collapse
No announcement yet.

Picaxe for detectors?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Picaxe for detectors?

    Does anybody know whether a picaxe running at 16Mhz will provide accurate 50us timing pulses. The pauseus command is supposed to allow microsecond use but the instruction rate can be as long as 100 - 200us per command?
    The Arduino nano detector (thanks George) certainly copes well with these pulse widths but maybe the nano is much more efficient or the programming real clever?
    Perhaps I should try a picaxe loop program of typical pulses and check the results on an Oscope but I thought someone may have tried in the past.

  • #2
    Never worked with a Picaxe, but the code looks very similar to the old Basic Stamp language. I think the picaxe will be fast enough. But you need to use a timer interrupt for your main timing. Goto loops are unpredictable and slow. Turning a pin on or off is fast, but avoid other commands in the interrupt routine, most are slow

    Use this code as a template. Adjust the timer pre-load value to interrupt at about 1000hz

    This is a modified copy of my posting regarding the slow-speed PWM: The routine below calls an interrupt at regular time intervals. The period can be modified by changing the EVENTS_PER_SEC constant. Overall, no need to use an external chip (555 or the like), this solution has the Picaxe do...


    Then add something like the code below between interrupt and return labels. Change pins B.1-B.3 as needed to match your circuit

    interrupt:
    high B.1 'Tx on
    pauseus 50 'TX width
    low B.1 'Tx off

    pauseus 10 'sample delay

    high B.2 ' Target Sample on
    pauseus 10 'Target sample period
    low B.2 ' Sample off

    pauseus 200 'EF sample delay

    high B.3 ' EF Sample on
    pauseus 10 'EF sample period
    low B.3' EF Sample off
    gosub timer_setup
    return

    Comment

    Working...
    X