blink.bas for 18f4520 for newbie - HELP


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Post

    Try something like this ....
    Code:
    <code><font color="#000000">OSCCON = $70            <font color="#000080"><i>'Int CLK 8MHz
    </i></font>OSCTUNE.6 = 1           <font color="#000080"><i>'PLL 4x
    </i></font>ADCON1= %00001111       <font color="#000080"><i>'$0F = disable A/D converter
    
    </i></font>TRISA = %00000000       <font color="#000080"><i>'All pins are outputs
    </i></font>TRISB = %00000000           
    TRISC = %00000000           
    TRISD = %00000000
    TRISE.0 = 0
    TRISE.1 = 0
    TRISE.2 = 0
    
    <b>DEFINE </b>OSC 32            <font color="#000080"><i>'4x 8MHz
    
    </i></font>flip:
    PORTD.0 = 1             <font color="#000080"><i>'Turn on LED
    </i></font><b>PAUSE </b>500               <font color="#000080"><i>'Delay for .5 seconds
    </i></font>PORTD.0 = 0             <font color="#000080"><i>'Turn off LED
    </i></font><b>PAUSE </b>500
    <b>GOTO </b>flip
    
    <b>END</b></code>
    and something like this should be in your 18F4520.INC file ...

    Code:
    <code><font color="#000000">__CONFIG    _CONFIG1H, _OSC_INTIO67_1H
    __CONFIG    _CONFIG2L, _PWRT_ON_2L &amp; _BOREN_OFF_2L
    __CONFIG    _CONFIG2H, _WDT_OFF_2H &amp; _WDTPS_512_2H
    __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
    __CONFIG    _CONFIG4L, _LVP_OFF_4L &amp; _XINST_OFF_4L</code>
    Good luck!

    BR,
    -Gusse-
    Last edited by Gusse; - 15th November 2009 at 00:06.

Similar Threads

  1. Blink.Bas on 18f45k20 Newbie seeks working example.
    By DiscoEd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th December 2009, 03:36
  2. Replies: 3
    Last Post: - 7th June 2008, 21:17
  3. Blink.bas Program
    By merlinknight in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th March 2007, 17:42
  4. blink.bas help cant make any 18f's work
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th December 2004, 21:28
  5. POT Controlling Pause in Blink.bas
    By RossW in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 30th July 2004, 22:17

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts