At first, I'm a layman when it comes to programming. Because of this, I am developing quick and easy programs to improve my knowledge.
I have a development board for a PIC18F4550, with LEDs on the RB pins, some on the RD and RC. The buttons are on the RE pins.
BootloaderhasalreadybeenwrittentothisPIC,soI'musingUSB(whichisonthebottomofthecard)todotherecordingonthePC.WhenIgenerateacode(I'musingMPLABX),Iloadthe.hexintotherecorder,andwhenitreaches99%,therecorderprogramsimplystopsresponding,andcloses...
Isthereaprocedurethatismissingfortherecordingoftheprogram?Detail,whenIrecordaprogramdonebyacollegeprofessor,itworksnormally.AndIcouldnotfindanypartoftheprogramthatwouldchangetherecordingsetting,justthesameprogramminglogic...
BelowisthecodeIwrote.TheclockIamusingis48MHz,andtheexternaloscillatoris20MHz.
IhopeIhavebeenclear.Ahug!
#include <xc.h>
#include "config.h"
void configura_uc()
{
//Configura botão do PORTE como entrada e LEDS como saída
TRISB=0xFF;
TRISC=0xFF;
TRISD=0xFF;
TRISE=0x00;
}
void main(void) {
configura_uc();
while (1)
{
if (PORTEbits.RE0 = 1)
{
PORTBbits.RB7 = 1;
PORTBbits.RB6 = 1;
PORTBbits.RB5 = 1;
PORTBbits.RB4 = 1;
}
if (PORTEbits.RE1 = 1)
{
PORTBbits.RB3 = 1;
PORTBbits.RB2 = 1;
PORTBbits.RB1 = 1;
PORTBbits.RB0 = 1;
}
if (PORTEbits.RE2 = 1)
{
PORTDbits.RD7 = 1;
PORTDbits.RD6 = 1;
PORTDbits.RD5 = 1;
PORTDbits.RD4 = 1;
}
}
return;
}