|
|
View previous topic :: View next topic |
Author |
Message |
cart Guest
|
MPLAB-PIC problem |
Posted: Sun Feb 06, 2005 5:44 pm |
|
|
I have a problem with MPLAB and PIC C in my desktop.
I have PIC IDE version 3.36 and MPLAB IDEv6.4.
I am able to compile my program and load the program the PIC, using MPLAB.
But the PIC is not functioning as expected.
Even it shows that its writing program from 0x000-0xFFF.
Actually, when I saw the assembly code for this C-program, it occupies memory only till 0x0063.
I dont know, what's wrong with MPLAB, and why it does not load the program properly. I know that there is no problem with PIC, since I used it in some other place and it worked properly.
I tried this with MPLAB 6.3, the same thing occurs. Is that a bug in software or there is any logical error in program.
PLEASE HELP!!!
Thanks
cartic
Code: | #include <16F877.h>
#device *=16
#fuses XT,NOWDT,NOPROTECT,NOWDT,NOLVP, NOBROWNOUT, NOPUT
#use delay(clock=16000000)
#use rs232(baud=9600, parity=N, bits=8, xmit=PIN_C6, rcv=PIN_C7, errors)
#define PLED1 PIN_B6
#define PLED2 PIN_B7
#define LED1_ON output_high(PLED1);
#define LED1_OFF output_low(PLED1);
#define LED2_ON output_high(PLED2);
#define LED2_OFF output_low(PLED2);
#include <string.h>
#include <stdlib.h>
void main()
{
char c;
while(true)
{
LED1_ON;
if(kbhit())
{
c=getc();
delay_ms(1);
putc(c);
LED2_ON;
delay_ms(1000);
}
LED2_OFF;
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Feb 06, 2005 6:21 pm |
|
|
Quote: | I have PIC IDE version 3.36 and MPLAB IDEv6.4. |
Look at the top of your .LST file to find the version of the compiler.
The IDE version is not the same as the compiler version.
The compiler version will be something like 3.191, 3.216, etc.
Quote: | #fuses XT,NOWDT,NOPROTECT,NOWDT,NOLVP, NOBROWNOUT, NOPUT
#use delay(clock=16000000) |
You should be using HS with a 16 MHz crystal, not XT.
Also, you have NOWDT in there two times. Remove one of them.
If you're running at +5 volts, then it doesn't hurt to enable BROWNOUT.
In fact, it helps. I don't think there's any reason to disable PUT.
So your fuses should be changed to this:
#fuses HS, NOWDT, NOPROTECT, NOLVP, BROWNOUT, PUT
Quote: | But the PIC is not functioning as expected. |
What does the program do ? Does it do anything ? If not,
it might be because of the XT fuse. It might start working when
you change it to HS.
Quote: | when I saw the assembly code for this C-program, it occupies memory only till 0x0063. |
That's because it's a very short program. It doesn't use much ROM. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|