18F1220 newbie


Results 1 to 17 of 17

Thread: 18F1220 newbie

Threaded View

  1. #1
    Join Date
    Nov 2011
    Posts
    18

    Default 18F1220 newbie

    Hi All, I am trying to convert a 16F88 program to run on a 18F1220. For starters I tried the attached blink LED program but can't get it to work.
    I'm using Pickit2, Microcode Studio and MPASM ver. 5.20.
    Please look at my code and tell me what I'm doing wrong. I've spent more than 6 hours searching through the data sheet and PBP manual
    but to no avail.
    Ta
    Hebe
    '--------------------------------------------------------------------------
    'Blinking LED
    '######## SETUP ################################################## ##############

    porta=0ortb=0 'set ports to 0 then do trises
    trisb= %00001100 'portb.2&3 inputs. The rest are outputs
    trisa= %00111100 'porta.2-5 inputs. The rest are outputs
    WDTCON = 0 ;WDT off
    ADCON0 = %00000000 ;ADC off
    ADCON1 = %01111111 ;All pins digital
    LVDCON = %00000000 ;LVD off
    CCP1CON = %00000000 ;CCP/PWM off
    OSCCON = %01110000 ;RUN mode,8MHZ,INT OSC
    RCON = %00000000 ;Prioritys off
    EECON1 = %00000100 ;Access flash
    INTCON2 = %10000000 ;Disable PORTB pullups
    INTCON3 = %00000000 ;INT1&2 disabled
    PIE1 = %00000000 ;Disable A/D,EUSART,CCP,TMR2,TMR1 overflow ints
    PIE2 = %00000000 ;Disable OSC Fail,EEPROM,LVD,TMR3 overflow ints
    IPR1 = %00000000 ;A/D,EUSART,CCP,TMR2,TMR1 low priority
    IPR2 = %00000000 ;OSC Fail,EEPROM,LVD,TMR3 ints low priority
    RCON = %00000000 ;Disable priority levels
    T0CON = %00000000 ;TMR0 off
    T1CON = %00000000 ;TMR1 off
    T2CON = %00000000 ;TMR2 off
    T3CON = %00000000 ;TMR3 off
    TXSTA = %00000000 ;Transmit disabled
    RCSTA = %00000000 ;Receive disabled

    @ CONFIG IESO=OFF & FSCM=OFF & INTIO2_OSC_1H
    @ CONFIG PWRT=ON & BOR=OFF & BORV=27
    @ CONFIG WDT=OFF & WDTPS=32K
    @ CONFIG MCLRE=OFF
    @ CONFIG DEBUG=OFF & LVP=OFF & STVR=OFF
    @ CONFIG CP0=OFF & CP1=OFF
    @ CONFIG CPB=OFF & CPD=OFF
    @ CONFIG WRT0=OFF & WRT1=OFF
    @ CONFIG WRTC=OFF & WRTB=OFF & WRTD=OFF
    @ CONFIG EBTR0=OFF & EBTR1=OFF
    @ CONFIG EBTRB=OFF

    define OSC 8 ;8Mhz clock. osccon and define osc must be set
    osccon=%01111000 ;the same for correct program timing + OSTS=1
    'define OSC 4 ;4Mhz clock. osccon and define osc must be set
    'OSCCON=%01101000 ;the same for correct program timing + OSTS=1
    DEFINE NO_CLRWDT 1 ;don’t insert CLRWDTs


    Ry1 var porta.1




    rpt1:
    ry1=1: pause 500: ry1=0: pause 500 ;flash of Ry1+LED
    goto rpt1
    Attached Files Attached Files

Similar Threads

  1. 18F1220 A/D Converter
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 31st May 2011, 16:50
  2. 18F1220 fuse help
    By mr.sneezy in forum General
    Replies: 6
    Last Post: - 24th May 2010, 14:54
  3. 18F1220 LCD and Sleep
    By jderson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 13th July 2008, 18:58
  4. 18F1220 and DT Instant Interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th June 2008, 05:37
  5. Sleep command with 18F1220
    By suded in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th April 2005, 11:11

Members who have read this thread : 1

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