Action on line sync


Closed Thread
Results 1 to 3 of 3

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I'm no ASM expert but here's some thoughts:

    First on the timings you get.
    Each PIC instruction takes 1-2 cycles, GOTO takes 2. When the interrupt occurs the program first jumps to the interruptvector (0004h) which in turn points to the adress of your interrupt handler and the software then jumps there. So that's 2 GOTO's for a total of 4 cycles or 800nS @ 20MHz. Then comes your out=1 statement which takes another 200nS for a total of 1uS the remaining 200nS delay may be the difference between RB0 going high and the interrupt request being latched in the PIC by the clock.

    So a think that 1-1.2uS is probably the best you can do with this aproach.

    Second,
    I agree, logic chips aren't as fun as PIC's but if you can live with just one logic chip you could use a RS-latch and set it with the rising edge of your zero crossing pulse and at the same time start a timer in the PIC which will reset the latch after 200uS.
    If that works perhaps you could perhaps tie a second PIC-pin to the latch output (isolated from each other with diodes) and use the timer or your PauseUs sequence to pulse it. I beleive that would get your latency down a bit further.

    On the context saving I think it's probably like you say. Your main program does nothing that uses any of the registers that usually needs to be saved so that's why it works. Just don't try to do any 'real' work in the main program....

    HTH
    /Henrik Olsson.

  2. #2
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Default

    Excellent suggestion for the RS latch. This is much easier than any of my other ideas.

    Thanks,

    John

Similar Threads

  1. Darrel Taylor - Instant Interrupts-Problem 16F877A
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 31st December 2009, 14:19
  2. Replies: 0
    Last Post: - 3rd February 2009, 00:23
  3. Using input from Switch to control a loop
    By MrRoboto in forum mel PIC BASIC
    Replies: 9
    Last Post: - 2nd February 2009, 06:02
  4. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 9th December 2008, 00:40
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 13:22

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