Search This Blog

Saturday, February 13, 2010

Bug Fix!!!!

    Wow! What a day.  I reverted back to my old standard, the pic 16f84a to get tmr0 working.  Everything worked great after I downloaded the general manual on mid range pics and looked at the code samples for tmr0.  I then tried the same stuff for my 16f88.  Errors aplenty ensued.
    Revelation:  I am using a PicStart Plus programmer with the open source software picp on Linux.  Turns out, there is a bit of a mistake with the definition file for the 16f88.  First, get the latest firmware for PicStart Plus ( I don't know what's relevant for other programmers, sorry ).  Then, for picp 0.6.8, you need to modify the picdevrc file ( mine is in /usr/local/bin ).  The first part of the definition needs to be:
[16F88]
    0 0 4 0 0 0 0 0
    0 0 0 0 0 0 0 0
    PICSTART WARP JUPIC OLIMEX
Notice the '4' on the 3rd number.  This is the word alignment.  Yours will read zero. 
This undoes my previous posts about needing 4 lines after ORG 0x00.  It also undoes all kinds of crazy bugs in your code.  I feel like a new man!!! My code now runs as expected.
    The only reservation I have is when I start to write my bootloader.  What impact, if any, is there on my approach to write to the program space.  More research is needed.  For now, I'm just glad to know I'm not insane.  I hope someone reads this and benefits.
    This introduced only one oddity in my existing code.  After LCD initilization, I found that I needed to write an set DDRAM address instruction to line one, position zero to get my text writing.  I thought the initialization code did that by default.  It had when my programmer was buggy.  Weird. 
    Now to tackle AUSART again.... A whole new set of problems, I'm sure.  For now, though: \/\/00+!

No comments:

Post a Comment