ViewPort Assembly Code Debug
Spiller
Posts: 52
Hi,
I know that ViewPort is basically developed for Spin Code debugging. I like·debug my assembly program with it, by using vp.share(@a,@b)
command·of the ViewPort. But it is·seems to me that I can not share variables which are decraled in my assemby program. Can I·share it somehow?
Regard
Spiller
I know that ViewPort is basically developed for Spin Code debugging. I like·debug my assembly program with it, by using vp.share(@a,@b)
command·of the ViewPort. But it is·seems to me that I can not share variables which are decraled in my assemby program. Can I·share it somehow?
Regard
Spiller
Comments
ViewPort uses the "vp.share" command to share data stored in global hub ram. This allows users to monitor and change variable values used by their spin and pasm programs. In PASM, you can use "rdlong/wrlong" to read and write data from global hub ram. You can not share the 512 registers that are private to each cog. Here some simple pseudo code- just typed it in, should work:
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon
Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
12Blocks, the block-based programming environment (thread here)
and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
Thanks for this code. Fist of all I'm new in Propleller, but I have practice with several controllers.
I didn't understand this code. If I want to share the hub memory from a..b with the conduit object, I sould built in vp.share(@a,@b)
start a new cog @pasm, @a. If know ir right the @a will be start addres for new cog stack. Until this step I understand the code, but didn't understand why the whole code in pasm. Reading the par (stack pointer) to aa, then overwriting it with bptr value which is calculated from par. What is this good for?
By the way I think it would be best to share my code with you. (The code compiled with PropBASIC)
Here is:
'' *** COMPILED WITH PropBasic VERSION 00.00.79 Feb 7, 2010 ***
'' ======================================================================
''
'' File......
'' Purpose...
'' Author....
'' E-mail....
'' Started...
'' Updated...
''
'' ======================================================================
''
'' Program Description
''
'' RFID Reader with IR disance sensor and IRDA
''
'' Device Settings
''
CON 'DEVICE P8X32A, XTAL1, PLL16X
_ClkMode = XTAL1 + PLL16X
_XInFreq = 5000000 'FREQ 80_000_000
''
'' Constants
''
''
'' I/O Pins
''
' IR_DIST_SEN PIN 16 INPUT 'IR_DIST_SEN PIN 16 INPUT
''
'' Shared (hub) Variables (Byte, Word, Long)
''
' VAR LONG IR_RANGE 'IR_RANGE HUB LONG
''
'' Shared (hub) Data (DATA, WDATA, LDATA, FILE)
''
''
'' TASK Definitions
''
''
'' Cog Variables (Long only)
''
' DIST_VAL VAR LONG = 0 'DIST_VAL VAR LONG = 0
''
'' SUB/FUNC Definitions
''
'' ======================================================================
PUB __Program ' PROGRAM Start
CogInit(0, @__Init,@__DATASTART)
DAT
org 0
__Init
mov dira,__InitDirA
mov outa,__InitOutA
jmp #Start
'' ======================================================================
Start 'Start:
' ' Main code goes here
__DO_1 'DO
mov __temp1,#1 ' RCTIME 16,1,DIST_VAL ' Read IR Range Finder
shl __temp1,#16
andn dira,__temp1
mov DIST_VAL,#0
mov __temp2,cnt
adds __temp2,#80
__L0001
adds DIST_VAL,#1
waitcnt __temp2,#80
and __temp1,ina NR, WZ
IF_NZ jmp #__L0001
mov __temp1,#IR_RANGE_ofs ' WRLONG IR_RANGE,DIST_VAL ' Store Range In Hub Variable
add __temp1,par
wrlong DIST_VAL,__temp1
mov __temp1,cnt ' PAUSE 100
adds __temp1,_1mSec
mov __temp2,#100
__L0002
waitcnt __temp1,_1mSec
djnz __temp2,#__L0002
jmp #__DO_1 'LOOP
__LOOP_1
mov __temp1,#0 'END
waitpne __temp1,__temp1
''
'' SUB/FUNC Code
''
''
'' TASK Code
''
'**********************************************************************
__InitDirA LONG %00000000_00000000_00000000_00000000
__InitOutA LONG %00000000_00000000_00000000_00000000
IR_DIST_SEN LONG 1 << 16
_1mSec LONG 80000
_FREQ LONG 80000000
DIST_VAL LONG 0
__remainder
__temp1 RES 1
__temp2 RES 1
__temp3 RES 1
__temp4 RES 1
__temp5 RES 1
__param1 RES 1
__param2 RES 1
__param3 RES 1
__param4 RES 1
__paramcnt RES 1
FIT 492
CON
LSBFIRST = 0
MSBFIRST = 1
MSBPRE = 0
LSBPRE = 1
MSBPOST = 2
LSBPOST = 3
IR_RANGE_ofs = 0
DAT
__DATASTART
IR_RANGE LONG 0
I like to share the IR_RANGE variable with conduit. As you see the code write to this location already.
Best Regards
Spiller
It looked like you were already wrlong to a spin variable. So I just added an object reference to ViewPort's conduit and called vp.share with your variable. Let me know if it work...
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon
Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
12Blocks, the block-based programming environment (thread here)
and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer
Thanks for the code, but it s still not working. I gave up this code and written it in Spin. This is working.
Best Regards
Spiller