I am trying to just blink a led to get a feel for this device. I can't seem to do that.
Here is the code I have. I am using internal OSC at 8 mhz and testing on a easypic7 dev board.
It works in Pic18 SIM IDE , but does not on hardware. Looking at the datasheet there is no OSCCON, just OSCTUNE.
Any ideas? Thanks.
Code: Select all
Device = 18F2620
Clock = 8
Config
OSC = INTIO67, // HS oscillator
FCMEN = OFF, // Fail-Safe Clock Monitor disabled
IESO = ON, // Oscillator Switchover mode enabled
PWRT = ON, // PWRT enabled
BOREN = SBORDIS, // Brown-out Reset enabled in hardware only (SBOREN is disabled)
BORV = 3, // Minimum setting
WDT = OFF, // WDT disabled (control is placed on the SWDTEN bit)
WDTPS = 32768, // 1:32768
CCP2MX = PORTC, // CCP2 input/output is multiplexed with RC1
PBADEN = OFF, // PORTB<4:0> pins are configured as digital I/O on Reset
LPT1OSC = OFF, // Timer1 configured for higher power operation
MCLRE = ON, // MCLR pin enabled; RE3 input pin disabled
STVREN = ON, // Stack full/underflow will cause Reset
LVP = ON, // Single-Supply ICSP enabled
XINST = OFF, // Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
DEBUG = OFF, // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
CP0 = OFF, // Block 0 (000800-003FFFh) not code-protected
CP1 = OFF, // Block 1 (004000-007FFFh) not code-protected
CP2 = OFF, // Block 2 (008000-00BFFFh) not code-protected
CP3 = OFF, // Block 3 (00C000-00FFFFh) not code-protected
CPB = OFF, // Boot block (000000-0007FFh) not code-protected
CPD = OFF, // Data EEPROM not code-protected
WRT0 = OFF, // Block 0 (000800-003FFFh) not write-protected
WRT1 = OFF, // Block 1 (004000-007FFFh) not write-protected
WRT2 = OFF, // Block 2 (008000-00BFFFh) not write-protected
WRT3 = OFF, // Block 3 (00C000-00FFFFh) not write-protected
WRTC = OFF, // Configuration registers (300000-3000FFh) not write-protected
WRTB = OFF, // Boot Block (000000-0007FFh) not write-protected
WRTD = OFF, // Data EEPROM not write-protected
EBTR0 = OFF, // Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
EBTR1 = OFF, // Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
EBTR2 = OFF, // Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
EBTR3 = OFF, // Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
EBTRB = OFF // Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
TRISB = 0 'set PortB as output
CMCON = 7 'Disable Comparator
ADCON1 = 7 ' Set analog port to Digital
osctune.6 = 0 'Disable PLL
LATB = 0 ' Set LATB register to 0
' Code below blinks PortB
While true
LATB = 255
DelayMS (500)
LATB = 0
DelayMS (500)
Wend