Generating a series of high frequency pulses with pre-defined length.


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Generating a series of high frequency pulses with pre-defined length.

    ‘ Is RWM safe!

    flipflop var byte
    flipflop = %01010101

    cycle:
    portb = flipflop
    @comf _flipflop
    goto cycle
    doing it that way won't get past a few hundred kilohertz






    its easy with the dsp module ,but the last pulse is difficult to control
    if being 1 pulsE short sometimes this works great for a 4MHz output stream

    Code:
    '****************************************************************
    '*  Name    : MODULATOR.BAS                                     *
    '*  Author  : richard                    *
    '*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 5/29/2016                                         *
    '*  Version : 1.0                                               *
    '*  Notes   :  4MHZ CARRIER FOR X PULSES   x=10 to 65535        *
    '*          : 16F1825                                           *
    '****************************************************************
      #CONFIG
                 __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_ON  &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
                  __config      _CONFIG2, _PLLEN_ON & _LVP_OFF            
    #ENDCONFIG
     
    OSCCON=$70 
    DEFINE OSC 32
    @TIMER1=TMR1L
    '                       PIC 16F1825
     
    TRISA     = %111111    ' Make all pins Input 
    trisc     = %101111  ;Make all pins Input   
    ANSELA=0     
    ANSELC=0
    
    CLKRCON=  %11110011
    MDCON=    %11000000
    MDSRC=    %00000000
    MDCARH   =%00100011
    MDCARL   =%00000000
    X VAR WORD    
    TIMER1     VAR WORD EXT
    '  ;debug   --------------------------
    ' TRISA.0     = 0
    ' lata.0=1
    ' pause 2000     ;debug
    ' serout2 PORTa.0,84, ["ready v3",13,10 ]    ;debug
    '  ;debug ------------------------------------
    ; moddout is portc.4
    X=40
    
    Main_Loop:     
    TIMER1=~(X-6)
    ASM 
        BCF  PIR1,0
        MOVE?CT 1,MDCON,0
        MOVE?CB 0X71,T1CON
    COFF    
        BTFSS PIR1,0 ;    
        BRA COFF
        
        MOVE?CT 0,MDCON,0
        MOVE?CT 0,T1CON,0
    ENDASM
    PAUSE 200 
    goto Main_Loop
    end
    Warning I'm not a teacher

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Generating a series of high frequency pulses with pre-defined length.

    Yes of course hardware will be faster, but neither are the original examples.
    I’m not saying it’s possible to get a 4MHz signal that way in software, just faster than what was posted.
    Last edited by Art; - 9th October 2016 at 03:53.

Similar Threads

  1. Measuring a variable freq/length pulse and generating more pulses.
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 18th September 2014, 09:10
  2. Replies: 1
    Last Post: - 9th March 2013, 07:10
  3. How to latch an output for a pre-defined time
    By Dennis in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st December 2009, 18:20
  4. high voltage high frequency H-Bridge
    By George in forum Off Topic
    Replies: 6
    Last Post: - 27th April 2009, 11:50
  5. High End Pre with PIC 16F876A
    By abidr in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th May 2008, 08:13

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