Announcement

Collapse
No announcement yet.

HH2 - JLK version

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    KingJL code

    KingJL code worked 100%.
    Attached Files

    Comment


    • #17
      These are working codes for HAMMERHEAD.
      Attached Files

      Comment


      • #18
        Dear KingJL, could you explain how in your code can be changed by Sample_Delay 49,5uS about 75 or 100uS.
        With respect.

        Comment


        • #19
          Originally posted by etwert View Post
          Dear KingJL, could you explain how in your code can be changed by Sample_Delay 49,5uS about 75 or 100uS.
          With respect.
          The default Sample 1 delay is controlled by 'Def_Dly', defined in the 'Constants' section. The constant is set to: (desired delay - 1.5) / 1.5. Example (49.5 - 1.5) / 1.5 = 32, so Def_Dly equ 0x20. And the SAMPLE_DELAY adjustment is limited in the code to 49.5 usec. To get a SAMPLE 1 delay greater than 49.5usec would require a rewrite of the code. When this this code was written, it was with the goal of timing accuracy (minimum jitter) and interrupt code efficiency.

          Comment


          • #20
            Originally posted by KingJL View Post
            The default Sample 1 delay is controlled by 'Def_Dly', defined in the 'Constants' section. The constant is set to: (desired delay - 1.5) / 1.5. Example (49.5 - 1.5) / 1.5 = 32, so Def_Dly equ 0x20. And the SAMPLE_DELAY adjustment is limited in the code to 49.5 usec. To get a SAMPLE 1 delay greater than 49.5usec would require a rewrite of the code. When this this code was written, it was with the goal of timing accuracy (minimum jitter) and interrupt code efficiency.

            You can try this (no guarantees... this code was written a long time ago):
            In the sequence (right near the end of the code):
            banksel ADRESH
            movfw ADRESH
            addlw 0x08 ; set range to 2-33 for delay of 3uS-49.5uS
            andlw 0xf8 ; clear bits 0,1,2 so no rotate thru carry
            movwf SAMPLE_DELAY ;Store AD hibyte
            rrf SAMPLE_DELAY ;divide by 8 to get a range of 2-33uS
            rrf SAMPLE_DELAY
            rrf SAMPLE_DELAY
            bcf STATUS,RP0
            goto Idle_loop

            change the lines:
            addlw 0x08 ; set range to 2-33 for delay of 3uS-49.5uS
            andlw 0xf8 ; clear bits 0,1,2 so no rotate thru carry
            to
            addlw 0x04 ; set range to 2-63 for delay of 3uS-99uS
            andlw 0xfC ; clear bits 0,1 so no rotate thru carry
            and comment out the last 'rrf SAMPLE_DELAY' line:
            ; rrf SAMPLE_DELAY

            This will definitely reduce the granularity of the delay control, but should provide for a delay of up to about 99 usec (if I remember correctly).
            Last edited by KingJL; 02-10-2016, 05:15 PM. Reason: correction of comment

            Comment


            • #21
              Dear KingJL,
              Thank you for your responsiveness. Help me a lot to reach my goal.
              With respect.

              Comment

              Working...
              X