/*
* deviceRW.c - Read-write calls for various devices
* Copyright (C) 2010-2022 Alberto Maccioni
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
* or see
*/
//configure for GUI or command-line
#include "common.h"
#include "progP12.h"
#include "progP16.h"
#include "progP18.h"
#include "progP24.h"
#include "progEEPROM.h"
#include "progAVR.h"
//#include "progP32.h"
#ifdef __GTK_H__
#define _GTKGUI
#endif
#include "deviceRW.h"
char* devices[]={
"10F200","10F202","10F204","10F206","10F220","10F222",
"10F320","10F322",
"12C508","12C508A","12C509","12C509A","12F508","12F509","12F510","12F519",
"12F609","12F615","12F617","12F629","12F635","12C671","12C672","12CE673","12CE674","12F675","12F683",
"12F752",
"12F529T39","12F529T48",
"12F1501","12F1571","12F1572","12F1612","12F1822","12F1840",
"16F505","16F506","16F526","16F527","16F54","16F57","16F570","16F59",
"16F610","16F616","16F627","16F627A","16F628","16F628A","16F630","16F631",
"16F636","16F639","16F648A","16F676","16F677","16F684","16F685","16F687",
"16F688","16F689","16F690",
"16F707","16F716","16F72","16F720","16F721","16F722","16F722A","16F723","16F723A",
"16F724","16F726","16F727","16F73","16F737","16F74","16F747","16F753","16F76",
"16F767","16F77","16F777","16F785",
"16F818","16F819","16C83","16F83","16F83A","16C84","16F84","16F84A","16F87","16F870","16F871","16F872",
"16F873","16F873A","16F874","16F874A","16F876","16F876A","16F877","16F877A",
"16F88","16F882","16F883","16F884","16F886","16F887",
"16F913","16F914","16F916","16F917","16F946",
"16F1454","16F1455","16F1459",
"16F1503","16F1507","16F1508","16F1509","16F1512","16F1513","16F1516","16F1517","16F1518","16F1519",
"16F1526","16F1527","16LF1554","16LF1559","16F1574","16F1575","16F1578","16F1579",
"16F1613","16F1614","16F1615","16F1618","16F1619",
"16F1703","16F1704","16F1705","16F1707","16F1708","16F1709","16F1713","16F1716","16F1717","16F1718","16F1719",
"16F1764","16F1765","16F1768","16F1769","16F1773","16F1776","16F1777","16F17784","16F1779",
"16F1782","16F1783","16F1784","16F1786","16F1787","16F1788","16F1789",
"16F1823","16F1824","16F1825","16F1826","16F1827","16F1828","16F1829","16F1847",
"16LF1902","16LF1903","16LF1904","16LF1906","16LF1907",
"16F1933","16F1934","16F1936","16F1937","16F1938","16F1939","16F1946","16F1947",
"16F15213","16F15214","16F15223""16F15224","16F15225","16F15243","16F15244","16F15245",
"16F15254","16F15255","16F15256","16F15274","16F15275","16F15276",
"16F15313","16F15323","16F15324","16F15325","16F15344","16F15345","16F15354","16F15355","16F15356",
"16F15375","16F15376","16F15385","16F15386",
"16F17114","16F17115","16F17124","16F17125","16F17126","16F17144","16F17145","16F17146",
"16F17154","16F17155","16F17156","16F17174","16F17175","16F17176",
"16F18013","16F18014","16F18015","16F18023","16F18024","16F18025","16F18026","16F18044","16F18045","16F18046",
"16F18054","16F18055","16F18056","16F18074","16F18075","16F18076",
"16F18114","16F18115","16F18124","16F18125","16F18126","16F18144","16F18145","16F18146",
"16F18154","16F18155","16F18156","16F18174","16F18175","16F18176",
"16F18313","16F18323","16F18324","16F18325","16F18326","16F18344","16F18345","16F18346",
"16F18424","16F18425","16F18426","16F18444","16F18445","16F18446","16F18455","16F18456",
"16F18854","16F18855","16F18856","16F18857","16F18875","16F18876","16F18877",
"16F19155","16F19156","16F19175","16F19176","16F19185","16F19186","16F19195","16F19196","16F19197",
"18F04Q40","18F04Q41","18F05Q40","18F05Q41","18F06Q40","18F06Q41","18F14Q40","18F14Q41","18F15Q40","18F15Q41","18F16Q40","18F16Q41",
"18F242","18F248","18F252","18F258","18F442","18F448","18F452","18F458",
"18F1220","18F1230","18F1320","18F1330","18F13K22","18F13K50","18F14K22","18F14K50",
"18F2220","18F2221","18F2320","18F23K20","18F23K22","18F2321","18F2331","18F2410",
"18F24J10","18F24J11","18F2420","18F24K20","18F24K22","18F2423","18F2431","18F2439",
"18F2450","18F24J50","18F24K50","18F2455","18F2458","18F24Q71","18F2480",
"18F2510","18F25J10","18F25J11","18F2515","18F2520","18F25K20","18F25K22","18F2523",
"18F2525","18F2539","18F25K42","18F25Q43","18F2550","18F25J50","18F25K50","18F2553","18F25Q71","18F2580","18F25K80","18F25K83","18F2585",
"18F2610","18F26J11","18F26J13","18F2620","18F26K20","18F26K22","18F26K42","18F26Q43","18F26J50","18F26K50",
"18F26J53","18F26Q71","18F2680","18F26K80","18F2682","18F26K83","18F26Q83","18F26Q84","18F2685",
"18F27J13","18F27K42","18F27Q43","18F27J53","18F27Q83","18F27Q84",
"18F4220","18F4221","18F4320","18F43K20","18F43K22","18F4321","18F4331",
"18F4410","18F44J10","18F44J11","18F4420","18F44K20","18F44K22","18F4423","18F4431",
"18F4439","18F4450","18F44J50","18F4455","18F4458","18F44Q71","18F4480",
"18F4510","18F45J10","18F45J11","18F4515","18F4520","18F45K20","18F45K22","18F4523",
"18F4525","18F4539","18F45K42","18F45Q43","18F4550","18F45J50","18F45K50","18F4553","18F45Q71","18F4580","18F45K80","18F4585",
"18F4610","18F46J11","18F46J13","18F4620","18F46K20","18F46K22","18F46K42","18F46Q43","18F46J50","18F46K50",
"18F46J53","18F46Q71","18F4680","18F46K80","18F4682","18F46Q83","18F46Q84","18F4685",
"18F47J13","18F47K42","18F47Q43","18F47J53","18F47Q83","18F47Q84",
"18F54Q71","18F55K42","18F55Q43","18F55Q71","18F56K42","18F56Q43","18F56Q71","18F56Q83","18F56Q84","18F57K42","18F57Q43","18F57Q83","18F57Q84",
"18F63J11","18F63J90","18F64J11","18F64J90",
"18F65J10","18F65J11","18F65J15","18F65J50","18F65J90","18F65K80",
"18F66J10","18F66J11","18F66J15","18F66J16","18F66J50","18F66J55","18F66J60","18F66J65","18F66J90","18F66J93",
"18F67J10","18F67J11","18F67J50","18F67J60","18F66K80","18F67J90","18F67J93",
"18F83J11","18F83J90","18F84J11","18F84J90","18F85J10","18F85J11","18F85J15","18F85J50","18F85J90",
"18F8520","18F86J10","18F86J11","18F86J15","18F86J16","18F86J50","18F86J55","18F86J60","18F86J65",
"18F86J72","18F86J90","18F86J93",
"18F8722","18F87J10","18F87J11","18F87J50","18F87J60","18F87J72","18F87J90","18F87J93",
"18F96J60","18F96J65","18F97J60",
"24F04KA200","24F04KA201",
"24F08KA101","24F08KA102",
"24F16KA101","24F16KA102",
"24FJ16GA002","24FJ16GA004",
"24FJ32GA002","24FJ32GA004","24FJ32GA102","24FJ32GA104",
"24FJ32GB002","24FJ32GB004",
"24FJ48GA002","24FJ48GA004",
"24FJ64GA002","24FJ64GA004","24FJ64GA006","24FJ64GA008","24FJ64GA010",
"24FJ64GA102","24FJ64GA104","24FJ64GA306","24FJ64GA308","24FJ64GA310",
"24FJ64GB002","24FJ64GB004","24FJ64GB106","24FJ64GB108","24FJ64GB110",
"24FJ64GC006","24FJ64GC008","24FJ64GC010",
"24FJ96GA006","24FJ96GA008","24FJ96GA010",
"24FJ128GA006","24FJ128GA008","24FJ128GA010","24FJ128GA106","24FJ128GA108","24FJ128GA110",
"24FJ128GA306","24FJ128GA308","24FJ128GA310",
"24FJ128GB106","24FJ128GB108","24FJ128GB110","24FJ128GB206","24FJ128GB210",
"24FJ128GC006","24FJ128GC008","24FJ128GC010",
"24FJ128DA106","24FJ128DA110","24FJ128DA206","24FJ128DA210",
"24FJ192GA106","24FJ192GA108","24FJ192GA110",
"24FJ192GB106","24FJ192GB108","24FJ192GB110",
"24FJ256GA106","24FJ256GA108","24FJ256GA110",
"24FJ256GB106","24FJ256GB108","24FJ256GB110",
"24FJ256GB206","24FJ256GB210",
"24FJ256DA106","24FJ256DA110","24FJ256DA206","24FJ256DA210",
"24EP32GP202","24EP32GP203","24EP32GP204",
"24EP32MC202","24EP32MC203","24EP32MC204",
"24EP64GP202","24EP64GP203","24EP64GP204","24EP64GP206",
"24EP64MC202","24EP64MC203","24EP64MC204","24EP64MC206",
"24EP128GP202","24EP128GP204","24EP128GP206",
"24EP128MC202","24EP128MC204","24EP128MC206",
"24EP256GP202","24EP256GP204","24EP256GP206",
"24EP256MC202","24EP256MC204","24EP256MC206",
"24EP512GP202","24EP512GP204","24EP512GP206",
"24EP512MC202","24EP512MC204","24EP512MC206",
"24HJ12GP201","24HJ12GP202",
"24HJ16GP304",
"24HJ32GP202","24HJ32GP204","24HJ32GP302","24HJ32GP304",
"24HJ64GP202","24HJ64GP204","24HJ64GP206","24HJ64GP210","24HJ64GP502",
"24HJ64GP504","24HJ64GP506","24HJ64GP510",
"24HJ128GP202","24HJ128GP204","24HJ128GP206","24HJ128GP210",
"24HJ128GP306","24HJ128GP310","24HJ128GP502","24HJ128GP504","24HJ128GP506","24HJ128GP510",
"24HJ256GP206","24HJ256GP210","24HJ256GP610",
"30F1010","30F2010","30F2011","30F2012","30F2020","30F2023",
"30F3010","30F3011","30F3012","30F3013","30F3014",
"30F4011","30F4012","30F4013",
"30F5011","30F5013","30F5015","30F5016",
"30F6010","30F6011","30F6012","30F6013","30F6014","30F6015",
//"32MX270F256",
"33FJ06GS101","33FJ06GS102","33FJ06GS202",
"33FJ12GP201","33FJ12GP202","33FJ12MC201","33FJ12MC202",
"33FJ16GP304","33FJ16GS402","33FJ16GS404","33FJ16GS502","33FJ16GS504","33FJ16MC304",
"33FJ32GP202","33FJ32GP204","33FJ32GP302","33FJ32GP304",
"33FJ32GS406","33FJ32GS606","33FJ32GS608","33FJ32GS610",
"33FJ32MC202","33FJ32MC204","33FJ32MC302","33FJ32MC304",
"33FJ64GP202","33FJ64GP204","33FJ64GP206","33FJ64GP306","33FJ64GP310",
"33FJ64GP706","33FJ64GP708","33FJ64GP710","33FJ64GP802","33FJ64GP804",
"33FJ64GS406","33FJ64GS606","33FJ64GS608","33FJ64GS610",
"33FJ64MC202","33FJ64MC204","33FJ64MC506","33FJ64MC508","33FJ64MC510",
"33FJ64MC706","33FJ64MC710","33FJ64MC802","33FJ64MC804",
"33FJ128GP202","33FJ128GP204","33FJ128GP206","33FJ128GP306","33FJ128GP310","33FJ128GP706",
"33FJ128GP708","33FJ128GP710","33FJ128GP802","33FJ128GP804",
"33FJ128MC202","33FJ128MC204","33FJ128MC506","33FJ128MC510","33FJ128MC706","33FJ128MC708",
"33FJ128MC710","33FJ128MC802","33FJ128MC804",
"33FJ256GP506","33FJ256GP510","33FJ256GP710",
"33FJ256MC510","33FJ256MC710",
"33EP32GP502","33EP32GP503","33EP32GP504",
"33EP32MC202","33EP32MC203","33EP32MC204","33EP32MC502","33EP32MC503","33EP32MC504",
"33EP64GP502","33EP64GP503","33EP64GP504","33EP64GP506",
"33EP64MC202","33EP64MC203","33EP64MC204","33EP64MC206","33EP64MC502","33EP64MC503","33EP64MC504","33EP64MC506",
"33EP128GP502","33EP128GP504","33EP128GP506",
"33EP128MC202","33EP128MC204","33EP128MC206","33EP128MC502","33EP128MC504","33EP128MC506",
"33EP256GP502","33EP256GP504","33EP256GP506",
"33EP256MC202","33EP256MC204","33EP256MC206","33EP256MC502","33EP256MC504","33EP256MC506",
"33EP512GP502","33EP512GP504","33EP512GP506",
"33EP512MC202","33EP512MC204","33EP512MC206","33EP512MC502","33EP512MC504","33EP512MC506",
"AT90S1200","AT90S2313",
"AT90S8515","AT90S8535","ATmega48","ATmega8","ATmega88","ATmega8515",
"ATmega8535","ATmega16","ATmega164","ATmega168","ATmega32","ATmega324",
"ATmega328","ATmega64","ATmega644","ATmega1284",
"ATtiny11","ATtiny12","ATtiny13",
"ATtiny2313","ATtiny24","ATtiny25","ATtiny26","ATtiny261","ATtiny4313","ATtiny44","ATtiny45",
"ATtiny461","ATtiny48","ATtiny84","ATtiny85","ATtiny88","ATtiny861",
"2400","2401","2402","2404","2408","2416","2432","2464","24128","24256","24512","241024","241025",
"25010","25020","25040","25080","25160","25320","25640","25128","25256","25512","251024",
"95010","95020","95040","95080","95160","95320","95640","95128","95256","95512","95M01","95M02",
"251005","252005","254005","258005","251605",
"25X05","25X10","25X20","25X40","25X80","25X16","25X32","25X64","25X128","25Q40",
"93S46","93x46","93x46A","93S56","93x56","93x56A","93S66","93x66", "93x66A","93x76","93x76A","93x86","93x86A",
"DS2430","DS2431","DS2433","DS28EC20","DS1820",
"11010","11020","11040","11080","11160"
};
int Ndevices=sizeof(devices)/sizeof(char*);
struct DEVICES DEVLIST[]={
//-------------PIC10-16---------------------------------------------------------
{"10F200,10F204,10F220",
PIC12,13.0,0,Read12F5xx,{0x100,5},0x40,Write12F5xx,{0x100,0xFF},0}, //256
{"10F320",
PIC16,9.0,1,Read16Fxxx,{0x100,0,10,0},0x80,Write12F6xx,{0x100,0,-10},0}, //256, vpp, 3.3V
{"12C508,12C508A",
PIC12,13.0,0,Read12F5xx,{0x200,4},0x40,Write12C5xx,{0x200,0},0}, //512
{"12F508,10F202,10F206,10F222",
PIC12,13.0,0,Read12F5xx,{0x200,5},0x40,Write12F5xx,{0x200,0x1FF},0}, //512
{"16F54",
PIC12,13.0,0,Read12F5xx,{0x200,4},0x40,Write12F5xx,{0x200,-1},0}, //512, no osccal
{"10F322",
PIC16,9.0,1,Read16Fxxx,{0x200,0,10,0},0x80,Write12F6xx,{0x200,0,-10},0}, //512, vpp, 3.3V
{"12C509,12C509A",
PIC12,13.0,0,Read12F5xx,{0x400,4},0x40,Write12C5xx,{0x400,0},0}, //1K
{"12F509,12F510,16F505,16F506",
PIC12,13.0,0,Read12F5xx,{0x400,5},0x40,Write12F5xx,{0x400,0x3FF},0}, //1K
{"12F519,16F526,16F527",
PIC12,13.0,0,Read12F5xx,{0x440,8},0x60,Write12F5xx,{0x440,0x3FF},0}, //1K + 64
{"12F529T39,12F529T48",
PIC12,13.0,0,Read12F5xx,{0x640,8},0x78,Write12F5xx,{0x640,0x5FF},0}, //1.5K + 64
{"16F57,16F59",
PIC12,13.0,0,Read12F5xx,{0x800,4},0x40,Write12F5xx,{0x800,-1},0}, //2K
{"16F570",
PIC12,13.0,0,Read12F5xx,{0x840,8},0x70,Write12F5xx,{0x840,0x7FF},0}, //2K + 64
{"16C83,16F83,16F83A",
PIC16,13.0,0,Read16Fxxx,{0x200,0x40,8,1},0x10,Write16F8x,{0x200,0x40,-10},0}, //512, 64, vdd
{"12C671,12CE673",
PIC16,13.0,0,Read16Fxxx,{0x400,0,0,0},0x100,0,{},0}, //1K, vpp
{"12F1501",
PIC16,8.5,1,Read16F1xxx,{0x400,0,11,0},0x100,Write16F1xxx,{0x400,0,0},0}, //1K, vpp, 3.3V
{"12F1571",
PIC16,8.5,1,Read16F1xxx,{0x400,0,12,0},0x200,Write16F1xxx,{0x400,0,0},0}, //1K, vpp, 3.3V
{"12F609,12F615,16F610",
PIC16,13.0,0,Read16Fxxx,{0x400,0,9,0},0x40,Write12F61x,{0x400,0,0},0}, //1K, vpp, cal1
{"12F752",
PIC16,13.0,0,Read16Fxxx,{0x400,0,10,0},0x80,Write12F61x,{0x400,0,0},0}, //1K, vpp, cal1
{"16C84,16F84,16F84A",
PIC16,13.0,0,Read16Fxxx,{0x400,0x40,8,1},0x10,Write16F8x,{0x400,0x40,-10},0}, //1K, 64, vdd
{"12F635",
PIC16,13.0,0,Read16Fxxx,{0x400,0x80,10,0},0x80,Write12F6xx,{0x400,0x80,-10},0}, //1K, 128, vpp, cal1 + cal2
{"16F631",
PIC16,13.0,0,Read16Fxxx,{0x400,0x80,9,0},0x80,Write12F6xx,{0x400,0x80,-10},0}, //1K, 128, vpp, cal1
{"12F629,12F675,16F630,16F676",
PIC16,13.0,0,Read16Fxxx,{0x400,0x80,8,0},0x20,Write12F62x,{0x400,0x80,-10},0}, //1K, 128, vpp
{"16F627",
PIC16,13.0,0,Read16Fxxx,{0x400,-0x80,8,0},0x10,Write16F62x,{0x400,0x80,-10},0}, //1K, 128, vpp, ee@0x2200
{"16F627A",
PIC16,13.0,0,Read16Fxxx,{0x400,0x80,8,0},0x10,Write12F6xx,{0x400,0x80,-10},0}, //1K, 128, vpp
{"16F818",
PIC16,13.0,0,Read16Fxxx,{0x400,0x80,8,2},0x10,Write16F81x,{0x400,0x80,-10},0}, //1K, 128, vdd short delay
{"16F72",
PIC16,8.5,1,Read16Fxxx,{0x800,0,8,1},0x20,Write16F7x,{0x800,0,-10},0}, //2K, vdd, 3.3V
{"16F720,16F722,16F722A",
PIC16,13.0,0,Read16Fxxx,{0x800,0,11,0},0x100,Write16F72x,{0x800,0,0},0}, //2K, vpp, config1-2 + cal1-2, 3.3V
{"12C672,12CE674",
PIC16,13.0,0,Read16Fxxx,{0x800,0,0,0},0x100,0,{},0}, //2K, vpp
{"16F716",
PIC16,13.0,0,Read16Fxxx,{0x800,0,8,2},8,Write16F71x,{0x800,1,-10},0}, //2K, vdd
{"16F616,12F617",
PIC16,13.0,0,Read16Fxxx,{0x800,0,9,0},0x40,Write12F61x,{0x800,0,0},0}, //2K, vpp, cal1
{"16F753",
PIC16,12.5,0,Read16Fxxx,{0x800,0,10,0},0x80,Write12F61x,{0x800,0,0},0}, //2K, vpp, cal1
{"16LF1902,16F1503,16F1507,16F1512",
PIC16,8.5,1,Read16F1xxx,{0x800,0,11,0},0x200,Write16F1xxx,{0x800,0,0},0}, //2K, vpp, 3.3V
{"12F1572",
PIC16,8.5,1,Read16F1xxx,{0x800,0,12,0},0x200,Write16F1xxx,{0x800,0,0},0}, //2K, vpp, 3.3V
{"16F1703,16F1707",
PIC16,8.5,1,Read16F1xxx,{0x800,0,13,0},0x200,Write16F1xxx,{0x800,0,0},0}, //2K, vpp, 3.3V
{"12F1612,16F1613",
PIC16,8.5,1,Read16F1xxx,{0x800,0,13,4},0x200,Write16F1xxx,{0x800,0,4},0}, //2K, vpp, 3.3V
{"16F15213,16F15223,16F15243,16F15313,16F15323",
PIC16,8.5,1,Read16F18xxx,{0x800,0,0,0},0,Write16F18xxx,{0x800,0,0},0}, //2K, vpp, 3.3V, 8b commands
{"16F870,16F871,16F872",
PIC16,13.0,0,Read16Fxxx,{0x800,0x40,8,1},0x100,Write16F87x,{0x800,0x40,-10},0}, //2K, 64, vdd
{"16F628",
PIC16,13.0,0,Read16Fxxx,{0x800,-0x80,8,0},0x10,Write16F62x,{0x800,0x80,-10},0}, //2K, 128, vpp, ee@0x2200
{"16F628A",
PIC16,13.0,0,Read16Fxxx,{0x800,0x80,8,0},0x10,Write12F6xx,{0x800,0x80,-10},0}, //2K, 128, vpp
{"16F882",
PIC16,13.0,0,Read16Fxxx,{0x800,0x80,10,0},0x80,Write16F88x,{0x800,0x80,-10},0}, //2K, 128, vpp, config2 + cal1
{"16F819",
PIC16,13.0,0,Read16Fxxx,{0x800,0x100,8,2},0x10,Write16F81x,{0x800,0x100,-10},0}, //2K, 256, vdd short delay
{"12F683,16F684",
PIC16,13.0,0,Read16Fxxx,{0x800,0x100,9,0},0x40,Write12F6xx,{0x800,0x100,-10},0}, //2K, 256, vpp, cal1
{"16F636,16F639,16F785",
PIC16,13.0,0,Read16Fxxx,{0x800,0x100,10,0},0x40,Write12F6xx,{0x800,0x100,-10},0}, //2K, 256, vpp, cal1 + cal2
{"16F677,16F687",
PIC16,13.0,0,Read16Fxxx,{0x800,0x100,9,0},0x80,Write12F6xx,{0x800,0x100,-10},0}, //2K, 256, vpp, cal1
{"12F1822,16F1823,16F1826",
PIC16,8.5,1,Read16F1xxx,{0x800,0x100,11,0},0x200,Write16F1xxx,{0x800,0x100,0},0}, //2K, 256, vpp, 3.3V
{"16F1782",
PIC16,8.5,1,Read16F1xxx,{0x800,0x100,19,0},0x200,Write16F1xxx,{0x800,0x100,0},0}, //2K, 256, vpp, 3.3V
{"16F18313,16F18323",
PIC16,8.5,1,Read16F1xxx,{0x800,0x100,11,0x1C},0x20,Write16F1xxx,{0x800,0x100,0x1C},0}, //2K, 256, vpp, 3.3V, new cmd
{"16F18013,16F18023",
PIC16,8.5,1,Read16F18xxx,{0x800,1,0,0},0,Write16F18xxx,{0x800,0x100,0},0}, //2K, 256, vpp, 3.3V, 8b commands
{"16F73,16F74",
PIC16,13.0,0,Read16Fxxx,{0x1000,0,8,1},0x20,Write16F7x,{0x1000,0,-10},0}, //4K, vdd
{"16F737,16F747",
PIC16,13.0,0,Read16Fxxx,{0x1000,0,9,2},9,Write16F7x,{0x1000,1,-10},0}, //4K, vdd short/no delay
{"16F721,16F723,16F723A,16F724",
PIC16,13.0,0,Read16Fxxx,{0x1000,0,11,0},0x100,Write16F72x,{0x1000,0,0},0}, //4K, vpp, config1-2 + cal1-2, 3.3V
{"16LF1903,16LF1904,16F1508,16F1513,16LF1554",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,11,0},0x200,Write16F1xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V
{"16F1574,16F1578",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,12,0},0x200,Write16F1xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V
{"16F1704,16F1708",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,13,0},0x200,Write16F1xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V
{"16F1614,16F1618",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,13,4},0x200,Write16F1xxx,{0x1000,0,4},0}, //4K, vpp, 3.3V
{"16F1713",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,17,0},0x200,Write16F1xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V
{"16F1783,16F1784",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,19,0},0x200,Write16F1xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V
{"16F1764,16F1768",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,20,0},0x200,Write16F1xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V
{"16F1773",
PIC16,8.5,1,Read16F1xxx,{0x1000,0,24,0},0x200,Write16F1xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V
{"16F15214,16F15224,16F15244,16F15254,16F15274,16F15324,16F15344,16F15354",
PIC16,8.5,1,Read16F18xxx,{0x1000,0,0,0},0,Write16F18xxx,{0x1000,0,0},0}, //4K, vpp, 3.3V, 8b commands
{"16F873A,16F874A",
PIC16,13.0,0,Read16Fxxx,{0x1000,0x80,8,1},0x100,Write16F87xA,{0x1000,0x80,1},0}, //4K, 128, vdd
{"16F873,16F874",
PIC16,13.0,0,Read16Fxxx,{0x1000,-0x80,8,1},0x100,Write16F87x,{0x1000,-0x80,-10},0}, //4K, 128, vdd, ee@0x2200
{"16F685,16F689,16F690",
PIC16,13.0,0,Read16Fxxx,{0x1000,0x100,9,0},0x80,Write12F6xx,{0x1000,0x100,-10},0}, //4K, 256, vpp, cal1
{"16F688",
PIC16,13.0,0,Read16Fxxx,{0x1000,0x100,9,0},0x40,Write12F6xx,{0x1000,0x100,-10},0}, //4K, 256, vpp, cal1
{"16F883,16F884",
PIC16,13.0,0,Read16Fxxx,{0x1000,0x100,10,0},0x80,Write16F88x,{0x1000,0x100,-10},0}, //4K, 256, vpp, config2 + cal1
{"16F648A",
PIC16,13.0,0,Read16Fxxx,{0x1000,0x100,8,0},0x10,Write12F6xx,{0x1000,0x100,-10},0}, //4K, 256, vpp
{"16F87,16F88",
PIC16,13.0,0,Read16Fxxx,{0x1000,0x100,9,2},0x10,Write16F81x,{0x1000,0x100,-10},0}, //4K, 256, vdd short delay
{"16F913,16F914",
PIC16,13.0,0,Read16Fxxx,{0x1000,0x100,10,0},0x40,Write12F6xx,{0x1000,0x100,-10},0}, //4K, 256, vpp, cal1 + cal2
{"16F1933,16F1934,16F1824,16F1827,16F1828,12F1840",
PIC16,8.5,1,Read16F1xxx,{0x1000,0x100,11,0},0x200,Write16F1xxx,{0x1000,0x100,0},0}, //4K, 256, vpp, 3.3V
{"16F18324,16F18344",
PIC16,8.5,1,Read16F1xxx,{0x1000,0x100,11,0x1C},0x20,Write16F1xxx,{0x1000,0x100,0x1C},0}, //4K, 256, vpp, 3.3V, new cmd
{"16F17114,16F17124,16F17144,16F17154,16F17174,16F18014,16F18024,16F18044,16F18054,16F18074,16F18114,16F18124,16F18144,\
16F18154,16F18174,16F18424,16F18444",
PIC16,8.5,1,Read16F18xxx,{0x1000,1,0,0},0,Write16F18xxx,{0x1000,0x100,0},0}, //4K, 256, vpp, 3.3V, 8b commands
{"16F18854",
PIC16,8.5,1,Read16F18xxx,{0x1000,0x100,0,0x10},0,Write16F18xxx,{0x1000,0x100,0x10},0}, //4K, 256, vpp, 3.3V, 8b commands no DIA
{"16F76,16F77",
PIC16,13.0,0,Read16Fxxx,{0x2000,0,8,1},0x20,Write16F7x,{0x2000,0,-10},0}, //8K, vdd
{"16F767,16F777",
PIC16,13.0,0,Read16Fxxx,{0x2000,0,9,2},0x40,Write16F7x,{0x2000,1,-10},0}, //8K, vdd short delay
{"16F726,16F727,16F707",
PIC16,8.5,1,Read16Fxxx,{0x2000,0,11,0},0x100,Write16F72x,{0x2000,0,0},0}, //8K, vpp, config1-2 + cal1-2, 3.3V
{"16LF1906,16LF1907,16F1509,16F1454,16F1455,16F1459,16F1516,16F1517,16F1526,16LF1559",
PIC16,8.5,1,Read16F1xxx,{0x2000,0,11,0},0x200,Write16F1xxx,{0x2000,0,0},0}, //8K, vpp, 3.3V
{"16F1575,16F1579",
PIC16,8.5,1,Read16F1xxx,{0x2000,0,12,0},0x200,Write16F1xxx,{0x2000,0,0},0}, //8K, vpp, 3.3V
{"16F1705,16F1709",
PIC16,8.5,1,Read16F1xxx,{0x2000,0,13,0},0x200,Write16F1xxx,{0x2000,0,0},0}, //8K, vpp, 3.3V
{"16F1615,16F1619",
PIC16,8.5,1,Read16F1xxx,{0x2000,0,13,4},0x200,Write16F1xxx,{0x2000,0,4},0}, //8K, vpp, 3.3V
{"16F1716,16F1717",
PIC16,8.5,1,Read16F1xxx,{0x2000,0,17,0},0x200,Write16F1xxx,{0x2000,0,0},0}, //8K, vpp, 3.3V
{"16F1765,16F1769",
PIC16,8.5,1,Read16F1xxx,{0x2000,0,20,0},0x200,Write16F1xxx,{0x2000,0,0},0}, //8K, vpp, 3.3V
{"16F1776,16F1777",
PIC16,8.5,1,Read16F1xxx,{0x2000,0,24,0},0x200,Write16F1xxx,{0x2000,0,0},0}, //8K, vpp, 3.3V
{"16F15225,16F15245,16F15255,16F15275,16F15325,16F15345,16F15355,16F15375,16F15385",
PIC16,8.5,1,Read16F18xxx,{0x2000,0,0,0},0,Write16F18xxx,{0x2000,0,0},0}, //8K, vpp, 3.3V, 8b commands
{"16F876A,16F877A",
PIC16,13.0,0,Read16Fxxx,{0x2000,0x100,8,1},0x100,Write16F87xA,{0x2000,0x100,1},0}, //8K, 256, vdd
{"16F876,16F877",
PIC16,13.0,0,Read16Fxxx,{0x2000,-0x100,8,1},0x100,Write16F87x,{0x2000,-0x100,-10},0}, //8K, 256, vdd, ee@0x2200
{"16F886,16F887",
PIC16,11.0,0,Read16Fxxx,{0x2000,0x100,10,0},0x80,Write16F88x,{0x2000,0x100,-10},0}, //8K, 256, vpp, config2 + cal1
{"16F916,16F917,16F946",
PIC16,13.0,0,Read16Fxxx,{0x2000,0x100,10,0},0x40,Write12F6xx,{0x2000,0x100,-10},0}, //8K, 256, vpp, cal1 + cal2
{"16F1936,16F1937,16F1946,16F1825,16F1829,16F1847",
PIC16,8.5,1,Read16F1xxx,{0x2000,0x100,11,0},0x200,Write16F1xxx,{0x2000,0x100,0},0}, //8K, 256, vpp, 3.3V
{"16F1786,16F1787",
PIC16,8.5,1,Read16F1xxx,{0x2000,0x100,19,0},0x200,Write16F1xxx,{0x2000,0x100,0},0}, //8K, 256, vpp, 3.3V
{"16F18325,16F18345",
PIC16,8.5,1,Read16F1xxx,{0x2000,0x100,11,0x1C},0x20,Write16F1xxx,{0x2000,0x100,0x1C},0}, //8K, 256, vpp, 3.3V, new cmd
{"16F17115,16F17125,16F17145,16F17155,16F17175,16F18015,16F18025,16F18045,16F18055,16F18075,16F18115,16F18125,16F18145,16F18155,16F18175,\
16F18425,16F18445,16F18455,16F19155,16F19175,16F19185,16F19195",
PIC16,8.5,1,Read16F18xxx,{0x2000,1,0,0},0,Write16F18xxx,{0x2000,0x100,0},0}, //8K, 256, vpp, 3.3V, 8b commands
{"16F18855,16F18875",
PIC16,8.5,1,Read16F18xxx,{0x2000,0x100,0,0x10},0,Write16F18xxx,{0x2000,0x100,0x10},0}, //8K, 256, vpp, 3.3V, 8b commands no DIA
{"16F1518,16F1519,16F1527",
PIC16,8.5,1,Read16F1xxx,{0x4000,0,11,0},0x200,Write16F1xxx,{0x4000,0,0},0}, //16K, vpp, 3.3V
{"16F1718,16F1719",
PIC16,8.5,1,Read16F1xxx,{0x4000,0,17,0},0x200,Write16F1xxx,{0x4000,0,0},0}, //16K, vpp, 3.3V
{"16F1778,16F1779",
PIC16,8.5,1,Read16F1xxx,{0x4000,0,24,0},0x200,Write16F1xxx,{0x4000,0,0},0}, //16K, vpp, 3.3V
{"16F15256,16F15276,16F15356,16F15376,16F15386",
PIC16,8.5,1,Read16F18xxx,{0x4000,0,0,0},0,Write16F18xxx,{0x4000,0,0},0}, //16K, vpp, 3.3V, 8b commands
{"16F1938,16F1939,16F1947",
PIC16,8.5,1,Read16F1xxx,{0x4000,0x100,11,0},0x200,Write16F1xxx,{0x4000,0x100,0},0}, //16K, 256, vpp, 3.3V
{"16F1788,16F1789",
PIC16,8.5,1,Read16F1xxx,{0x4000,0x100,19,0},0x200,Write16F1xxx,{0x4000,0x100,0},0}, //16K, 256, vpp, 3.3V
{"16F18326,16F18346",
PIC16,8.5,1,Read16F1xxx,{0x4000,0x100,11,0x1C},0x20,Write16F1xxx,{0x4000,0x100,0x1C},0}, //16K, 256, vpp, 3.3V, new cmd
{"16F17126,16F17146,16F17156,16F17176,16F18026,16F18046,16F18056,16F18076,16F18126,16F18146,16F18156,16F18176,\
16F18426,16F18446,16F18456,16F19156,16F19176,16F19186,16F19196",
PIC16,8.5,1,Read16F18xxx,{0x4000,1,0,0},0,Write16F18xxx,{0x4000,0x100,0},0}, //16K, 256, vpp, 3.3V, 8b commands
{"16F18856,16F18876",
PIC16,8.5,1,Read16F18xxx,{0x4000,0x100,0,0x10},0,Write16F18xxx,{0x4000,0x100,0x10},0}, //16K, 256, vpp, 3.3V, 8b commands no DIA
{"16F19197",
PIC16,8.5,1,Read16F18xxx,{0x8000,1,0,0},0,Write16F18xxx,{0x8000,0x100,0},0}, //32K, 256, vpp, 3.3V, 8b commands
{"16F18857,16F18877",
PIC16,8.5,1,Read16F18xxx,{0x8000,0x100,0,0x10},0,Write16F18xxx,{0x8000,0x100,0x10},0}, //32K, 256, vpp, 3.3V, 8b commands no DIA
//-------------PIC18---------------------------------------------------------
// Read18Fx options:
// bit [3:0]
// 0 = vdd before vpp (12V)
// 1 = vdd before vpp (9V)
// 2 = low voltage entry with 32 bit key
// bit [7:4]
// 0 = normal control registers address
// 1 = new control registers address (18FxxK80)
//
// Write18Fx options:
// bit [3:0]
// 0 = vdd before vpp (12V)
// 1 = vdd before vpp (9V)
// 2 = low voltage entry with 32 bit key
// bit [7:4]
// 0 = normal eeprom write algoritm
// 1 = with unlock sequence 55 AA
// bit [11:8]
// 0 = 15ms erase delay, 1ms code write time, 5ms EE write, 5ms config write
// 1 = 550ms erase delay, 1.2ms code write time, no config or EEPROM
// 2 = 550ms erase delay, 3.4ms code write time, no config or EEPROM
// 3 = separate block erase with 5ms delay, 1ms code write, 5ms EE write, 5ms config write
// + new control registers address (18FxxK80)
{"18F1230",
PIC18,12,0,Read18Fx,{0x1000,0x80,0},0,Write18Fx,{0x1000,0x80,8,0x0F0F,0x8787,0},0}, //4K, 128, 8
{"18F2221,18F4221",
PIC18,12,0,Read18Fx,{0x1000,0x100,0},0,Write18Fx,{0x1000,0x100,8,0x3F3F,0x8F8F,0},0}, //4K, 256, 8
{"18F1220,18F2220,18F4220",
PIC18,12,0,Read18Fx,{0x1000,0x100,0},0,Write18Fx,{0x1000,0x100,8,0x10000,0x80,0x10},0}, //4K, 256, 8, EE with unlock
{"18F63J11,18F63J90,18F83J11,18F83J90",
PIC18,-1,1,Read18Fx,{0x2000,0,2},0,Write18Fx,{0x2000,0,64,0x0101,0x8080,0x202},0}, //8K, 0, 64, LV
{"18F1330",
PIC18,12,0,Read18Fx,{0x2000,0x80,0},0,Write18Fx,{0x2000,0x80,8,0x0F0F,0x8787,0},0}, //8K, 128, 8
{"18F2321,18F4321",
PIC18,12,0,Read18Fx,{0x2000,0x100,0},0,Write18Fx,{0x2000,0x100,8,0x3F3F,0x8F8F,0},0}, //8K, 256, 8
{"18F1320,18F2320,18F4320,18F2331,18F4331",
PIC18,12,0,Read18Fx,{0x2000,0x100,0},0,Write18Fx,{0x2000,0x100,8,0x10000,0x80,0x10},0}, //8K, 256, 8, EE with unlock
{"18F13K50,18F13K22",
PIC18,8.5,1,Read18Fx,{0x2000,0x100,1},0,Write18Fx,{0x2000,0x100,8,0x0F0F,0x8F8F,1},0}, //8K, 256, 8, 9V
{"18F23K20,18F43K20",
PIC18,8.5,1,Read18Fx,{0x2000,0x100,1},0,Write18Fx,{0x2000,0x100,16,0x0F0F,0x8F8F,1},0}, //8K, 256, 16, 9V
{"18F23K22,18F43K22",
PIC18,8.5,1,Read18Fx,{0x2000,0x100,1},0,Write18Fx,{0x2000,0x100,64,0x0F0F,0x8F8F,1},0}, //8K, 256, 64, 9V
{"18F2439,18F4439",
PIC18,12,0,Read18Fx,{0x3000,0x100,0},0,Write18Fx,{0x3000,0x100,8,0x10000,0x80,0x10},0}, //12K, 256, 8, EE with unlock
{"18F2410,18F4410",
PIC18,12,0,Read18Fx,{0x4000,0,0},0,Write18Fx,{0x4000,0,32,0x3F3F,0x8F8F,0},0}, //16K, 0, 32
{"18F24J10,18F44J10,18F64J11,18F64J90,18F84J11,18F84J90",
PIC18,-1,1,Read18Fx,{0x4000,0,2},0,Write18Fx,{0x4000,0,64,0x0101,0x8080,0x202},0}, //16K, 0, 64, LV
{"18F24J11,18F24J50,18F44J11,18F44J50",
PIC18,-1,1,Read18Fx,{0x4000,0,2},0,Write18Fx,{0x4000,0,64,0x0101,0x8080,0x102},0}, //16K, 0, 64, LV
{"18F2420,18F2423,18F4420,18F4423,18F2480,18F4480",
PIC18,12,0,Read18Fx,{0x4000,0x100,0},0,Write18Fx,{0x4000,0x100,32,0x3F3F,0x8F8F,0},0}, //16K, 256, 32
{"18F2431,18F4431,18F242,18F248,18F442,18F448",
PIC18,12,0,Read18Fx,{0x4000,0x100,0},0,Write18Fx,{0x4000,0x100,8,0x10000,0x80,0x10},0}, //16K, 256, 8, EE with unlock
{"18F2450,18F4450",
PIC18,12,0,Read18Fx,{0x4000,0,0},0,Write18Fx,{0x4000,0,16,0x3F3F,0x8F8F,0},0}, //16K, 0, 16
{"18F14K50,18F14K22",
PIC18,8.5,1,Read18Fx,{0x4000,0x100,1},0,Write18Fx,{0x4000,0x100,16,0x0F0F,0x8F8F,1},0}, //16K, 256, 16, 9V
{"18F24K20,18F44K20",
PIC18,8.5,1,Read18Fx,{0x4000,0x100,1},0,Write18Fx,{0x4000,0x100,32,0x0F0F,0x8F8F,1},0}, //16K, 256, 32, 9V
{"18F24K22,18F44K22,18F24K50",
PIC18,8.5,1,Read18Fx,{0x4000,0x100,1},0,Write18Fx,{0x4000,0x100,64,0x0F0F,0x8F8F,1},0}, //16K, 256, 64, 9V
{"18F04Q40,18F14Q40,18F04Q41,18F14Q41,18F24Q71,18F44Q71,18F54Q71",
PIC18,8.5,1,Read18FKx,{0x4000,1,0x10},0,Write18FKx,{0x4000,0x200,0x10,0,0,0},0}, //16K, 256, --, LV
{"18F2455,18F2458,18F4455,18F4458",
PIC18,12,0,Read18Fx,{0x6000,0x100,0},0,Write18Fx,{0x6000,0x100,32,0x3F3F,0x8F8F,0},0}, //24K, 256, 32
{"18F2539,18F4539",
PIC18,12,0,Read18Fx,{0x6000,0x100,0},0,Write18Fx,{0x6000,0x100,8,0x10000,0x80,0x10},0}, //24K, 256, 8, EE with unlock
{"18F2510,18F4510",
PIC18,12,0,Read18Fx,{0x8000,0,0},0,Write18Fx,{0x8000,0,32,0x3F3F,0x8F8F,0},0}, //32K, 0, 32
{"18F25J10,18F45J10,18F65J10,18F65J11,18F65J50,18F65J90,18F85J10,18F85J11,18F85J50,18F85J90",
PIC18,-1,1,Read18Fx,{0x8000,0,2},0,Write18Fx,{0x8000,0,64,0x0101,0x8080,0x202},0}, //32K, 0, 64, LV
{"18F25J11,18F25J50,18F45J11,18F45J50",
PIC18,-1,1,Read18Fx,{0x8000,0,2},0,Write18Fx,{0x8000,0,64,0x0101,0x8080,0x102},0}, //32K, 0, 64, LV
{"18F252,18F258,18F452,18F458",
PIC18,12,0,Read18Fx,{0x8000,0x100,0},0,Write18Fx,{0x8000,0x100,8,0x10000,0x80,0x10},0}, //32K, 256, 8, EE with unlock
{"18F2550,18F2553,18F4550,18F4553,18F2520,18F2523,18F4520,18F4523,18F2580,18F4580",
PIC18,12,0,Read18Fx,{0x8000,0x100,0},0,Write18Fx,{0x8000,0x100,32,0x3F3F,0x8F8F,0},0}, //32K, 256, 32
{"18F25K20,18F45K20",
PIC18,8.5,1,Read18Fx,{0x8000,0x100,1},0,Write18Fx,{0x8000,0x100,32,0x0F0F,0x8F8F,1},0}, //32K, 256, 32, 9V
{"18F25K22,18F45K22,18F25K50,18F45K50",
PIC18,8.5,1,Read18Fx,{0x8000,0x100,1},0,Write18Fx,{0x8000,0x100,64,0x0F0F,0x8F8F,1},0}, //32K, 256, 64, 9V
{"18F25K42,18F45K42,18F55K42",
PIC18,8.5,1,Read18FKx,{0x8000,1,0},0,Write18FKx,{0x8000,0x100,0,0,0,0},0}, //32K, 256, --, LV
{"18F05Q40,18F15Q40,18F05Q41,18F15Q41,18F25Q71,18F45Q71,18F55Q71",
PIC18,8.5,1,Read18FKx,{0x8000,1,0x10},0,Write18FKx,{0x8000,0x200,0x10,0,0,0},0}, //32K, 256, --, LV
{"18F25K80,18F45K80,18F65K80",
PIC18,8.5,1,Read18Fx,{0x8000,0x400,0x13},0,Write18Fx,{0x8000,0x400,64,0,0,0x303},0}, //32K, 1K, 64, 9V, xxK80
{"18F8520",
PIC18,12,0,Read18Fx,{0x8000,0x400,0},0,Write18Fx,{0x8000,0x400,8,0x10000,0x0080,0x10},0},//32K, 1K, 8, EE with unlock
{"18F25Q43,18F45Q43,18F55Q43",
PIC18,8.5,1,Read18FKx,{0x8000,1,0x10},0,Write18FKx,{0x8000,0x400,0x10,0,0,0},0}, //32K, 1k, --, LV
{"18F25K83",
PIC18,8.5,1,Read18FKx,{0x8000,1,0},0,Write18FKx,{0x8000,0x400,0,0,0,0},0}, //32K, 1k, --, LV
{"18F2515,18F4515",
PIC18,12,0,Read18Fx,{0xC000,0,0},0,Write18Fx,{0xC000,0,64,0x3F3F,0x8F8F,0},0}, //48K, 0, 64
{"18F65J15,18F85J15",
PIC18,-1,1,Read18Fx,{0xC000,0,2},0,Write18Fx,{0xC000,0,64,0x0101,0x8080,0x202},0}, //48K, 0, 64, LV
{"18F2525,18F2585,18F4525,18F4585",
PIC18,12,0,Read18Fx,{0xC000,0x400,0},0,Write18Fx,{0xC000,0x400,64,0x3F3F,0x8F8F,0},0}, //48K, 1K, 64
{"18F2610,18F4610",
PIC18,12,0,Read18Fx,{0x10000,0,0},0,Write18Fx,{0x10000,0,64,0x3F3F,0x8F8F,0},0}, //64K, 0, 64
{"18F26J11,18F26J13,18F26J50,18F26J53,18F46J11,18F46J13,18F46J50,18F46J53",
PIC18,-1,1,Read18Fx,{0x10000,0,2},0,Write18Fx,{0x10000,0,64,0x0101,0x8080,0x102},0}, //64K, 0, 64, LV
{"18F66J60,18F86J60,18F96J60,18F66J10,18F66J11,18F66J50,18F66J90,18F66J93,18F86J10,18F86J11,18F86J50,18F86J72,18F86J90,18F86J93",
PIC18,-1,1,Read18Fx,{0x10000,0,2},0,Write18Fx,{0x10000,0,64,0x0101,0x8080,0x202},0}, //64K, 0, 64, LV
{"18F2620,18F2680,18F4620,18F4680",
PIC18,12,0,Read18Fx,{0x10000,0x400,0},0,Write18Fx,{0x10000,0x400,64,0x3F3F,0x8F8F,0},0},//64K, 1K, 64
{"18F26K20,18F46K20,18F26K22,18F46K22,18F26K50,18F46K50",
PIC18,12,0,Read18Fx,{0x10000,0x100,1},0,Write18Fx,{0x10000,0x100,64,0x0F0F,0x8F8F,1},0},//64K, 256, 64, 9V
{"18F06Q40,18F16Q40,18F06Q41,18F16Q41,18F26Q71,18F46Q71,18F56Q71",
PIC18,8.5,1,Read18FKx,{0x10000,1,0x10},0,Write18FKx,{0x10000,0x200,0x10,0,0,0},0}, //64K, 256, --, LV
{"18F26K80,18F46K80,18F66K80",
PIC18,8.5,1,Read18Fx,{0x10000,0x400,0x13},0,Write18Fx,{0x10000,0x400,64,0,0,0x303},0}, //64K, 1K, 64, 9V, xxK80
{"18F26Q43,18F46Q43,18F56Q43",
PIC18,8.5,1,Read18FKx,{0x10000,1,0x10},0,Write18FKx,{0x10000,0x400,0x10,0,0,0},0}, //64K, 1k, --, LV
{"18F26K42,18F46K42,18F56K42,18F26K83",
PIC18,8.5,1,Read18FKx,{0x10000,1,0},0,Write18FKx,{0x10000,0x400,0,0,0,0},0}, //64K, 1k, --, LV
{"18F26Q83,18F26Q84,18F46Q83,18F46Q84,18F56Q83,18F56Q84",
PIC18,8.5,1,Read18FKx,{0x10000,1,0x20},0,Write18FKx,{0x10000,0x400,0x20,0,0,0},0}, //64K, 1k, --, LV
{"18F2682,18F4682",
PIC18,12,0,Read18Fx,{0x14000,0x400,0},0,Write18Fx,{0x14000,0x400,64,0x3F3F,0x8F8F,0},0},//80K, 1K, 64
{"18F66J65,18F86J65,18F96J65,18F66J15,18F66J16,18F66J55,18F86J15,18F86J16,18F86J55",
PIC18,-1,1,Read18Fx,{0x18000,0,2},0,Write18Fx,{0x18000,0,64,0x0101,0x8080,0x202},0}, //96K, 0, 64, LV
{"18F2685,18F4685",
PIC18,12,0,Read18Fx,{0x18000,0x400,0},0,Write18Fx,{0x18000,0x400,64,0x3F3F,0x8F8F,0},0},//96K, 1K, 64
{"18F27J13,18F27J53,18F47J13,18F47J53,18F67J10,18F87J10",
PIC18,-1,1,Read18Fx,{0x20000,0,2},0,Write18Fx,{0x20000,0,64,0x0101,0x8080,0x102},0}, //128K, 0, 64, LV
{"18F67J60,18F87J60,18F97J60,18F67J11,18F67J50,18F67J90,18F67J93,18F87J11,18F87J50,18F87J72,18F87J90,18F87J93",
PIC18,-1,1,Read18Fx,{0x20000,0,2},0,Write18Fx,{0x20000,0,64,0x0101,0x8080,0x202},0}, //128K, 0, 64, LV
{"18F8722",
PIC18,12,0,Read18Fx,{0x20000,0x400,0},0,Write18Fx,{0x20000,0x400,64,0xFFFF,0x8787,0},0},//128K, 1K, 64
{"18F27Q43,18F47Q43,18F57Q43",
PIC18,8.5,1,Read18FKx,{0x20000,1,0x10},0,Write18FKx,{0x20000,0x400,0x10,0,0,0},0}, //128K, 1k, --, LV
{"18F27K42,18F47K42,18F57K42",
PIC18,8.5,1,Read18FKx,{0x20000,1,0},0,Write18FKx,{0x20000,0x400,0,0,0,0},0}, //128K, 1k, --, LV
{"18F27Q83,18F27Q84,18F47Q83,18F47Q84,18F57Q83,18F57Q84",
PIC18,8.5,1,Read18FKx,{0x20000,1,0x20},0,Write18FKx,{0x20000,0x400,0x20,0,0,0},0}, //128K, 1k, --, LV
//-------------PIC24---------------------------------------------------------
// options:
// bit [3:0]
// 0 = low voltage ICSP entry
// 1 = High voltage ICSP entry (6V)
// 2 = High voltage ICSP entry (12V) + PIC30F sequence (additional NOPs)
// 3 = low voltage ICSP entry (5V power supply)
// bit [7:4]
// 0 = config area in the last 2 program words
// 1 = config area in the last 3 program words
// 2 = config area in the last 4 program words
// 3 = 0xF80000 to 0xF80010 except 02 (24F)
// 4 = 0xF80000 to 0xF80016 (24H-33F)
// 5 = 0xF80000 to 0xF8000C (x16 bit, 30F)
// 6 = 0xF80000 to 0xF8000E (30FSMPS)
// bit [11:8]
// 0 = code erase word is 0x4064, row write is 0x4004
// 1 = code erase word is 0x404F, row write is 0x4001
// 2 = code erase word is 0x407F, row write is 0x4001, 55AA unlock and external timing (2 ms)
// 3 = code erase word is 0x407F, row write is 0x4001, 55AA unlock and external timing (200 ms)
// bit [15:12]
// 0 = eeprom erase word is 0x4050, write word is 0x4004
// 1 = eeprom erased with bulk erase, write word is 0x4004
// 2 = eeprom erased with special sequence, write word is 0x4004
// bit [19:16]
// 0 = config write is 0x4000
// 1 = config write is 0x4003
// 2 = config write is 0x4004
// 3 = config write is 0x4008
{"24F04KA200,24F04KA201",
PIC24,6,1,Read24Fx,{0xB00,0,0x31,0x05BE},0x800,Write24Fx,{0xB00,0,0x20031,0x05BE,32},2.0}, //1.375KW, HV
{"24F08KA101,24F08KA102",
PIC24,6,1,Read24Fx,{0x1600,0x200,0x31,0x05BE},0x800,Write24Fx,{0x1600,0x200,0x20031,0x05BE,32},2.0}, //2.75KW, HV, 512
{"24F16KA101,24F16KA102",
PIC24,6,1,Read24Fx,{0x2C00,0x200,0x31,0x05BE},0x800,Write24Fx,{0x2C00,0x200,0x20031,0x05BE,32},2.0}, //5.5KW, HV, 512
{"24FJ16GA002,24FJ16GA004",
PIC24,-1,1,Read24Fx,{0x2C00,0,0,0x05BE},0x800,Write24Fx,{0x2C00,0,0x10100,0x05BE,64},2.0}, //5.5KW
{"24FJ32GA002,24FJ32GA004",
PIC24,-1,1,Read24Fx,{0x5800,0,0,0x05BE},0x800,Write24Fx,{0x5800,0,0x10100,0x05BE,64},2.0}, //11KW
{"24FJ32GA102,24FJ32GA104,24FJ32GB002,24FJ32GB004",
PIC24,-1,1,Read24Fx,{0x5800,0,0x20,0x07F0},0x800,Write24Fx,{0x5800,0,0x10120,0x07F0,64},2.0}, //11KW 4 Config Word
{"24FJ48GA002,24FJ48GA004",
PIC24,-1,1,Read24Fx,{0x8400,0,0,0x05BE},0x800,Write24Fx,{0x8400,0,0x10100,0x05BE,64},2.0}, //16.5KW
{"24FJ64GA002,24FJ64GA004,24FJ64GA006,24FJ64GA008,24FJ64GA010",
PIC24,-1,1,Read24Fx,{0xAC00,0,0,0x05BE},0x800,Write24Fx,{0xAC00,0,0x10100,0x05BE,64},2.0}, //22KW
{"24FJ64GA102,24FJ64GA104,24FJ64GB002,24FJ64GB004",
PIC24,-1,1,Read24Fx,{0xAC00,0,0x20,0x07F0},0x800,Write24Fx,{0xAC00,0,0x10120,0x07F0,64},2.0}, //22KW 4 Config Word
{"24FJ64GA306,24FJ64GA308,24FJ64GA310,24FJ64GC006,24FJ64GC008,24FJ64GC010",
PIC24,-1,1,Read24Fx,{0xAC00,0,0x120,0x07F0},0x800,Write24Fx,{0xAC00,0,0x110120,0x07F0,64},2.0}, //22KW 4 Config Word new TABLPAG
{"24FJ64GB106,24FJ64GB108,24FJ64GB110",
PIC24,-1,1,Read24Fx,{0xAC00,0,0x10,0x07F0},0x800,Write24Fx,{0xAC00,0,0x10110,0x07F0,64},2.0}, //22KW 3 Config Word
{"24FJ96GA006,24FJ96GA008,24FJ96GA010",
PIC24,-1,1,Read24Fx,{0x10000,0,0,0x05BE},0x800,Write24Fx,{0x10000,0,0x10100,0x05BE,64},2.0}, //32KW
{"24FJ128GA006,24FJ128GA008,24FJ128GA010",
PIC24,-1,1,Read24Fx,{0x15800,0,0,0x05BE},0x800,Write24Fx,{0x15800,0,0x10100,0x05BE,64},2.0}, //44KW
{"24FJ128GA106,24FJ128GA108,24FJ128GA110,24FJ128GB106,24FJ128GB108,24FJ128GB110",
PIC24,-1,1,Read24Fx,{0x15800,0,0x10,0x07F0},0x800,Write24Fx,{0x15800,0,0x10110,0x07F0,64},2.0}, //44KW 3 Config Word
{"24FJ128GA306,24FJ128GA308,24FJ128GA310,24FJ128GB206,24FJ128GB210,24FJ128GC006,24FJ128GC008,\
24FJ128GC010,24FJ128DA106,24FJ128DA110,24FJ128DA206,24FJ128DA210",
PIC24,-1,1,Read24Fx,{0x15800,0,0x120,0x07F0},0x800,Write24Fx,{0x15800,0,0x110120,0x07F0,64},2.0}, //44KW 4 Config Word new TABLPAG
{"24FJ192GA106,24FJ192GA108,24FJ192GA110,24FJ192GB106,24FJ192GB108,24FJ192GB110",
PIC24,-1,1,Read24Fx,{0x20C00,0,0x10,0x07F0},0x800,Write24Fx,{0x20C00,0,0x10110,0x07F0,64},2.0}, //68KW 3 Config Word
{"24FJ256GA106,24FJ256GA108,24FJ256GA110,24FJ256GB106,24FJ256GB108,24FJ256GB110",
PIC24,-1,1,Read24Fx,{0x2AC00,0,0x10,0x07F0},0x800,Write24Fx,{0x2AC00,0,0x10110,0x07F0,64},2.0}, //88KW 3 Config Word
{"24FJ256DA106,24FJ256DA110,24FJ256DA206,24FJ256DA210,24FJ256GB206,24FJ256GB210",
PIC24,-1,1,Read24Fx,{0x2AC00,0,0x120,0x07F0},0x800,Write24Fx,{0x2AC00,0,0x110120,0x07F0,64},2.0}, //88KW 4 Config Word new TABLPAG
{"33FJ06GS101,33FJ06GS102,33FJ06GS202",
PIC24,-1,1,Read24Fx,{0x1000,0,0x40,0x07F0},0x800,Write24Fx,{0x1000,0,0x00140,0x07F0,64},2.0}, //2KW
{"24HJ12GP201,24HJ12GP202,33FJ12GP201,33FJ12GP202,33FJ12MC201,33FJ12MC202",
PIC24,-1,1,Read24Fx,{0x2000,0,0x40,0x07F0},0x800,Write24Fx,{0x2000,0,0x00140,0x07F0,64},2.0}, //4KW
{"24HJ16GP304,33FJ16GP304,33FJ16GS402,33FJ16GS404,33FJ16GS502,33FJ16GS504,33FJ16MC304",
PIC24,-1,1,Read24Fx,{0x2C00,0,0x40,0x07F0},0x800,Write24Fx,{0x2C00,0,0x00140,0x07F0,64},2.0}, //5.5KW
{"24HJ32GP202,24HJ32GP204,24HJ32GP302,24HJ32GP304,33FJ32GP202,33FJ32GP204,33FJ32GP302,\
33FJ32GP304,33FJ32GS406,33FJ32GS606,33FJ32GS608,33FJ32GS610,33FJ32MC202,33FJ32MC204,33FJ32MC302,33FJ32MC304",
PIC24,-1,1,Read24Fx,{0x5800,0,0x40,0x07F0},0x1000,Write24Fx,{0x5800,0,0x00140,0x07F0,64},2.0}, //11KW
{"24HJ64GP202,24HJ64GP204,24HJ64GP206,24HJ64GP210,24HJ64GP502,24HJ64GP504,24HJ64GP506,24HJ64GP510,\
33FJ64GP202,33FJ64GP204,33FJ64GP206,33FJ64GP306,33FJ64GP310,33FJ64GP706,33FJ64GP708,33FJ64GP710,33FJ64GP802,\
33FJ64GP804,33FJ64GS406,33FJ64GS606,33FJ64GS608,33FJ64GS610,33FJ64MC202,33FJ64MC204,33FJ64MC506,33FJ64MC508,33FJ64MC510,\
33FJ64MC706,33FJ64MC710,33FJ64MC802,33FJ64MC804",
PIC24,-1,1,Read24Fx,{0xAC00,0,0x40,0x07F0},0x1000,Write24Fx,{0xAC00,0,0x00140,0x07F0,64},2.0}, //22KW
{"24HJ128GP202,24HJ128GP204,24HJ128GP206,24HJ128GP210,24HJ128GP306,24HJ128GP310,24HJ128GP502,\
24HJ128GP504,24HJ128GP506,24HJ128GP510,\
33FJ128GP202,33FJ128GP204,33FJ128GP206,33FJ128GP306,33FJ128GP310,33FJ128GP706,33FJ128GP708,33FJ128GP710,\
33FJ128GP802,33FJ128GP804,33FJ128MC202,33FJ128MC204,33FJ128MC506,33FJ128MC510,33FJ128MC706,33FJ128MC708,\
33FJ128MC710,33FJ128MC802,33FJ128MC804",
PIC24,-1,1,Read24Fx,{0x15800,0,0x40,0x07F0},0x1000,Write24Fx,{0x15800,0,0x00140,0x07F0,64},2.0}, //44KW
{"24HJ256GP206,24HJ256GP210,24HJ256GP610,\
33FJ256GP506,33FJ256GP510,33FJ256GP710,33FJ256MC510,33FJ256MC710",
PIC24,-1,1,Read24Fx,{0x2AC00,0,0x40,0x07F0},0x1000,Write24Fx,{0x2AC00,0,0x00140,0x07F0,64},2.0}, //88KW
{"24EP32GP202,24EP32GP203,24EP32GP204,33EP32GP502,33EP32GP503,33EP32GP504,\
24EP32MC202,24EP32MC203,24EP32MC204,33EP32MC202,33EP32MC203,33EP32MC204,33EP32MC502,33EP32MC503,33EP32MC504",
PIC24,-1,1,Read24Ex,{0x5800,0,0,0x0FF0},0x1000,Write24Ex,{0x5800,0,0,0,0,0},2.0}, //11KW 10 Config Word
{"24EP64GP202,24EP64GP203,24EP64GP204,24EP64GP206,33EP64GP502,33EP64GP503,33EP64GP504,33EP64GP506,\
24EP64MC202,24EP64MC203,24EP64MC204,24EP64MC206,33EP64MC202,33EP64MC203,33EP64MC204,33EP64MC206,\
33EP64MC502,33EP64MC503,33EP64MC504,33EP64MC506",
PIC24,-1,1,Read24Ex,{0xB000,0,0,0x0FF0},0x1000,Write24Ex,{0xB000,0,0,0,0,0},2.0}, //22.5KW 10 Config Word
{"24EP128GP202,24EP128GP204,24EP128GP206,33EP128GP502,33EP128GP504,33EP128GP506,\
24EP128MC202,24EP128MC204,24EP128MC206,33EP128MC202,33EP128MC204,33EP128MC206,\
33EP128MC502,33EP128MC504,33EP128MC506",
PIC24,-1,1,Read24Ex,{0x15800,0,0,0x0FF0},0x1000,Write24Ex,{0x15800,0,0,0,0,0},2.0}, //44KW 10 Config Word
{"24EP256GP202,24EP256GP204,24EP256GP206,33EP256GP502,33EP256GP504,33EP256GP506,\
24EP256MC202,24EP256MC204,24EP256MC206,33EP256MC202,33EP256MC204,33EP256MC206,\
33EP256MC502,33EP256MC504,33EP256MC506",
PIC24,-1,1,Read24Ex,{0x2B000,0,0,0x0FF0},0x1000,Write24Ex,{0x2B000,0,0,0,0,0},2.0}, //88KW 10 Config Word
{"24EP512GP202,24EP512GP204,24EP512GP206,33EP512GP502,33EP512GP504,33EP512GP506,\
24EP512MC202,24EP512MC204,24EP512MC206,33EP512MC202,33EP512MC204,33EP512MC206,\
33EP512MC502,33EP512MC504,33EP512MC506",
PIC24,-1,1,Read24Ex,{0x56000,0,0,0x0FF0},0x1000,Write24Ex,{0x56000,0,0,0,0,0},2.0}, //175KW 10 Config Word
{"30F1010",
PIC24,-1,0,Read24Fx,{0x1000,0,0x63,0x05BE},0x600,Write24Fx,{0x1000,0,0x30263,0x05BE,32},2.0}, //1KW, LV5V
{"30F2020,30F2023",
PIC24,-1,0,Read24Fx,{0x2000,0,0x63,0x05BE},0x600,Write24Fx,{0x2000,0,0x30263,0x05BE,32},2.0}, //2KW, LV5V
{"30F2010",
PIC24,12,0,Read24Fx,{0x2000,0x400,0x52,0x05BE},0x600,Write24Fx,{0x2000,0x400,0x31252,0x05BE,32},2.0}, //4KW, 1K, HV12
{"30F2011,30F2012",
PIC24,12,0,Read24Fx,{0x2000,0,0x52,0x05BE},0x600,Write24Fx,{0x2000,0,0x31252,0x05BE,32},2.0}, //4KW, HV12
{"30F3010,30F3011,30F3012,30F3013,30F3014",
PIC24,12,0,Read24Fx,{0x4000,0x400,0x52,0x05BE},0x600,Write24Fx,{0x4000,0x400,0x31252,0x05BE,32},2.0}, //8KW, 1K, HV12
{"30F4011,30F4012,30F4013",
PIC24,12,0,Read24Fx,{0x8000,0x400,0x52,0x05BE},0x600,Write24Fx,{0x8000,0x400,0x31252,0x05BE,32},2.0}, //16KW, 1K, HV12
{"30F5011,30F5013,30F5015,30F5016",
PIC24,12,0,Read24Fx,{0xB000,0x400,0x52,0x05BE},0x600,Write24Fx,{0xB000,0x400,0x31252,0x05BE,32},2.0}, //22KW, 1K, HV12
{"30F6011,30F6013",
PIC24,12,0,Read24Fx,{0x16000,0x800,0x52,0x05BE},0x600,Write24Fx,{0x16000,0x800,0x31252,0x05BE,32},2.0}, //44KW, 2K, HV12
{"30F6010,30F6012,30F6014,30F6015",
PIC24,12,0,Read24Fx,{0x18000,0x1000,0x52,0x05BE},0x600,Write24Fx,{0x18000,0x1000,0x31252,0x05BE,32},2.0}, //49KW, 4K, HV12
//-------------PIC32---------------------------------------------------------
// options:
// {"32MX270F256",
// PIC32,-1,1,Read32x,{0x40000,0},0x800,0,{0,0,0,0,0},0.0}, //256K
//-------------ATMEL---------------------------------------------------------
{"AT90S1200",
AVR,-1,0,ReadAT,{0x400,0x40,0},0,WriteAT,{0x400,0x40,0,0},0}, //1K, 64
{"ATtiny11",
AVR,12,0,ReadAT_HV,{0x400,0,LOCK+FUSE+CAL},0,WriteAT_HV,{0x400,0,0,0},0}, //1K, HV
{"ATtiny12",
AVR,12,0,ReadAT_HV,{0x400,0x40,LOCK+FUSE+CAL},0,WriteAT_HV,{0x400,0x40,0,0},0}, //1K, 64, HV
{"ATtiny13",
AVR,12,0,ReadAT_HV,{0x400,0x40,LOCK+FUSE+FUSE_H+CAL},0,WriteAT_HV,{0x400,0x40,16,0},0}, //1K, 64, HV
{"AT90S2313",
AVR,-1,0,ReadAT,{0x800,0x80,0},0,WriteAT,{0x800,0x80,0,0},0}, //2K, 128
{"ATtiny2313",
AVR,-1,0,ReadAT,{0x800,0x80,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x800,0x80,16,0},0},//2K, 128
{"ATtiny24,ATtiny25",
AVR,12,0,ReadAT_HV,{0x800,0x80,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteAT_HV,{0x800,0x80,16,0},0}, //2K, 128, HV
{"ATtiny26",
AVR,-1,0,ReadAT,{0x800,0x80,LOCK+FUSE+FUSE_H+CAL},0,WriteATmega,{0x800,0x80,16,0},0}, //2K, 128
{"ATtiny261",
AVR,-1,0,ReadAT,{0x800,0x80,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x800,0x80,16,0},0}, //2K, 128
{"ATtiny44,ATtiny45",
AVR,12,0,ReadAT_HV,{0x1000,0x100,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteAT_HV,{0x1000,0x100,32,0},0}, //4K, 256, HV
{"ATtiny461,ATtiny4313,ATmega48",
AVR,-1,0,ReadAT,{0x1000,0x100,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x1000,0x100,32,0},0}, //4K, 256
{"ATtiny48",
AVR,-1,0,ReadAT,{0x1000,0x40,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x1000,0x40,32,0},0}, //4K, 64
{"ATtiny88",
AVR,-1,0,ReadAT,{0x2000,0x40,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x2000,0x40,32,0},0}, //8K, 64
{"AT90S8515,AT90S8535",
AVR,-1,0,ReadAT,{0x2000,0x100,0},0,WriteAT,{0x2000,0x100,0,0},0}, //8K, 256
{"ATmega8,ATmega8515,ATmega8535",
AVR,-1,0,ReadAT,{0x2000,0x200,LOCK+FUSE+FUSE_H+CAL},0,WriteATmega,{0x2000,0x200,32,0},0}, //8K, 512
{"ATmega88,ATtiny861",
AVR,-1,0,ReadAT,{0x2000,0x200,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x2000,0x200,32,0},0}, //8K, 512
{"ATtiny84,ATtiny85",
AVR,12,0,ReadAT_HV,{0x2000,0x200,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteAT_HV,{0x2000,0x200,32,0},0}, //8K, 512, HV
{"ATmega16",
AVR,-1,0,ReadAT,{0x4000,0x200,LOCK+FUSE+FUSE_H+CAL},0,WriteATmega,{0x4000,0x200,64,0},0}, //16K, 512
{"ATmega164,ATmega168",
AVR,-1,0,ReadAT,{0x4000,0x200,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x4000,0x200,64,0},0}, //16K, 512
{"ATmega32",
AVR,-1,0,ReadAT,{0x8000,0x400,LOCK+FUSE+FUSE_H+CAL},0,WriteATmega,{0x8000,0x400,64,0},0}, //32K, 1K
{"ATmega324,ATmega328",
AVR,-1,0,ReadAT,{0x8000,0x400,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x8000,0x400,64,0},0}, //32K, 1K
{"ATmega64,ATmega644",
AVR,-1,0,ReadAT,{0x10000,0x800,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x10000,0x800,128,0},0}, //64K, 2K
{"ATmega1284",
AVR,-1,0,ReadAT,{0x20000,0x1000,LOCK+FUSE+FUSE_H+FUSE_X+CAL},0,WriteATmega,{0x20000,0x1000,128,0},0},//128K, 4K
//-------------I2C---------------------------------------------------------
{"2400",
I2CEE,-1,0,ReadI2C,{0x10,0},0,WriteI2C,{0x10,0,1},0}, //16, 1B addr.
{"2401",
I2CEE,-1,0,ReadI2C,{0x80,0},0,WriteI2C,{0x80,0,8},0}, //128, 1B addr.
{"2402",
I2CEE,-1,0,ReadI2C,{0x100,0},0,WriteI2C,{0x100,0,8},0}, //256, 1B addr.
{"2404",
I2CEE,-1,0,ReadI2C,{0x200,0},0,WriteI2C,{0x200,0,16},0}, //512, 1B addr.
{"2408",
I2CEE,-1,0,ReadI2C,{0x400,0},0,WriteI2C,{0x400,0,16},0}, //1K, 1B addr.
{"2416",
I2CEE,-1,0,ReadI2C,{0x800,0},0,WriteI2C,{0x800,0,16},0}, //2K, 1B addr.
{"2432",
I2CEE,-1,0,ReadI2C,{0x1000,1},0,WriteI2C,{0x1000,1,32},0}, //4K, 2B addr.
{"2464",
I2CEE,-1,0,ReadI2C,{0x2000,1},0,WriteI2C,{0x2000,1,32},0}, //8K, 2B addr.
{"24128",
I2CEE,-1,0,ReadI2C,{0x4000,1},0,WriteI2C,{0x4000,1,64},0}, //16K, 2B addr.
{"24256",
I2CEE,-1,0,ReadI2C,{0x8000,1},0,WriteI2C,{0x8000,1,64},0}, //32K, 2B addr.
{"24512",
I2CEE,-1,0,ReadI2C,{0x10000,1},0,WriteI2C,{0x10000,1,128},0}, //64K, 2B addr.
{"241024",
I2CEE,-1,0,ReadI2C,{0x20000,0x201},0,WriteI2C,{0x20000,0x201,256},0}, //128K, 2B addr.
{"241025",
I2CEE,-1,0,ReadI2C,{0x20000,0x841},0,WriteI2C,{0x20000,0x841,128},0}, //128K, 2B addr.
//-------------Microwire EEPROM---------------------------------------------------------
{"93S46",
UWEE,-1,0,Read93x,{0x80,6,0},0,Write93Sx,{0x80,6,8},0}, //128, 6b addr, 4W page
{"93x46",
UWEE,-1,0,Read93x,{0x80,6,0},0,Write93Cx,{0x80,6,0},0}, //128, 6b addr
{"93x46A",
UWEE,-1,0,Read93x,{0x80,7,1},0,Write93Cx,{0x80,7,1},0}, //128, 6b addr x8
{"93S56",
UWEE,-1,0,Read93x,{0x100,8,0},0,Write93Sx,{0x100,8,8},0}, //256, 8b addr, 4W page
{"93x56",
UWEE,-1,0,Read93x,{0x100,8,0},0,Write93Cx,{0x100,8,0},0}, //256, 8b addr
{"93x56A",
UWEE,-1,0,Read93x,{0x100,9,1},0,Write93Cx,{0x100,9,1},0}, //256, 8b addr x8
{"93S66",
UWEE,-1,0,Read93x,{0x200,8,0},0,Write93Sx,{0x200,8,8},0}, //512, 8b addr, 4W page
{"93x66",
UWEE,-1,0,Read93x,{0x200,8,0},0,Write93Cx,{0x200,8,0},0}, //512, 8b addr
{"93x66A",
UWEE,-1,0,Read93x,{0x200,9,1},0,Write93Cx,{0x200,9,1},0}, //512, 8b addr x8
{"93x76",
UWEE,-1,0,Read93x,{0x400,10,0},0,Write93Cx,{0x400,10,0},0}, //1k, 10b addr
{"93x76A",
UWEE,-1,0,Read93x,{0x400,11,1},0,Write93Cx,{0x400,11,1},0}, //1k, 10b addr x8
{"93x86",
UWEE,-1,0,Read93x,{0x800,10,0},0,Write93Cx,{0x800,10,0},0}, //2k, 10b addr
{"93x86A",
UWEE,-1,0,Read93x,{0x800,11,1},0,Write93Cx,{0x800,11,1},0}, //2k, 10b addr x8
//-------------SPI---------------------------------------------------------
{"25010,95010",
SPIEE,-1,0,Read25xx,{0x80},0,Write25xx,{0x80,16},0}, //128
{"25020,95020",
SPIEE,-1,0,Read25xx,{0x100},0,Write25xx,{0x100,16},0}, //256
{"25040,95040",
SPIEE,-1,0,Read25xx,{0x200},0,Write25xx,{0x200,16},0}, //512
{"25080,95080",
SPIEE,-1,0,Read25xx,{0x400},0,Write25xx,{0x400,16},0}, //1K
{"25160,95160",
SPIEE,-1,0,Read25xx,{0x800},0,Write25xx,{0x800,16},0}, //2K
{"25320,95320",
SPIEE,-1,0,Read25xx,{0x1000},0,Write25xx,{0x1000,32},0}, //4K
{"25640,95640",
SPIEE,-1,0,Read25xx,{0x2000},0,Write25xx,{0x2000,32},0}, //8K
{"25128,95128",
SPIEE,-1,0,Read25xx,{0x4000},0,Write25xx,{0x4000,64},0}, //16K
{"25256,95256",
SPIEE,-1,0,Read25xx,{0x8000},0,Write25xx,{0x8000,64},0}, //32K
{"25512,95512",
SPIEE,-1,0,Read25xx,{0x10000},0,Write25xx,{0x10000,128},0}, //64K
{"251024,95M01",
SPIEE,-1,0,Read25xx,{0x20000},0,Write25xx,{0x20000,256},0}, //128K
{"95M02",
SPIEE,-1,0,Read25xx,{0x40000},0,Write25xx,{0x40000,256},0}, //256K
{"25X05",
SPIEE,-1,0,Read25xx,{0x10000},0,Write25xx,{0x10000,0x1000+256},0}, //64K flash 3.3V
{"251005,25X10",
SPIEE,-1,0,Read25xx,{0x20000},0,Write25xx,{0x20000,0x1000+256},0}, //128K flash 3.3V
{"252005,25X20",
SPIEE,-1,0,Read25xx,{0x40000},0,Write25xx,{0x40000,0x1000+256},0}, //256K flash 3.3V
{"254005,25X40",
SPIEE,-1,0,Read25xx,{0x80000},0,Write25xx,{0x80000,0x1000+256},0}, //512K flash 3.3V
{"25Q40",
SPIEE,-1,0,Read25xx,{0x80000},0,Write25xx,{0x80000,0x3000+256},0}, //512K flash 3.3V STATUS2
{"258005,25X80",
SPIEE,-1,0,Read25xx,{0x100000},0,Write25xx,{0x100000,0x1000+256},0},//1M flash 3.3V
{"251605,25X16",
SPIEE,-1,0,Read25xx,{0x200000},0,Write25xx,{0x200000,0x1000+256},0},//2M flash 3.3V
{"25X32",
SPIEE,-1,0,Read25xx,{0x400000},0,Write25xx,{0x400000,0x1000+256},0},//4M flash 3.3V
{"25X64",
SPIEE,-1,0,Read25xx,{0x800000},0,Write25xx,{0x800000,0x1000+256},0},//8M flash 3.3V
{"25X128",
SPIEE,-1,0,Read25xx,{0x1000000},0,Write25xx,{0x1000000,0x1000+256},0},//16M flash 3.3V
//-------------One wire devices---------------------------------------------------------
{"DS2430",
OWEE,-1,0,ReadOneWireMem,{0x20,1},0,WriteOneWireMem,{0x20,1},0}, //32
{"DS2431",
OWEE,-1,0,ReadOneWireMem,{0x80,2},0,WriteOneWireMem,{0x80,0},0}, //128
{"DS2433",
OWEE,-1,0,ReadOneWireMem,{0x200,0},0,WriteOneWireMem,{0x200,1},0}, //512
{"DS28EC20",
OWEE,-1,0,ReadOneWireMem,{0xA00,2},0,WriteOneWireMem,{0xA00,1},0}, //2560
{"DS1820",
OWEE,-1,0,ReadDS1820,{-10},0,0,{0},0}, //digital thermometer
//-------------UNIO devices---------------------------------------------------------
{"11010",
UNIOEE,-1,0,Read11xx,{0x80},0,Write11xx,{0x80,16},0}, //128
{"11020",
UNIOEE,-1,0,Read11xx,{0x100},0,Write11xx,{0x100,16},0}, //256
{"11040",
UNIOEE,-1,0,Read11xx,{0x200},0,Write11xx,{0x200,16},0}, //512
{"11080",
UNIOEE,-1,0,Read11xx,{0x400},0,Write11xx,{0x400,16},0}, //1k
{"11160",
UNIOEE,-1,0,Read11xx,{0x800},0,Write11xx,{0x800,16},0} //2k
};
int NDEVLIST = (sizeof(DEVLIST)/sizeof(struct DEVICES));
//Add all devices to the appropriate structure
#ifndef _GTKGUI
void AddDevices(char *list){ //make sure list is long enough
int i;
static char last[8]="";
for(i=0;i0){ //3.3V required
if(!CheckV33Regulator()){
PrintMessage(strings[S_noV33reg]); //Can't find 3.3V expansion board
return;
}
}
if(hvreg!=DEVLIST[i].HV) hvreg=StartHVReg(DEVLIST[i].HV)>0?DEVLIST[i].HV:0;
if(DEVLIST[i].ReadPtr==0){
PrintMessage(strings[S_nodev_r]); //"Device not supported for reading\r\n");
return;
}
switch(DEVLIST[i].family){ //call read function with the right number of arguments (better ways to do it???)
case PIC12:
if(r) params[1]=DEVLIST[i].ResArea; //modify reserved area parameter
(*DEVLIST[i].ReadPtr)(params[0],params[1]);
break;
case PIC16:
if(r) params[2]=DEVLIST[i].ResArea; //modify reserved area parameter
if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].ReadPtr)(params[0],params[1],params[2],params[3]);
break;
case PIC18:
if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].ReadPtr)(params[0],params[1],params[2]);
break;
case PIC24:
if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].ReadPtr)(params[0],params[1],params[2],params[3],r?DEVLIST[i].ResArea:0);
break;
case PIC32:
// if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].ReadPtr)(params[0],params[1]);
break;
case AVR:
if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].ReadPtr)(params[0],params[1],params[2]);
break;
case I2CEE:
(*DEVLIST[i].ReadPtr)(params[0],params[1]);
break;
case UWEE:
(*DEVLIST[i].ReadPtr)(params[0],params[1],params[2]);
break;
case SPIEE:
(*DEVLIST[i].ReadPtr)(params[0]);
break;
case OWEE:
if(params[0]==-10) (*DEVLIST[i].ReadPtr)();
else (*DEVLIST[i].ReadPtr)(params[0],params[1]);
break;
case UNIOEE:
(*DEVLIST[i].ReadPtr)(params[0]);
break;
default:
PrintMessage(strings[S_nodev_r]); //"Device not supported for reading\r\n");
}
return;
}
}
}
PrintMessage(strings[S_nodev_r]); //"Device not supported for reading\r\n");
}
void Write(char* dev,int ee)
{
int i,j;
int params[6];
char *str=0,*tok;
//parse all device names until "dev" is found,
//then execute the write function with the right number of parameters
for(i=0;i0){ //3.3V required
if(!CheckV33Regulator()){
PrintMessage(strings[S_noV33reg]); //Can't find 3.3V expansion board
return;
}
}
if(hvreg!=DEVLIST[i].HV) hvreg=StartHVReg(DEVLIST[i].HV)>0?DEVLIST[i].HV:0;
if(DEVLIST[i].WritePtr==0){
PrintMessage(strings[S_nodev_w]); //"Device not supported for writing\r\n");
return;
}
switch(DEVLIST[i].family){ //call write function with the right number of arguments (better ways to do it???)
case PIC12:
(*DEVLIST[i].WritePtr)(params[0],params[1]);
break;
case PIC16:
if(!ee) params[1]=0; //clear eeprom parameter
if(params[2]==-10) (*DEVLIST[i].WritePtr)(params[0],params[1]);
else (*DEVLIST[i].WritePtr)(params[0],params[1],params[2]);
break;
case PIC18:
if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].WritePtr)(params[0],params[1],params[2],params[3],params[4],params[5]);
break;
case PIC24:
if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].WritePtr)(params[0],params[1],params[2],params[3],params[4],DEVLIST[i].WriteParamD);
break;
case AVR:
if(!ee) params[1]=0; //clear eeprom parameter
(*DEVLIST[i].WritePtr)(params[0],params[1],params[2],params[3]);
break;
case I2CEE:
(*DEVLIST[i].WritePtr)(params[0],params[1],params[2]);
break;
case UWEE:
(*DEVLIST[i].WritePtr)(params[0],params[1],params[2]);
break;
case SPIEE:
(*DEVLIST[i].WritePtr)(params[0],params[1]);
break;
case OWEE:
(*DEVLIST[i].WritePtr)(params[0],params[1]);
break;
case UNIOEE:
(*DEVLIST[i].WritePtr)(params[0],params[1]);
break;
default:
PrintMessage(strings[S_nodev_w]); //"Device not supported for writing\r\n");
}
return;
}
}
}
PrintMessage(strings[S_nodev_w]); //"Device not supported for writing\r\n");
}
///Search the device type
int GetDevType(const char* dev)
{
int i,type=-1;
char *str=0,*tok;
//parse all device names until "dev" is found
for(i=0;ifamily=devlistEntry->family;
info->HV=devlistEntry->HV;
info->V33=devlistEntry->V33;
info->size=devlistEntry->ReadParam[0];
info->sizeEE=devlistEntry->ReadParam[1];
str2[0]=0;
double x=info->size/1024.0;
if(x-(int)x) sprintf(strF,"%.1f",x);
else sprintf(strF,"%d",(int)x);
switch(info->family){
case -1:
sprintf(str2,"?? ");
break;
case PIC12:
sprintf(str2,"PIC12, ");
if(info->size<1024) sprintf(str3,"%dW FLASH",info->size);
else sprintf(str3,"%sKW FLASH",strF);
strcat(str2,str3);
break;
case PIC16:
sprintf(str2,"PIC16, ");
if(info->size<1024) sprintf(str3,"%dW FLASH",info->size);
else sprintf(str3,"%sKW FLASH",strF);
strcat(str2,str3);
if(info->sizeEE){
int ee=info->sizeEE;
if(ee<0) ee=-ee;
sprintf(str3," + %dB EEPROM",ee);
strcat(str2,str3);
}
break;
case PIC18:
sprintf(str2,"PIC18, ");
if(info->size<1024) sprintf(str3,"%dB FLASH ",info->size);
else sprintf(str3,"%sKB FLASH ",strF);
strcat(str2,str3);
if(info->sizeEE){
sprintf(str3,"+ %dB EEPROM ",info->sizeEE);
strcat(str2,str3);
}
break;
case PIC24:
sprintf(str2,"PIC24, ");
if(info->size<1024) sprintf(str3,"%dW FLASH",info->size);
else sprintf(str3,"%sKW FLASH",strF);
strcat(str2,str3);
if(info->sizeEE){
sprintf(str3," + %dB EEPROM",info->sizeEE);
strcat(str2,str3);
}
break;
case PIC32:
sprintf(str2,"PIC32, ");
if(info->size<1024) sprintf(str3,"%dW FLASH",info->size);
else sprintf(str3,"%sKW FLASH",strF);
strcat(str2,str3);
if(info->sizeEE){
sprintf(str3," + %dB EEPROM",info->sizeEE);
strcat(str2,str3);
}
break;
case AVR:
sprintf(str2,"AVR, ");
if(info->size<1024) sprintf(str3,"%dB FLASH",info->size);
else sprintf(str3,"%sKB FLASH",strF);
strcat(str2,str3);
if(info->sizeEE){
sprintf(str3," + %dB EEPROM",info->sizeEE);
strcat(str2,str3);
}
break;
case I2CEE:
if(info->size<1024) sprintf(str2,"%s, %dB",strings[I_I2CMEM],info->size); //I2C Memory
else sprintf(str2,"%s, %sKB",strings[I_I2CMEM],strF); //I2C Memory
break;
case SPIEE:
if(info->size<1024) sprintf(str2,"%s, %dB",strings[I_SPIMEM],info->size); //SPI Memory
else sprintf(str2,"%s, %sKB",strings[I_SPIMEM],strF); //SPI Memory
break;
case UWEE:
if(info->size<1024) sprintf(str2,"%s, %dB",strings[I_UWMEM],info->size); //Microwire Memory
else sprintf(str2,"%s,%sKB",strings[I_UWMEM],strF);
break;
case OWEE:
if(info->size<0) sprintf(str2,strings[I_OWDEV]); //OneWire device
else if(info->size<1024) sprintf(str2,"%s, %dB",strings[I_OWMEM],info->size); //OneWire Memory
else sprintf(str2,"%s, %sKB",strings[I_OWMEM],strF);
break;
case UNIOEE:
if(info->size<1024) sprintf(str2,"%s, %dB",strings[I_UNIOMEM],info->size); //UNI/O Memory
else sprintf(str2,"%s, %sKB",strings[I_UNIOMEM],strF);
break;
default:
sprintf(str2,"!!unknown family!!");
}
if(info->HV>0){
sprintf(str3,", %.1fV",info->HV);
strcat(str2,str3);
}
if(info->V33){
strcat(str2,", ");
strcat(str2,strings[I_3V3REQUIRED]); // 3.3V adapter
}
info->features=malloc(strlen(str2)+1);
strcpy(info->features,str2);
}
///Search and return device info
struct DevInfo GetDevInfo(const char* dev)
{
int i;
char *str=0,*tok;
struct DevInfo info;
info.device=0;
info.family=-1;
info.HV=-1;
info.V33=-1;
info.size=-1;
info.sizeEE=-1;
info.features=0;
//parse all device names until "dev" is found
for(i=0;i