Received: from PCH.mit.edu (18.7.21.50) by mail.efplus.com (192.168.0.8) with Microsoft SMTP Server (TLS) id 8.3.485.1; Thu, 1 Oct 2020 10:55:53 -0700 Received: from PCH.MIT.EDU (localhost.localdomain [127.0.0.1]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 091HjNCg001823; Thu, 1 Oct 2020 13:46:04 -0400 Received: from outgoing-exchange-3.mit.edu (OUTGOING-EXCHANGE-3.MIT.EDU [18.9.28.13]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 091HjL7g001820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 1 Oct 2020 13:45:21 -0400 Received: from w92exedge4.exchange.mit.edu (W92EXEDGE4.EXCHANGE.MIT.EDU [18.7.73.16]) by outgoing-exchange-3.mit.edu (8.14.7/8.12.4) with ESMTP id 091Hj99r023171 for ; Thu, 1 Oct 2020 13:45:21 -0400 Received: from w92expo8.exchange.mit.edu (18.7.74.62) by w92exedge4.exchange.mit.edu (18.7.73.16) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Thu, 1 Oct 2020 13:44:19 -0400 Received: from oc11exhyb2.exchange.mit.edu (18.9.1.98) by w92expo8.exchange.mit.edu (18.7.74.62) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Thu, 1 Oct 2020 13:45:02 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) by oc11exhyb2.exchange.mit.edu (18.9.1.98) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Thu, 1 Oct 2020 13:45:02 -0400 Received: from DM6PR11CA0072.namprd11.prod.outlook.com (2603:10b6:5:14c::49) by BN6PR0101MB3140.prod.exchangelabs.com (2603:10b6:405:36::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.26; Thu, 1 Oct 2020 17:45:00 +0000 Received: from DM3NAM03FT030.eop-NAM03.prod.protection.outlook.com (2603:10b6:5:14c:cafe::64) by DM6PR11CA0072.outlook.office365.com (2603:10b6:5:14c::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.36 via Frontend Transport; Thu, 1 Oct 2020 17:45:00 +0000 Received: from premium47-1.web-hosting.com (68.65.123.241) by DM3NAM03FT030.mail.protection.outlook.com (10.152.82.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34 via Frontend Transport; Thu, 1 Oct 2020 17:45:00 +0000 Received: from 107-145-246-199.res.spectrum.com ([107.145.246.199]:53549 helo=[192.168.10.106]) by premium47.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kO2dT-00245w-1p; Thu, 01 Oct 2020 13:44:59 -0400 From: Neil To: "piclist@mit.edu" Sender: "piclist-bounces@mit.edu" Date: Thu, 1 Oct 2020 10:44:53 -0700 Subject: Re: [PIC] 18F...K22, K42, K40 Thread-Topic: [PIC] 18F...K22, K42, K40 Thread-Index: AdaYHBtfCo3hsqw4SH6I9lI2zD2kRg== Message-ID: <5F761595.7090009@narwani.org> References: <5F740009.9050802@narwani.org> <5F749990.4070803@narwani.org> List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: <5F749990.4070803@narwani.org> Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: TS500.efplus4.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-SenderIdResult: Pass X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: received-spf: None (protection.outlook.com: narwani.org does not designate permitted sender hosts) dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=narwani.org ; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:Reply-To:To:References:Subject:Sender:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MB26fdmEwm2+82ZAuM7bI0OkZjt3IrdmWSb3HnU99mk=; b=ghQ4HZHqTTeTztnpWWvQOPcGEi 8uv3uneZyR9JE3lVSMwImXm7ZTVVy3Oc2T6f5KDWdvEnV4ATsFNiJ2sIp6cxLP0bf0hAuV6USqQZo 8hr60pSmUNxleqL7znAINnaCE0CtC8RDnMoe842ORpIQQvNSrGk5CoCB05yUrJdCG+QcDc+WqfReB n43GqbHSRW/ERCovTeCBAdsBNHMIDiJDKSV/9LOH5kBg3LdqvkzjC8nPZPFfji5MPzWJ1WRpuUJtG lB0+3XRSUPymbEi6E0WCmeAGSz9XWbvDDH7HdfUjat/7Nj/w2slbzbV7/Njh95MhoCFXkFjw0cana sOzrTNvA==; authentication-results: spf=none (sender IP is 68.65.123.241) smtp.mailfrom=narwani.org; mit.edu; dkim=pass (signature was verified) header.d=narwani.org;mit.edu; dmarc=bestguesspass action=none header.from=narwani.org; user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 errors-to: piclist-bounces@mit.edu list-id: "Microcontroller discussion list - Public." list-post: x-beenthere: piclist@mit.edu x-mailman-version: 2.1.6 x-source-args: x-source-dir: x-antiabuse: Sender Address Domain - narwani.org x-source: x-authenticated-sender: premium47.web-hosting.com: ca4@narwani.org x-topics: [PIC] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Okay, let's do this a bit more coherently... I went back through some=20 code and now remember the issue. The code had a lot of configuration options based on 2 #define selections. In my K22 code in MPLAB 8.x, EEPROM was split into 3 sections... core=20 settings, function 1 settings, and function 2 settings. #pragma romdata eedata_scn=3D0xf00000 rom unsigned char eedata_values0[] =3D {2}; //=20 Self-test cycles rom unsigned char eedata_values1[] =3D {9, 1}; //=20 Brightness levels ... #pragma romdata Then function 1 settings has it's own section of EEPROM data like this... #pragma romdata eedata_scnA=3D0xf00020 rom unsigned char eedata_valuesA1[] =3D {0x15, 0xC6}; // Amb ref=20 calibration rom unsigned char eedata_valuesA2[] =3D {1}; // Res ... #pragma romdata And similarly for function 2 at 0xf00040. This system made the relatively large piece of code much cleaner and=20 simpler to follow. But this could not be done in MPLABX. Is there a way to do this nowadays? It's been maybe 5 years or more=20 since I've looked at this. The project I'll be doing will have a few configurations, so it's=20 probably not a major deal, but would be nice if this is somehow doable=20 nowadays. Cheers, -Neil On 9/30/2020 10:43 AM, Neil wrote: > I'm scratching my head trying to remember what the specific issue is > then, because I know of this... hmmm... > ... I'll go look at some old code. > > > > On 9/30/2020 12:22 AM, David Duffy (AVD) wrote: >> I've done it this way: >> >> __EEPROM_DATA(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); // 0x00..= 0x07 >> >> David... >> >> On 30/09/2020 1:48 pm, Neil wrote: >>> Looking at doing a project for someone who chose the PIC18LF45K40. >>> I remember a few years ago when I moved from K22 to K42 (to get the >>> 12-bit ADC), there was an issue with pre-initializing EEPROM data, but >>> IIRC that had to do with MPLABX (vs MPLAB) and not an issue with the ch= ip. >>> I did some workaround with looking for a key value in a specific EEPROM >>> location and if not there, it went through an initialization routine. >>> Being able to set different configurations in the code (using #define), >>> which then set specific values in EEPROM made life much easier. >>> >>> With the K40, looks like I'm forced to use MPLABX, though for a 3rd >>> party, I probably should suck up my hatred of MPLABX and use the newer >>> tools. >>> >>> That said... anyone know if I can pre-initialize EEPROM from MPLABX >>> nowadays? >>> PS: I don't want to manually punch in values into MPLABX IPE. >>> >>> Cheers, >>> -Neil. >>> >>> --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .