Permalink
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (68 sloc) 2.5 KB
-- ------------------------------------------------------
-- Title: Blink-a-led of the Microchip pic18f4550
--
-- Author: Rob Hamerling, Rob Jansen, Copyright (c) 2008..2018 all rights reserved.
--
-- Adapted-by:
--
-- Revision: $Revision$
--
-- Compiler:2.5
--
-- This file is part of jallib (https://github.com/jallib/jallib)
-- Released under the BSD license (http://www.opensource.org/licenses/bsd-license.php)
--
-- Description:
-- Simple blink-a-led program for Microchip pic18f4550
-- using an external crystal or resonator.
-- The LED should be flashing twice a second!
--
-- Sources:
--
-- Notes:
-- - Creation date/time: Thu Sep 20 19:11:38 2018
-- - This file is generated by 'blink-a-led.py' script! Do not change!
--
-- ------------------------------------------------------
--
include 18f4550 -- target PICmicro
--
-- This program assumes that a 20 MHz resonator or crystal
-- is connected to pins OSC1 and OSC2.
pragma target clock 20_000_000 -- oscillator frequency
--
pragma target OSC HS -- crystal or resonator
pragma target PLLDIV P1 -- clock postscaler
pragma target CPUDIV P1 -- Fosc divisor
pragma target WDT CONTROL -- watchdog
pragma target XINST DISABLED -- do not use extended instructionset
pragma target DEBUG DISABLED -- no debugging
pragma target BROWNOUT DISABLED -- no brownout reset
pragma target FCMEN DISABLED -- no clock monitoring
pragma target IESO DISABLED -- no int/ext osc switching
pragma target VREGEN ENABLED -- voltage regulator used
pragma target LVP DISABLED -- no low voltage programming
pragma target MCLR EXTERNAL -- external reset
--
-- The configuration bit settings above are only a selection, sufficient
-- for this program. Other programs may need more or different settings.
--
WDTCON_SWDTEN = OFF -- disable WDT
OSCCON_SCS = 0 -- select primary oscillator
--
enable_digital_io() -- make all pins digital I/O
--
-- A low current (2 mA) led with 2.2K series resistor is recommended
-- since the chosen pin may not be able to drive an ordinary 20mA led.
--
alias led is pin_A0 -- alias for pin with LED
--
pin_A0_direction = OUTPUT
--
forever loop
led = ON
_usec_delay(100_000)
led = OFF
_usec_delay(400_000)
end loop
--