What is theabsolutely minimal hardware to run BLINK with a PIC18F4620?


Results 1 to 13 of 13

Threaded View

  1. #1

    Default What is theabsolutely minimal hardware to run BLINK with a PIC18F4620?

    I am trying to get a PIC18F4620 to blink a LED.

    I think I have enough hardware bit I cannot get it to work.

    Code:
    '****************************************************************
    ' Name        : BLINK.pbp  Based on the MeLabs code examples for Lab-X1
    ' Compiler    : PICBASIC PRO Compiler 3.0.7.4
    ' IDE            : MCSP 5.0.0.5
    ' Assembler   : MPASM
    ' Target PIC  : 18F4620 in 40 pin PDIP.
    ' Oscillator    : internal IntRC (Clkout) set in Config fuse at code burn time
    ' Programmer  : MeLabs U2 USB 
    ' Keywords    : BLINK LED
    ' Description : Minimal hardware PIC18F4620 in 40 pin DIP
    '****************************************************************
    '
    'The following program is a simple test to blink an LED on and off.  
    ' Hardware    : minimal breadboard  7805, input cap, output cap
    '
    'pin 1 = reset, tied to +5
    'pin 11 +5V     
    'Pin 12 Gnd     
    '1 uF cap between pins 11 & 12
    'Pin 31 Gnd
    'Pin 32 +5V
    '1 uF cap between pins 31 & 32
    'Pin 33 Port B.0 has LED to Gnd via 1k resistor
    'Program is compiled with PBP3.0.7.4 and MCSP 5.0.0.5
    'At program time the IntRC (ClkOut) oscillator is selected.
    
       LED1  VAR  PORTB.0   ' Assign name "LED1" to PORTB.0 on pin 33
    
       OSCCON  = %11111111  '
                ' 0-------  IDLEN 0 = enters SLEEP on Sleep command = 4 uA
                ' 1-------  Enters IDLE and draws 550 uA
                ' -111----  IRCF <2:0> Int Osc freq select 111 = 8 MHz
                ' ----0---  OSTS Osc Startup Status - read only - ignore
                ' -----0--  IOFS IntOsc Freq Stable  - read only - ignore
                ' ------00  System Clock Select 00 = Primary Osc
       WDTCON  = %00000001  ' enables SWDT - needs WDT OFF in config 
                ' xxxxxxx1  SWDTEN  software controlled WDT enabled
       ADCON0  = %00000000  ' ADC OFF
                ' xx0000--  CH<3:0> select analog channels
                ' ------0-  1 = Go, 0 = Done
                ' -------0  1 = ADC ON, 0 = ADC OFF
       ADCON1 = %00001111 'VRefs = Vdd & Vss, All ports digital  
                ' 00------  unimplimented                 
                ' --00----  VCFG<1:0> Select Vcc & Gnd as ADC references
                ' ----0110  PCFG<3:0> A/D Port configuration see register 19-2 
    '   ADCON2  = %00111111 'Left just (=8 bit), ADacq time = 20 Tad, ADClk = Frc   
                ' 0-------  ADFM 0 = Left Justified 8 bit mode
                ' -x111---  ACQ<2:0> A/D acquisition time = 20 Tad
                ' -----111  ADCS<2:0> A/D conversion clock select = Fr/c
       CMCON   = %00000111  ' Comparators OFF 
                ' 00------  No comparator outputs
                ' --00----  No inversion on outputs
                ' ----0---  Vin to pins AN0 & AN1
                ' -----111  Comparators OFF 
    
    mainloop:
       High LED1        ' Turn on LED connected to PORTB.0
       Pause 500       ' Delay for .5 seconds
    
       Low LED1         ' Turn off LED connected to PORTB.0
       Pause 500       ' Delay for .5 seconds
    
       Goto mainloop   ' Go back to loop and blink LED forever
       
       End
    When I program the PIC I select INTRC(ClkOut) as the clock option

    Any help gratefully received.
    Thanks
    BrianT
    Last edited by Archangel; - 30th October 2013 at 02:01. Reason: code tags

Similar Threads

  1. ADCIN with PIC18F4620
    By Brian J Walsh in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th July 2008, 01:25
  2. PIC18F4620 Troubles
    By CluckShot in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 16th May 2007, 03:02
  3. pic18f4620 and flashlab77
    By igeorge in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th November 2006, 01:00
  4. LCD + keyboard matrix minimal I/O
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st June 2006, 19:49
  5. Sound and sound control with minimal parts
    By bartman in forum General
    Replies: 23
    Last Post: - 18th January 2005, 14:08

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