PDA

View Full Version : Variables name in PBP and same variables name in ASM or macro listed in pbp xxx.lib



asegui
- 10th November 2014, 16:46
I try to find clear explanations about variables name used in PBP and variables name in ASM or PBP macros (listed in files *.lib of PBP3 directory
For example
DutyCount var byte : in PBP : no problem
Count var byte EXT : in asm subroutine
I guess it is a variable "Extern" which would be similar to main PBP program variable déclaration "Count var byte" as the previous line DutyCount var byte

_DutyCount ; used in asm lines routine as for instance "incf _DutyCount, F"
_DutyCount, is it the variable DutyCount address or the readed value of variable DutyCount used in asm routine ?

I discover asm procedures with the very well done program DT_INTS-14.bas from Darrel Taylor in which I would want to modify asm program in vue to mask for instance 3 pulses on 4.

To fix ideas with my goal :
if the pulse period is 5ms and duty cycle is 256 steps, the accuracy of duty cycle is 50ms/256 steps = 0.19ms per step.

If I succed to mask the 3 following pulses (avoiding to put "1" on the out pulse port in the asm routine), this manner would lead to a precise pulse every 20 ms. Then, this would lead to a pulse with 0.19ms resolution with a 20ms period (and so on if the number of masked pulses increase). <BR>The future use of this function is to buid a PID speed rpm with a brushless motor knowing that this last one&nbsp;is drived by an ESC for which command is like a servo command.

I use PBP3 and 16F690

HenrikOlsson
- 10th November 2014, 19:23
Hi,
If you declare a variable in PBP then you need to preceed it with an underscore in order to access it in ASM. myPBPVariable in PBP will be _MyPBPVariable in ASM
If you declare a variable in ASM then you need to inform PBP of that variables existance using EXT. myASMVariable in ASM will be myASMVariable in PBP.

I'm sure you've see the thread The EXT (external) modifer (http://www.picbasic.co.uk/forum/showthread.php?t=3891)....

/Henrik.

asegui
- 12th November 2014, 07:57
Thanks Henrik for your indications and explanations ; No, I have not read the link you gave about EXT and this one completes my goal.
Have you any other links on this topic ?
Alain