18f252. light up an LED

I'm trying to light up an LED with the 18f252.

here is my code

#include <p18f252.inc>

LIST P = 18f252

ORG 0

GOTO START

;CONFIGURATION SECTION

START MOVLW B'00000010'

MOVWF BSR

MOVLW B'11111111'

MOVWF TRISA ;SET AS INPUT

MOVLW B'11110000'

MOVWF TRISB ; SET AS INPUT

MOVLW B'00000000'

MOVWF TRISC ; SET AS OUTPUT

MOVLW B'00000111'

MOVWF OPTION_R

MOVLW B'00000000'

MOVWF BSR

CLRF PORTA

CLRF PORTB

CLRF PORTC

;PROGRAM STARTS NOW.

BEGIN MOVLW B'11111111' ; MAKE ALL PINS '1'

MOVWF PORTC

END

This means that if i connect it to any pin in PORTC, the LED would light up. But, it doesn't, any ideas why? I'm srsly beat bcos of this.

I don’t know if it could

I don’t know if it could help you, but I write a simple program in Assembler to help with your deals:

#include <p18f252.inc>

CONFIG WDT = OFF ; disable watchdog timer

CONFIG OSC = HS ; use crystal

org 0 ; start code at 0

Delay1 EQU 0x01

Delay2 EQU 0x02


Start:

CLRF PORTB

CLRF TRISB

CLRF Delay1

CLRF Delay2

MainLoop:

;Toggle PORT D , BIT 1

BTG PORTB,RB0


Delay:

DECFSZ Delay1,1

GOTO Delay

DECFSZ Delay2,1

GOTO Delay


GOTO MainLoop

end

 

 

your program does not work.
your program does not work. Maybe its a problem with the chip. is there a way to test?

Yes, it’s work. I have

Yes, it’s work. I have tested it before post.

That means there is a
That means there is a problem with my chip. How come u dont need to tell the chip to make portb and output?

What? I can’t get what you
What? I can’t get what you mean.

Specs
I haven’t looked at the spec sheet for this chip. It may be that port b is an output by default.

More Specs

You have no oscillator configuration. Do you have an oscillator connected? Unless I’m missing something fundamental, your code SHOULD set all port c bits high witha bit of tweaking to the configuration.

We went through this in one

We went through this in one of your previous threads - you need to include your configuration bits at the beginning of the program, or you need to tell the IDE to set them for you. Either way we’ve got no idea what (if any) config bit settings have been applied.
Maybe you should check that you do indeed have a copy of p18f252.inc, and if you have it, why not read through it and see exactly what is being added to your code.

Another one?
Another ASM nut? Clearly I’ve not been paying atention. I was alone for a long time!

ASM4LYFE!Seriously though, I
ASM4LYFE!
Seriously though, I use ASM in all my microcontroller projects because I’m a control freak, and I don’t like it when compilers mess with my code. The only time I use C/C++ is for PC programming and for some multi-core micros; it’s true that programming is faster in ‘higher’ languages, but debugging is so much more difficult since all the low-level stuff is hidden.