One thing that strikes me as odd is that when you look at the hex file im my programmer it's in groups of 3 instead of groups of 4 - any clues why?
One thing that strikes me as odd is that when you look at the hex file im my programmer it's in groups of 3 instead of groups of 4 - any clues why?
This programming error message seems to be popular now. Do a search within the forum or the website of your device programmer AND/OR software.
Compile and program fine here.
<img src='http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1111&stc=1&d=116044343 1">
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
As mister_e mentioned, it is a popular error. You seem to be having a low voltage issue on your programmer.
If you can, try a simple code on 12F508.
If you get the same error then you definitely have a low voltage issue.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
I haven't tested this, but I think this should work if your code is not going to
grow or use other PBP commands.
Try this.
Comment out RR1, RM1, and FLAGS in your PBPPIC12.RAM file and save it.
PBP will allocate RAM space by default. Even if it's never used.Code:R0 VAR WORD BANK0 SYSTEM ' System Register R1 VAR WORD BANK0 SYSTEM ' System Register R2 VAR WORD BANK0 SYSTEM ' System Register R3 VAR WORD BANK0 SYSTEM ' System Register R4 VAR BYTE $0F SYSTEM ' System Register ;RR1 VAR BYTE BANK0 SYSTEM ' Pin 1 Register ;RM1 VAR BYTE BANK0 SYSTEM ' Pin 1 Mask GOP VAR BYTE BANK0 SYSTEM ' Gen Op Parameter ;FLAGS VAR BYTE BANK0 SYSTEM ' Static flags OPTION_REG VAR BYTE BANK0 SYSTEM ' OPTION_REG shadow register SOFT_STACK VAR BYTE[4] SYSTEM ' Software return stack SOFT_STACK_PTR VAR BYTE BANK0 SYSTEM ' Sotware stack pointer
Now simplify this equation by breaking it down;
Change: IF time2 >= 2 AND b0 = 2 Then dim = dim + 1
to;
It's the same logic, but PBP doesn't create temp variables just to figure it out.Code:IF time2 >= 2 Then IF b0 = 2 Then dim = dim + 1 'if over 20 min then start dimming dim period 4 cycles = 10 mins ENDIF ENDIF
Try compiling your code for a 12F629 without making this change, and take a
peek at how temp variables get created in the .LST file.
Now make the change, and re-compile it for the 12F629. Temp variables are
gone. Works the same on pretty much any target I suspect. Just simplify your
equations by breaking them down into smaller parts. Especially for little parts
like the 10F.
Don't forget you have those line items commented out in your .RAM file. As
your program grows, you compile for another device, use more PBP commands
etc, one or more might be needed by a library function. You should get an
error if you have one commented out that's needed.
It should compile & work leaving you with a whopping whole byte of free
RAM...;o}
Sure it's another approach wich also works and it's free-up 3 Bytes of RAM.
SOFT_STACK -> 4 BYTE
SOFT_STACK_PTR -> 1 Byte
The advantage to use of the EXT modifier avoid to comment-out those .Lib file. Also nice for short-term memory like mine as i should forgot to remove the comment in the right .LIB file
Yup sounds familiar to my exampleOriginally Posted by bruce
![]()
Last edited by mister_e; - 12th October 2006 at 04:16.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Another option that does not involve ASM, EXT, or altering files (but should work even though it is slightly contrived.)... You are low on Data Ram but big on Program Space (200 of 512 words used) right?
1) Change the IF-AND-THEN to nested IF-THENs as noted by Steve and Bruce
2) b0 ranges from 0-3 (2 bits). Drop the b0 variable and stash the values in OPTION_REG<1:0> (with the prescaler pointed to the Timer, which you are not using)
3)Time2 ranges from 0-73 (7 bits). Drop the Time2 variable and store the lower 5 bits in the FSR register, the 6th bit in OPTION_REG<2>, and the 7th bit in OPTION_REG<4>.
The rest of your variables fit – the code to deal with the above changes adds some complexity but would not be hard to implement.
Yet another option (you said commercial product – the price difference between the 202 and the 629 in quantity is about 0.30USD). Live with the loss or charge your customer a little more and have a clean solution with the 12F629.
Yet another option – take a week to learn ASM if you do not already know it. This part (10F202) has little complexity and it would not be difficult to convert your code to ASM. Bruce has a good ASM example posted in the example code section plus there are lots of good tutorials out there.
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Hi,
Depending on the volume of sales you expect, it may be worth the expense of switching to a different compiler for this project.
I’ve heard that the Hitech PIC C-compiler is very good at producing lean and reliable code. It’s pricey though.
Another option is the Proton compiler (at least the latest version that comes with PDS). A guy on that forum was able to compile your program using only 12 vars. This is a much cheaper option and should be really easy to port over from PBP (both are basic compilers).
Alternatively, maybe someone on the PDS forum could simply give you the HEX file for your program (for free or maybe only a small fee).
It’s a pretty simple program so, unless you’re planning on making lots of changes to it, that may be the cheapest option.
Cheers,
---> picnaut
Off/on topic... Can I use PBP to compile for the 202, but other than declaring constants and variables, do everything in assembly? And...will this add code to the program as opposed to writing it on MPASM?Originally Posted by paul borgmeier
Thanks,
Ron
Bookmarks