RobertD
New Member
You code looks fine except for the missing include file.
If it is working in the simulator and not in hardware then the problem could be your external oscillator. Have you got the correct resistor/capacitor combination to get a 4MHz oscillator. I'm not even sure if an RC oscillator can go that fast.
The other thing that may be wrong is you may not be waiting long enough. Isn't your delay routine 5 minutes long? I would change this to 1 second until you get something working.
Mike.
Why not use internal oscillator....? That way you don't have to bother with the external clock, and associated circuit.