Is it possible to feed PBP variable data into ASM code fragment?


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2013
    Posts
    1,078

    Default Is it possible to feed PBP variable data into ASM code fragment?

    I need to control built in HPWM of PIC16F1825 with PBP. The problem is, that HPWM statement on each execution, stops and restarts HPWM module, which is not desirable. If I issue ASM statement, I can change HPWM generator frequency, without stopping it. But the problem is, that I can't feed required frequency from PBM to ASM code insert into it. So maybe it is possible to locate somehow variable data storage address in PBP, and read it using ASM code, so I can control HPWM as I want?

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to feed PBP variable data into ASM code fragment?


  3. #3
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to feed PBP variable data into ASM code fragment?

    If you pause this in the right places it shows how to turn HPWM on & off with inline asm compiled with the PBP code,
    but you don’t even have to do that since PBP can write values to the chip registers itself with it’s own variables.
    You do it when you, for example, set CMCON = 7 to turn 16F628 analogue ports digital.

    .

  4. #4
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to feed PBP variable data into ASM code fragment?

    Have no access to PBP right now, so construction like this:

    FOR A=1 TO 200
    CMCON1=A
    NEXT

    will work?

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,518


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to feed PBP variable data into ASM code fragment?

    Yes, it will "work" in the sense of assigning the values 1 thru 200 to CMCON1, one after the other.
    If that's actually what you want is another matter.

    And back to the topic of HPWM. It's easy enough to control the CCP module directly without using the HPWM command, plenty of examples on that floating around here. And, as have been pointed out, any variable you declare in your PBP program can be accessed from assembly by preceding it with an underscore - subject to bank switching etc.

    /Henrik.

Similar Threads

  1. Replies: 2
    Last Post: - 12th November 2014, 08:57
  2. pbp - asm variable passing
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th May 2009, 09:49
  3. Anyone do a comparison of the ASM code generated by PBP??
    By Frozen001 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th November 2008, 21:01
  4. Basic variable and @ASM command
    By F1CHF in forum mel PIC BASIC
    Replies: 4
    Last Post: - 2nd February 2008, 08:35
  5. asm and pbp
    By pic beginner in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th October 2004, 06:33

Members who have read this thread : 2

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