From c to pbp


Results 1 to 13 of 13

Thread: From c to pbp

Threaded View

  1. #11
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    971


    Did you find this post helpful? Yes | No

    Default

    The delays shown by Bruce are mistakenly wrong. The original code shows delay_cycles(59) That is delay for 59 cycles. So, by using Bruce's code as a start, you can make the delay for 59 cycles. This will give you the correct timings. Another thing, the oscillator is 20MHz. So, the initial define has to be
    Code:
    define OSC  20000000
    
    cntr    byte    1
    
    delay_cycles59:             ' 2 cycles to get here
    
    asm
             MOVLW  11          ' 1 cycle
             MOVWF  _cntr      ' 1 cycle
    loop:  DECFSZ _cntr,F     ' 1 cycles  (3*17+1 = 52)
             GOTO   loop          ' 2 cycles
             nop                    ' 1 cycle
             return                 ' 2 cycles
    
    endasm
    The above has a subroutine to give you an exact delay of 59 cycles. You can call the function from PBP like this
    Code:
             gosub  delay_cycles59
    Last edited by Jerson; - 28th July 2007 at 16:24. Reason: Added code

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 13:55
  2. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 14:43
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 20:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th December 2005, 00:30
  5. PBP / XP Crash
    By pondindustrial in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th November 2005, 04:16

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