Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me with a LED blinking program for 18F2520

Status
Not open for further replies.

Colin Mac

Newbie level 4
Joined
Feb 7, 2008
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,320
I'm used to programming 8051s but got a couple of PICs and a programmer.
I spent the last few days learning pic asm for 16F but when I went to program my chip I found a problem with the device. I have a 18F2520 which works in the programmer. My question is, does anyone have code for blinking a led using
a 18F2520? I don't mind if it's C, asm or basic. I'm just anxious to test my programmer and can't find code on the internet.

I've tried this, but it didn't work.
Code:
Device = 18F2520
Clock = 8
Config OSC = INTIO67                // Use the Internal Oscillator

Include "utils.bas"

Dim LED As PORTA.0                  // Assign an alias for "LED"

// Start Of Program...
OSCCON = %01111111                  // Sets up the internal oscillator
SetAllDigital                       // Make all Pins digital I/O's
Low(LED)                            // Make the LED pin an output and set it low

While True

    LED = 1                         // Turn on the LED
   
    DelayMS(500)                    // Delay for half a second
   
    LED = 0                         // Turn off the LED
   
    DelayMS(500)                    // Delay for half a second
   
Wend

Added after 3 hours 7 minutes:

It's ok. I've figured it out.
 

18F2520

what is your compiler?
you can use mikroelektronica pic c complier and write this program, work well
 

Re: 18F2520

Is your code disabling the watchdog? I don't really understand basic language, but it seems that watchdog is active an resets the microcontroler.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top