Here's a tips on how to mix ASM and PBP.
Code:
' Using PIC16F88
@ DEVICE INTRC_OSC, LVP_OFF, WDT_OFF, MCLR_OFF
DEFINE OSC 4
OSCCON=%01101000
ANSEL=%00000000
CMCON=%00000111
trisa = %11111111
trisb = %00000001
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 25 ' 9600 Baud @ 4MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
CounterA var byte BANK0
CLEAR
Start:
asm
CHK?RP PORTB
BTFSC PORTB,0
GOTO $-1
INCF _CounterA,F
ENDASM
HSEROUT ["CounterA=",DEC CounterA,13,10]
PAUSE 200
GOTO START
You define your variable in PBP, then you access them in ASM. Possible to use the other way... BUT not 100% sure if this is safe though... sure it isn't 'cause you can't know for sure where PBP will place it's own variables.
Bookmarks