Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pickit2 and 18f43K22

Status
Not open for further replies.

MrDEB

Well-Known Member
this is supported by SF but it is not in the part selection on a pickit2
Thinking just use the 18f13k22 since, as I understand it, the 22 means it is 3v -5v device.
So method to program said device
 
You need to update the PICKIT 2 device file.

You can download it here.

I assure you, the PICKIT 2 works with these devices.

And if you are thinking you can just set the PICKIT to 18F13k22 to program this device, please just stop it. The device selection specifies the memory size, register locations, etc., so that is just dumb.
 
MrDeb said:
Thinking just use the 18f13k22 since, as I understand it, the 22 means it is 3v -5v device.
No... The 22 has two serial ports .. It just happens to be a 5v device...

Before I noticed, The pic18f45k20's I bought were working fine at 5V... I suspect that the tolerance for that model was a tiny bit suspicious so hence the limitation.. They didn't even get warm...
 
Well after I finally got the device file inserted and the pickit2 now is recognized, I get a compile error.
shouldn't be any error but there is
Is there a correct OPTION and CONFIG order?
the config mclr keeps coming up. Didn't have with the 18f43k21 chip.
Research as to WHY
Code:
Device = 18F43k22
Clock = 8
Config MCLRE = off  //COMPILE ERROR??
// some LCD options...
'#option KEYPAD_PORT = PORTc
#option LCD_DATA = PORTD.4
#option LCD_RS = PORTD.0
#option LCD_EN = PORTD.1
// import LCD library...
Include "SetDigitalIO.bas"
'Include "IntOSC8.bas"
Include "LCD.bas"
Include "utils.bas"
'INCLUDE "Keypad16pullup.bas"
Include "Convert.bas"
// include ISR timer module
Include "ISRTimer.bas"
Dim mS As Word
Dim blue As PORTB.7
Dim button As PORTB.4
Dim green As PORTB.5
Dim red As PORTB.6
Dim s As String
 
The 'config' names and settings are derived directly from the Microchip files/databases, so they change to match the device.

Valid choices are contained in the swordfish device file, which in this case would be "18F43K22.bas" in the compiler 'Includes' folder (not that that will ever be consulted, I'm sure)
 
Well am back at it 24 hours later (had some honey do's to take care of).
Will look at the swordfish fdevice file (didn't know one can view).
I found I can cancell out the MCLRE and compile but the LCD now only displays the white squares again.
One thing I am going to look at is the pin out. The same as the 18f4321 in a dip pkg.
 
If you don't specify
Code:
config MCLRE = INTMCLR
then it will default to enabling the MCLR input pin (RE3)

The pinout of the 18F4321 and 18F43K22 will physically be the same but that doesn't mean that the pins need to be setup the same way.

The easiest way to see the device file is to click on the "18F43K22" file in the SF IDE Code Explorer pane. That will open the file in the editor window.
 
I found the device file earlier and now going to experiment with the config setting.
note using same perfboard as with the 18f43k21 so hardware has not changed.
 
tried intmclr as well as the extmclr
neither one worked but can compile.

must be something with the K series? looked over the data sheet and didn't see any reference to the chip voltage setting?. Had similar with different chip and had to use BOR=on
 
note using same perfboard as with the 18f43k21 so hardware has not changed.
You keep confusing me... there is no K series of this type... The pic18f4321 has no direct descendant... Mentally added... At least I can now follow.
 
I use the following config options at the start of my code for K-series devices. Many of the options are a pair of statements – one enables, the other disables, etc. Select the appropriate one and comment out the other.

If you don't know what the options mean, look in the PIC datasheet.

Code:
Config   'for K-series device
    FOSC = HSHP ,'HS oscillator (high power > 16 MHz)
    PLLCFG = Off ,'Oscillator used directly
    PRICLKEN = Off ,'Primary clock can be disabled by software
    FCMEN = Off ,'Fail-Safe Clock Monitor disabled
    IESO = Off ,'Oscillator Switchover mode disabled
    'PWRTEN = Off ,'Power up timer disabled
    PWRTEN = on ,'Power up timer enabled

    BOREN = Off ,'Brown-out Reset disabled in hardware and software
    'BOREN = on ,'Brown-out Reset enabled
    BORV = 285 ,'VBOR set to 2.85 V nominal
    WDTEN = Off ,'Watch dog timer is always disabled. SWDTEN has no effect.
    WDTPS = 256 ,'1:256
    PBADEN = Off ,'PORTB<5:0> pins are configured as digital I/O on Reset
    HFOFST = Off ,'HFINTOSC output and ready status are delayed by the oscillator stable status
    MCLRE = EXTMCLR ,'MCLR pin enabled, RE3 input pin disabled
    'MCLRE = INTMCLR, 'MCLR pin disabled, RE3 input pin enabled
    STVREN = On ,'Stack full/underflow will cause Reset
    'LVP = On ,'Single-Supply ICSP enabled if MCLRE is also 1
    LVP = Off ,'Single-Supply ICSP disabled
    XINST = Off ,'Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    Debug = Off'Disabled

MrDEB, do not make any changes to the device file (which would take some effort since they are write protected). Take it on faith that they are correct.
 
boy am I lost!
looked over the data sheet and getting even more lost.
reconfigured code so JUST an LED is supposed to blink but have yet to get ANY led to even blink.
Have yet any success.
I updated the SETALLDIGITAL which includes the 18f43k22 device.
pouring over data sheet and most looks like geek but trying to understand what each conf statement does.
Beginning to question if I made the right choice for device.
 
Are you using a crystal or the internal oscillator? If you're using the internal oscillator, the first line of my suggested config statements needs to be changed.

If you're using a crystal, do you have 22pF loading caps connected properly?

You make one step ahead followed by a thousand yard dash backwards!
 
If you update the compiler to the latest version (V2.2.3.0) you do not need to update anything else...
it will update all the libraries for you.

The following code works fine for me with no changes to anything... it uses the int osc and an LED on PORTC.3.
Code:
device = 18F43K22
clock = 8

// uncomment the following line if you do NOT have a pullup on the MCLR pin
'config MCLRE = INTMCLR

include "intosc.bas"
include "setdigitalio.bas"

// LED pin
dim LED as PORTC.3

setalldigital()
output(LED)

while (true)
    LED = 1
    delayms(500)
    LED = 0
    delayms(500)
end while
 
am using a crystal and will check on what compiler version.
the SF is 2.2.1.8 the pickit2 is 2.61.00 and 2.32.00
the pickit shows the 18f43k22
will run Tumbleweeds suggestion. Maybe I have other issues and yes the crystal is connected properly.
 
well Tumbleweeds suggestion works. Now to use the crystal instead of internal osc but might not?
Will experiment just for the knowing how
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top