ScratchPad Memory Access Problem

jgavlik

New Member
I’m using a 28X2 and trying to read and write the scratchpad memory. However, when I do it appears that I can only either write or read the upper 256 bytes from address 768 to 1023. I’ve reduced the problem to a short piece of test code (see below) that “puts” a 0 in the first 256 bytes, a 1 in the next 256 bytes, a 2 in the third 256 bytes and a 3 in the last 256 bytes. When I go to read back what I’ve written the debug window only shows what I’ve written in the last 256 bytes (3). I can see the address register (w1) cycle through 0 – 1023, but the byte b0 never changes from the value of 3.

This code works in the simulator but not on the 28X2 itself. Could it be a compiler problem.

Any help will be appreciated.

Thanks,

John Gavlik
LearnOnLine, Inc.
www.learnonline.com





#picaxe 28X2 'don't change this!!!



Test:

for w1 = 0 to 255

b0 = 0

put w1,b0

next

for w1 = 256 to 511

b0 = 1

put w1,b0

next

for w1 = 512 to 767

b0 = 2

put w1,b0

next

for w1 = 768 to 1023

b0 = 3

put w1,b0

next


for w1 = 0 to 1023

get w1,b0

debug

next

goto test
 

westaust55

Moderator
28X2 ScratchPad Memory Access Problem

Welcome to the PICAXE forum.

I do not have a solution to your problem. It does seem like another compiler related issue.

Which version of the Programming Editor are you using?
V5.2.7 is the most current.

Another recent thread also covered a problem with access to scratchpad areas:
http://www.picaxeforum.co.uk/showthread.php?t=13082&highlight=scratchpad

however, the primary issue there was use of constants greater then 255 to define the scratchpad location whereas you are already using a variable for the location.

Think this will be up to the Rev Ed guru’s to consider.
 

jgavlik

New Member
28X2 ScratchPad Memory Access Problem

I'm using Editor version 5.2.5; however, several others outside this forum are using the latest editor and are experiencing the same results.

It appears with the shift to the lager memory the compiler (or something) hasn't quite caught up.

Thanks for your help thus far.

John
 

hippy

Ex-Staff (retired)
I've just run a number of tests on 28X2 firmware B.1 using Programming Editor 5.2.7 and everything seems fine to me.

It would be worth upgrading to Programming Editor 5.2.7 and checking the 28X2 firmware versions.
 

Technical

Technical Support
Staff member
From the v5.2.7 release notes... please make sure your software is up to date!

Code:
5.2.7
Corrected operation of PUT and GET commands for values greater than 255 in X2 compilers
 

jgavlik

New Member
I downloaded and installed editor version 5.2.7, but it didn't cure the problem. Is there also an issue with the firmware revision on the chip itself. If so, how do I find out the 28X2 firmware version.

John
 

westaust55

Moderator
I downloaded and installed editor version 5.2.7, but it didn't cure the problem. Is there also an issue with the firmware revision on the chip itself. If so, how do I find out the 28X2 firmware version.

John
Do not have the PE installed here where I currently am but the PICAXE chip firmware revision is available through the PE. It is displayed each time you download a program to the PICAXE. Recall there is also an option to check without downloading as well.
 

MPep

Senior Member
Correct. If you go into View, Options, Mode, there is a radio button called "Firmware?"

Press on this, with the programming cable connected (of course :eek:), and the firmware will be displayed on the screen.
 

Technical

Technical Support
Staff member
Your program works fine for us on a B.1, do you have a B.0 or a B.1 (see below)?

Have you also tried this alternate?

Code:
Test:
ptr = 0
 
for w1 = 0 to 255
b0 = 0
@ptrinc = b0
next
 
for w1 = 256 to 511
b0 = 1
@ptrinc = b0 
next
 
for w1 = 512 to 767
b0 = 2
@ptrinc = b0
next
 
for w1 = 768 to 1023
b0 = 4
@ptrinc = b0
next
 
ptr = 0
for w1 = 0 to 1023
b0 = @ptrinc
debug
next 
 
goto test

From 'firmware.txt' revision notes for B.0
*** PICAXE-28X2 (40X2) ***
ISSUE - CORRECTED ISSUE WITH PEEK/POKE ADDRESSES > 255
The v0 release does not correctly process peek/poke addresses > 255
To workaround this issue use 'x = @ptr' and '@ptr = x' instead.
Fixed in vB.1
 
Last edited:

jgavlik

New Member
I have three 28X2 chips...all version B.0 firmware. I suppose I got them immediately after they were available. I will use the @ptr work around you suggested, which I presume works on B.0 and above.

Thanks for all your help.

John
 
Top