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=0:portb=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 ;dont insert CLRWDTs
Ry1 var porta.1
rpt1:
ry1=1: pause 500: ry1=0: pause 500 ;flash of Ry1+LED
goto rpt1
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=0:portb=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 ;dont insert CLRWDTs
Ry1 var porta.1
rpt1:
ry1=1: pause 500: ry1=0: pause 500 ;flash of Ry1+LED
goto rpt1