PICmicro & dsPIC >> PICmicro & dsPIC

Pages: 1
Steve K
stranger


Reged: Jun 27 2009
Posts: 3
Newbie help programming PIC
      #119032 - Tue Jun 30 2009 09:16 PM

I'm having trouble getting a PIC16F876 to run any program. I'm using MPLAB v 8.33 with Hi-Tech C Pro V9.65 toolsuite. I'm using a Standard Willem Programmer from KEE Electronics. For now, I've just been trying to run sample programs compiled in both assembly and c. Once the program is written to the chip, it doesn't run the program. The oscillator inputs/outputs are both dead. I've tried with both crystals and resonators. From what I can tell, it may be the programmer software causing the problem. If I look at the buffer, it loads the program just fine. After writing it to the chip, then clearing buffer and reading the chip, the first four memory locations are 3FFF and the first four locations of the hex file appear to be overwritten. If I'm reading the datasheet right, the program memory starts at 0005h. Is it possible that the Willem software is attempting to write the hex file to the chip in a reserved location, specifically the reset and interrupt vector? Has anyone used the Willem to program PICS before?
Sorry for the elementary aspect of this question, I'm struggling to get this project going. I'll take any help at this point. I can't even get to writing the code, I've spent days working on this basic hardware/software interface.
Also, for what it's worth, I do have PIC16F876 selected in both the IDE and programmer software, it isn't an A chip, and I bought new chips from Mouser just to rule it out.

Thanks,
Steve


Post Extras: Print Post   Remind Me!   Notify Moderator  
swanny
enthusiast


Reged: Sep 12 2008
Posts: 247
Loc: New Zealand
Re: Newbie help programming PIC [Re: Steve K]
      #119042 - Tue Jun 30 2009 11:07 PM

Hmmm...

The program memory may start at 0005, however your programmer still needs to be able to write to the other memory locations (to setup the interrupt vector etc).

My own programmer starts writing at 0x0000 and then writes the config word above 0x2000(words).

Here's a rough program I used to test it:

Code:

#include

__CONFIG(UNPROTECT & DEBUGDIS & LVPDIS & BORDIS & PWRTDIS & WDTDIS & XT);


void main(void)
{
short i;
TRISC = 0x00;
RC3 = 1;

// nasty, test
while (1)
{
i++;
if (i > 0)
{
RC3 = 1;
}
else
{
RC3 = 0;
}
}
}



Here is the intel hex format file:
(the first line has spaces to delimit length, address, record type, data). Note the address in the second to last line is 400E, this is the config address.
Code:

:10 0000 00 0A128A1103280310831603130030031801
:1000100001308700031403181028122883120313D9
:100020008715132887110130F0070318F10A0030F3
:10003000F1077108803AF20080307202031D222815
:1000400001307002031C25282628302803140318C9
:100050002C282E288312031387152F28871139285F
:1000600003100318362838288312031387153928FC
:0A007000871113280A128A110028D4
:02400E00393F38
:00000001FF



Edited by swanny (Tue Jun 30 2009 11:14 PM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
2 registered and 10 anonymous users are browsing this forum.

Moderator:  mikerj, jtemples, jeff, Dan Henry, Andrew L 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 348

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5