Discrepancy in 'Check syntax' byte count

jodicalhon

New Member
I downloaded the latest version of the Programming Editor last night.

When I use 'Check Syntax..' from the PICAXE menu I'm told that my program uses 100 bytes of 256, yet when I download the program the 'Success' box tells me I've used 141 bytes of 256.

I believe the 'Success' box figure is probably correct.

I'm programming an 08M. I haven't tried any other chips yet.

Is this a known problem?
 

jodicalhon

New Member
I'm still getting discrepancies between the 'Check Syntax...' byte count and the downloaded byte count.

I've used four different programs. The discrepancy is not constant across the programs. It seems to be between 25 and 40, depending on the program.

I'm on windows XP, using the latest Programming Editor build, and am programming an 08M, firmware 9.1. Everything else seems to be working fine.

It's a bit of an annoyance.

Any thoughts?
 

hippy

Technical Support
Staff member
I recall the discrepency has been commented on before, and arises from a difference in the way the compiler and the downloader count bytes.

As long as the compiler doesn't report "Memory Full", the code should download successfully; the numbers from Check Syntax are the ones to pay attention to.
 

Jeremy Leach

Senior Member
It raises the question though : Is the code really 141 or 100 bytes?

If the Program Editor does a syntax check and thinks a program just squeezes into the memory available, but then the downloaded bytes is actually more, then you'd get corruption.

I suspect there's some little bug with the reported byte count after download , because I've had borderline 'memory full' situations and they seem to always work if the Syntax check has rported it;s ok. I wonder if the reported downloaded bytes = Program Bytes PLUS data bytes ??
 

andrewpro

New Member
Actually, if it's a difference in the way that the bytes are reported, youd be fine with the report of a lower bytecount...The length would be the same no matter how many are reported.

Doesn't a pic use like 14 bit words or soemthing strange like that? If the computer side is counting by 16 bit bytes, and the pic's are "counting" in 14 bit bytes, that would account for the discrepancy.

If you had a bag of wooden blocks, and you put them into piles of 14, then piles of 16, the one with piles of 14 would have more piles, even though the number of blocks all together hasn't changed.

--Andy P
 

ylp88

Senior Member
<BLOCKQUOTE><font size=1 face=arial>quote:<hr height=1 noshade>Doesn't a pic use like 14 bit words or soemthing strange like that? <hr height=1 noshade></BLOCKQUOTE></font><font face='Verdana, Arial, Helvetica' size=2>

The PIC (depending on which PIC you use)uses a 14-bit command byte but this refers to the assember command set of the basic PIC chip. The taken commands for the PICAXE are unlikely to follow this pattern as this would make it very difficult to implement - I would imagine that something like an OS file system would have to be set up (imagine - PICAXE with a FAT or NTFS!)

The data bus in a PIC is usually 8-bits wide and this is usually &quot;advertised&quot; as good having separate data and instruction buses (Harvard architecture vs. Von Neumann [sp.] architecture) - more bandwidth, essentially.

That's my interpretation of the situation, anyway...

<BLOCKQUOTE><font size=1 face=arial>quote:<hr height=1 noshade>Byte = 2 x Nibbles <hr height=1 noshade></BLOCKQUOTE></font><font face='Verdana, Arial, Helvetica' size=2>
I was just thinking the same thing today during my break time at Uni! (if you call it a break - first-year at Uni still has so much work!) An interesting perspective, though: &quot;'by eight' ~ byte&quot;

(Begs the question - how does &quot;word&quot; derive from &quot;byte&quot;?!)

<b><i>ylp88 </b> </i>

Edited by - ylp88 on 26/04/2006 08:36:36
 

Dippy

Moderator
Premelec - hooray!

Yes, all these names can be confusing. Especially when you switch between programming environments.
And let's not get started on twos compliment.

Edited by - dippy on 26/04/2006 08:53:24
 

andrewpro

New Member
I knew I had a 99% chance to get it wrong as I was just guessing, but it sounded good!! hehe.

I'm still curious as to why it happens though. I never bothered to notice before. I have noticed that if I write a program for an 08 it could be 120 bytes long but if I put the exact same program into an 08M it's 125 bytes long.


Given that the actual download is a separate program from the compiler, perhaps one doesn't account for something that the other has to? Stack, pointers, I dunno. I'm grasping at straws again <img src="tongue.gif" width=15 height=15 align=middle>

--Andy P
 

Jeremy Leach

Senior Member
Another guess is that a bug with reporting how many bytes has been downloaded hasn't rated highly in any Rev-Ed bugs-to-fix list. ie the vital info is just whether the memory's full or not. So maybe it's just wrong and has remained wrong ???

I don't know what other people feel, but I don't care too much how many bytes have been used, as long as it fits ! - although I am interested if I'm trying out optimisation ideas.

PS: I'm saying this after half an hour of repeatedly getting &quot;Error: Memory Full - Program too long !&quot; !!

Edited by - Jeremy Leach on 26/04/2006 09:31:32
 

hippy

Technical Support
Staff member
<i>Given that the actual download is a separate program from the compiler, perhaps one doesn't account for something that the other has to? </i>

I believe that's the case. The compiler knows exactly how much it generated, but the downloader only gets the entire 'image' of the PICAXE program memory required and has to try and work out what was and wasn't used.

