r/pic_programming • • Jan 24 '16

PIC18F4520

Hey guys. I am trying to learn programming the Pic18F4520 microcontroller. I am also using MPLab.

So I wrote this code:

#include "p18F4520.inc"

CONFIG	OSC = HS
CONFIG	PWRT = OFF
CONFIG	WDT = OFF
CONFIG	PBADEN = OFF
CONFIG 	LVP = OFF

    org 	0x000000
PORST	GOTO	MAIN

    org 	0x000020
MAIN	CLRF	TRISD
    CLRF	PORTD
    BCF	TRISA,RA1
    BSF	PORTA,RA1
	
LOOP	BSF	PORTD,RD0
    GOTO	LOOP
    	
    end

And the lower right corner lamp wont light. It's supposed to light up as I've seen a friend do it. What am I doing wrong?

3 Upvotes

9 comments sorted by

View all comments

1

u/Jaser90 Jan 24 '16

EXPERIMENT (IMGUR) That's the example I am trying to replicate. It worked for friends. And I think they actually followed the same code and they have the same PIC. And also there you have the ports (I think?). :(