Hi. I have written a small test program which burns successfully on the controller (have verified after read) but the code doesn't execute.
Has anyone faced this problem before?
I have LEDs attached to PORTB but nothing is on the output (The LEDs work with 5volts direct hence not burnt
)
Code:
#include <p18cxxx.h>
#include <delays.h>
#include <stdlib.h>
#include <stdio.h>
#pragma config WDT = OFF, LVP = OFF, OSC = HS, DEBUG = OFF
void main(void)
{
ADCON1 = 0x0f; // make all AN (analog) pins digital (for bit ref)
TRISA = 0x00;
TRISD = 0;
TRISB = 0;
TRISC = 0;
PORTA = 0;
PORTB = 0x55;
PORTC = 0;
PORTD = 0x55;
while(1)
{
Delay10KTCYx(100);
PORTAbits.RA0 ^= 1;
PORTB ^= 0xFF;
PORTD ^= 0xFF;
Delay10KTCYx(100);
}
}