I have this code for the MCU (pic18f4580) :
#include <pic18F4580.h>
#pragma config OSC=HS
#pragma config LVP=OFF
#pragma config PBADEN=OFF
#pragma config WDT=OFF
#pragma config MCLRE=ON
#define _XTAL_FREQ 4000000
void main(void) {
TRISB = 0x00;
while(1) {
PORTB = 0xFF;
//_delay_ms(500);
}
return;
}
I have generated the hex file with MPLAPX and compiler XC8
This is the schemata I made in Proteus, but the LED won't turn on:
You had to switch the port
RB0
to digital, on default it is an analog port.See section 20.0 in the datasheet.