That said, during testing, I've not managed to create any programs which showed any discrepancy at all.

The same program compiled for different PICAXE's will often show different sizes because the tokens generated are not the same for each.
 

tarzan

Senior Member
This taken from picaxe_manual2.pdf in this case it is important that &#8216;Check Syntax&#8217; functions correctly.

<BLOCKQUOTE><font size=1 face=arial>quote:<hr height=1 noshade>With the PICAXE-08, 08M and 18 the data memory is shared with program
memory. Therefore only unused bytes may be used within a program. To establish
the length of the program use &#8216;Check Syntax&#8217; from the PICAXE menu. This will
report the length of program. Available data addresses can then be used as follows:

<code><pre><font size=2 face='Courier'>PICAXE-08 0 to (127 - number of used bytes)
PICAXE-08M 0 to (255 - number of used bytes)
PICAXE-18 0 to (127 - number of used bytes) </font></pre></code> <hr height=1 noshade></BLOCKQUOTE></font><font face='Verdana, Arial, Helvetica' size=2>
 

jodicalhon

New Member
Thanks for all the replies.

I have just done a comparison I probably should have done earlier. Y'see I have been given my brother's old computer (much newer than the one I was using!) and did a new download of the Programming Editor 4.1.15.
This is the one that gives the odd byte counts. Check Syntax = 117, Download = 149.
(This is after additions to the original program - was 100 and 141. Note how it doesn't scale linearly!)

I was using an older version of the Programming Editor on my old computer, upgraded to 4.1.15 with updates from Rev-Ed.
I just dragged it out of storage and ran the program on it. Check Syntax = 149, Download = 149.

As no-one else seems to be having problems with the new Editor, it seems that the problem is on this 'new' computer. And that the Download byte count is the correct one.

I might try a re-download of the new Editor and see how that goes. Or just remember to check the download bytes if I'm getting close to the limit.
 

hippy

Technical Support
Staff member
If you are using two computers, each with the same Programming Editor version installed, using the same source code program targeted for the same PICAXE, and you are receiving differing reports on program size from each computer, something would seem to be amiss somewhere.

It may make sense to completely uninstall all Programming Editor installations ( and ensure the Programming Editor installation directory is empty ), re-install again and see if there is still a discrepency.

Before you do that, it might also make sense to post ( or link to ) your source code so others can compile and download it to determine which of your two installations are giving the results other users can confirm.
 

jodicalhon

New Member
Thanks Hippy. There is a version of the program (which is still evolving) posted in the recent 'If, thens, and gosubs' thread, begun by me, towards the bottom of the first page.

I've cut and pasted this into my Programming Editor, and get Check Syntax = 111 bytes, Download = 146 bytes.

I'd be interested to see what others get, even just the Check Syntax figure, which wouldn't require them downloading into a circuit. If no-one gets a discrepancy (and my old computer didn't) I'll try a re-install as you suggest.
 

hippy

Technical Support
Staff member
I unstalled everything and deleted the installation directory, installed 4.1.11, upgraded to 4.1.15 and then to 4.1.16

In all versions Check Syntax showed &quot;146 out of 256 used&quot;, and so did all downloads.
 

jodicalhon

New Member
Thank you very much, Hippy, for doing that. It looks like a re-installation for me. (I won't be able to do that until tomorrow night, though).

In the meantime, and showing my ignorance, I imagine I would uninstall using the 'Remove programs' application that comes with XP. Will this delete the installation directory, and if not, where might I look for it?

Thanks for any help.

Jo (not quite the computer whizz he'd like to be!)
 

hippy

Technical Support
Staff member
I believe that's the process ( I use Win98SE mainly ). You might have to do it a number of times as the upgrades/patches may add additional Programming Editor entries.

Once that's done I'd recommend deleting the installation directory as well, most likely ...

C:\Program Files\Programming Editor

A re-boot before re-installation won't go amiss either.
 

whizzer

Senior Member
Interestingly, with Windows XP, even deleting the usual program directory doesn&#8217;t delete certain aspects of a previously installed version of Program Editor, - the preferences that you have set up in the options menu for example.

Obviously WinXP&#8217;s &#8216;registry&#8217; has information left in it after a complete uninstall. Although this is hardly an unusual situation, (most if not all other programs do the same thing), and the info retained in this case could be considered as a convenience factor for Picaxe users installing a new version.

However when so many other programs also leave their imprint in the registry after an un-install, it sure explains how the registry can become bloated enough over a period of time to cause a slow running computer -even when there is only a few programs actually left installed

But then, that&#8217;s where registry cleaners come in handy.. :)
 

jodicalhon

New Member
Just to finish off this thread - I uninstalled the Programming Editor, forgot to reboot, re-installed it, and started it up. It started with my old settings, so the preferences are kept somewhere I don't know of (unsurprisingly!). The problem remained. GRRR.

I loaded other bas files, tried Check Syntax on them then, because I didn't know what else to do, I went out of 08M mode and Checked Syntax in 18A mode, 18X mode, 28 mode etc. trying different files and seeing the different byte counts. Went back to 08M mode, checked the problem file, and it had sorted itself! I'm getting correct byte counts now.

Thanks for all the help.

Cheers.

 
Top