ASM Help


Closed Thread
Results 1 to 3 of 3

Thread: ASM Help

  1. #1
    fbraun's Avatar
    fbraun Guest

    Default ASM Help

    Hello All
    Need to speed up some PBP instructions. Can anyone help with the ASM equivalents for the following:
    if CTPeriod = 1 then PulseCount1 = PulseCount1 + 1 ;increment pulse counter
    if CTPeriod = 2 then PulseCount2 = PulseCount2 + 1 ;increment pulse counter
    if CTPeriod = 3 then PulseCount3 = PulseCount3 + 1 ;increment pulse counter

    where:
    CTPeriod = byte
    PulseCount1,PulseCount2 and PulseCount3 = words

    The PIC I'm using is a 18F2525

    Thanks

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    if CTPeriod = 1 then PulseCount1 = PulseCount1 + 1 ;increment pulse counter
    Code:
               decfsz _CTPeriod       ; if CTPeriod == 1, this decrement will make it zero
               goto Check2
               incf _PulseCount1      ; increase the LSB
               btfsc STATUS,Z        ; if LSB == 0
               incf _PulseCount1+1  ; increase the MSB
               return
    Check2:
               decfsz _CTPeriod       ; if CTPeriod == 2, this decrement will make it zero
               goto Check3
               incf _PulseCount2      ; increase the LSB
               btfsc STATUS,Z        ; if LSB == 0
               incf _PulseCount2+1  ; increase the MSB
               return
    Check3:
               decfsz _CTPeriod      ; if CTPeriod == 3, this decrement will make it zero
               goto Check4
               incf _PulseCount3      ; increase the LSB
               btfsc STATUS,Z        ; if LSB == 0
               incf _PulseCount3+1  ; increase the MSB
               return
    Check4:;CT_Period is greater than 3
               ; do something here
               return
    Disclaimer : Unverified code.

  3. #3
    fbraun's Avatar
    fbraun Guest


    Did you find this post helpful? Yes | No

    Default

    Thank you for the code.

Similar Threads

  1. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 13:43
  2. ASM help
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 21st October 2009, 03:08
  3. ASM or PBP First?
    By mackrackit in forum Off Topic
    Replies: 4
    Last Post: - 10th October 2009, 12:08
  4. Serial Output - for an ASM numb
    By scomi85 in forum Serial
    Replies: 0
    Last Post: - 1st March 2009, 10:13
  5. Problem using ASM instruction
    By ewandeur in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd April 2008, 15:26

Members who have read this thread : 1

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