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?
Re: Is it possible to feed PBP variable data into ASM code fragment?
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.
https://www.youtube.com/watch?v=KMFNrExf2sc.
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?
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.