Synchronous pulses


Results 1 to 17 of 17

Threaded View

  1. #14
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    Hey Andrew,

    Once I figure out how to force an address for the toggle array in Swordfish BASIC I suspect my method might look something like this BASIC example, which I hope makes more sense than my previous pseudo C example.

    Kind regards, Mike

    Code:
    Dim Tgl(1024) As Byte                   ' ??? force to $400..$7FF ???
    Dim Pulse(3) As Word
    Dim LastElement As FSR0H.booleans(3)
    '
        Pulse(0) = 3                        ' RB0 pulse, 0..1023 usecs
        Pulse(1) = 11                       ' RB1 pulse, 0..1023 usecs
        Pulse(2) = 12                       ' RB2 pulse, 0..1023 usecs
    '
    '  clear the 1024 element toggle array
    '
        FSR0 = AddressOf(Tgl)               ' indirect for Tgl(0)
        Repeat                              ' clear toggle array
            POSTINC0 = 0                    ' clear 0x400..0x7FF
        Until LastElement                   '
    '
    '  insert 3 output toggle bits into our 1024 interval toggle array
    '
        Tgl(Pulse(0)) = Tgl(Pulse(0)) Or 1  ' insert RB0 toggle bit
        Tgl(Pulse(1)) = Tgl(Pulse(1)) Or 2  ' insert RB1 toggle bit
        Tgl(Pulse(2)) = Tgl(Pulse(2)) Or 4  ' insert RB2 toggle bit
        Tgl(0) = Tgl(0) Xor $FF             ' prep Tgl(0) element
    '
    '  implement a button press or some other trigger before falling into
    '  the output routine (1024 1-usec intervals with 20-MHz clock)
    '
        FSR0 = AddressOf(Tgl)               ' Tgl(0..1023), 0x400..0x7FF
        Repeat                              ' toggle outputs from toggle array
            LATB = LATB Xor POSTINC0        ' at 1-usec (5 cycle) intervals
        Until LastElement                   ' until end-of-array (0x800)
    Last edited by Mike, K8LH; - 18th October 2009 at 17:45.

Similar Threads

  1. I Need Help.. I want to generate controlled pulses
    By alabbadi in forum PBP Wish List
    Replies: 7
    Last Post: - 18th November 2007, 11:42
  2. Count pulses between VARIABLE TIME
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2007, 13:44
  3. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 02:50
  4. Timed pulses on 2 pins
    By Danie Joubert in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th March 2004, 08:38
  5. Counting pulses
    By srspinho in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 19th November 2003, 01:54

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts