Pulse generation help required


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,617


    Did you find this post helpful? Yes | No

    Default Sorry, my mistake...

    Hi again,
    Im sorry... I just returned from work and checked the datasheet for the 'F84 and it doesn't have TMR1. It does, however have TMR0 and a prescaler that you may be able to use as long as you turn off the WDT.

    If I where you I'd consider changing that 'F84 to something like the 'F628 if at all possible. If you NEED to run it on the 'F84 let us know...

    Here's a quick non tested example of how you could use TMR1 on 'F628. It doesn't use interupts it only polls the TMR1 interupt flag to se if it has rolled over.
    Code:
    Loop:
        If PortB.1 = 0 then Goto Loop       'Wait here until PortB.1 goes high.
    
    
    SetPulse:
       'Preload TMR1 ((232*256) + 143 = 59535)
       TMR1H = 232
       TMR1L = 143
       High PortB.1              'Set the output.
       T1CON.0 = 1             'Start the tmr.
    
    WaitForTimeOut:
       If PIR1.0 = 1 then      'The time is up...
           Low PortB.0          'Turn off the output
           T1CON.0 = 0         'Stop TMR1
           PIR1.0 = 0            'Reset the TMR1 Interupt Flag            
           TMR1H = 232        'Reload TMR1 so it ready for the next pulse
           TMR1L = 143
           Goto Loop
       Endif
    
       'Do your other stuff here.....
       'Don't use any time consuming pauses etc.
    Goto WaitForTimeOut
    Hope that helps a bit more than my first suggestion.
    /Henrik Olsson.

  2. #2
    Join Date
    Nov 2005
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Thanks for the advice

    Hendrik, thanks for the speedy advice.
    Looks like what I need to do to make my implementation work.
    I will go to the F628 as you suggest.
    I am new to this (PICs and PBP) and just learned heaps through investigating your suggested code and studying the datasheets to see how it works.
    Thanks heaps for that.
    Best Regards.
    Murray

Similar Threads

  1. Pulse Capture and byte building
    By boroko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st July 2009, 01:59
  2. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  3. Replies: 3
    Last Post: - 13th September 2008, 17:40
  4. Unwanted output signal jitter
    By LinkMTech in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 18th January 2008, 02:31
  5. Pulse Frequency Multiplication
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st August 2005, 10:39

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