Society of Robots - Robot Forum
Software => Software => Topic started by: michaelsane on March 26, 2008, 03:37:48 PM
-
Hi, I recently started using c18, and I have been writing some programs that compile fine, but I didn't have a programmer to test them at the time. My programmer (PicKit2) finally arrived today and when I programmed my 18f4320 and tested the ports with my digital oscilloscope, nothing was happening. I figured the best plan of action would be to just try and turn some ports on and make sure that everything was working fine.
#include <p18f4320.h>
#pragma config OSC = INTIO1
void main (void)
{
LATD = 0x00;
TRISD = 0x00;
LATDbits.LATD0 = 1;
while(1);
}
That is the code I am using to test the RD0 port on my microcontroller. If anyone can help me figure out why the output isn't turning on it would be greatly appreciated.
-
things to check:
make sure that the MCLR pin is connected to +5v through a resistor, otherwise no code is likely to execute on it.
Make sure that when you compile the code in MPLAB that you have changed the build configuration to a "release" rather than a "debug". Otherwise i dont think that it build a valid hex file that you can program the pic with.
-
Does a 10k resistor sound right?
-
Sorry for the double post, but I resolved my issue by adding the pull up resistor (2x 4.7kohm) to MCLR.
Thank you for your help!