Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Creating pulse 5us width

  1. #1
    Senior Member
    Join Date
    Oct 2014
    Posts
    144

    Creating pulse 5us width

    well all, this is more likely my last project for work before I retire. (unless they want me to work from home which will be somewhere in Arizona and out of cold Utah.)
    I'm thinking of using the Teensy 3.2(3.1 I have to play with) and or using the teensy 3.5 which we have in our current products and has worked since 2015 (3.2 2015 to 2017. 3.5 current) and still going strong.

    The issue at hand is a wired remote that sends Manchester Code to the system. I'm not willing to bother much on using a library for the Manchester code, but it does have a preface to tell the system that it is a handset.
    I have scoped the output and see the common signal that is sent and to the data (button function) is a total of 185 us. The signal repeats at 75 ms intervals.

    20 possible codes are from 10011111 (no key) to 10000000 the 1st button action. Thus 20 different conditions (4 are spares)

    Since the 1st 20 are binary, I'm thinking of using case then send the code somehow (still thinking on a way of doing) XOR or shift.

    Usually when I type stuff out I start thinking I can do that, but can I..... (Brain Pause)

    So I can maybe do the preamble 1st and then trail the key code and repeat 75 ms later.

    Well actually about the retirement.. Work has put me into a semi retirement... But moving to Arizona in the very near future.. faster if they don't put me back into full time.. So I'm here Mon/Tues.

    So ideas will help.
    In the meantime I will do some timing stuff on my teensy 3.1 or 3.2.. And maybe try the 3.5 I have.. Scope in hand..

    Thanks a head of time..

    Wayne

  2. #2
    Senior Member
    Join Date
    Oct 2014
    Posts
    144
    So I tried both my Teensy 3.1 and the 3.5 and found the 3.5 can produce a accurate 5 us square wave.

    I'm will now look into using SPI. I think I might be able to create 10000110 code or like to send. I looked at it yesterday, if I can make it 5 us wide.

    wish there was something like sendcode(11100011, width, interval) or something like that.. Off to play somemore.

    Wayne

  3. #3
    Junior Member
    Join Date
    Jan 2019
    Posts
    18
    What was the shortest accurate interval on the 3.1?

  4. #4
    Senior Member
    Join Date
    Oct 2014
    Posts
    144
    Using Micros, and setting up for 5 off/5 on, I could never get to 5 us. It was like 6.9 us and would change width every so often. I set speed to 120 overclock and faster with pure code and LTO. The 3.5 handled it great.
    I'm playing with ShiftOut now but moving to SPI. Seeing if I can just output a signal thats like 20 or so bits wide. Thats what I need I think for the start and button code.

  5. #5
    Senior Member
    Join Date
    Oct 2014
    Posts
    144
    I have so far created the actual code. Still hard coded. Need to figure out how to do it with not using delayMicroseconds option. Elapsetimer I think I need to use.

    Scratch the above..
    I was looking over Delay and Timings Functions and saw noInterrupts(); mentioned. So I know I'm not using interrupts at all, and I added the statement in my loop.
    The jitters has disappeared. Timing is at 5.2 us, but I will try some options on speed and flashing.
    Last edited by Wayne; 01-17-2019 at 05:03 PM.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,006
    Maybe some of the jitter reduction ideas here can help?

    https://forum.pjrc.com/threads/27690...ll=1#post64142

  7. #7
    Senior Member
    Join Date
    Oct 2014
    Posts
    144
    Thanks Paul,

    Looking into now.. Accuracy a bit off on what I'm doing, like 5 us is 5.2 us.. I was called back into work today for something else and I can stay and play.

Posting Permissions

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