HSPIOUT simulation in PE, problem with @ptr.

Buzby

Senior Member
I just thought I'd try writing code to test some of the ideas in Marty's DMD thread.

I'm without real chips at the moment so I can only run in the simulator. My simulated hardware is 28X2

The code snippet below is the basis of the DMD refresh.

It will send 512 bytes from the scratchpad out over the HSPI, in 32 groups of 16 bytes.

Code:
' Refresh the DMD display
ptr = FrameStart		' Set scratchpad pointer to current frame start address, 0 or 512

For Row = 0 to 31
'	#
'	#### Put DMD control stuff here
'	#
	HSPIOUT (@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc,@ptrinc)
'	#
'	#### Put DMD control stuff here
'	#
Next Row
The problem is 'ptr' does not seem to increment properly.
After executing HSPIOUT the pointer should have incremented 16 times, but it only increments once.

Is this a bug, or am I doing something wrong ?.

Cheers,

Buzby
 

hippy

Technical Support
Staff member
This seems to be an issue with the simulator and HSPIOUT. Thanks for letting us know; we will investigate and apologies for the inconvenience.

The best workround would seem to be to use multiple HSPIOUT commands, one @ptrInc in each, but if you don't want to run the same code on a real chip you could add a value to 'ptr' to make it correct which would be easier. You could put that in a #IFDEF-#ENDIF so only included when simulating.
 

Buzby

Senior Member
Hi hippy,

No probs !.

It's just proof of concept code, so ptr = ptr + 15 has fixed it.

Cheers,

Buzby
 
Top