[PIC] 18F...K22, K42, K40

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[PIC] 18F...K22, K42, K40

Neil
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 chip.
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.


--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [PIC] 18F...K22, K42, K40

David Duffy (AVD)
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 chip.
> 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.
>
>


--
___________________________________________
David Duffy        Audio Visual Devices P/L
Unit 8, 10 Hook St, Capalaba 4157 Australia
Ph: +61 7 38235717      Fax: +61 7 38234717
Our Web Site: www.audiovisualdevices.com.au
___________________________________________

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [PIC] 18F...K22, K42, K40

Neil
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 chip.
>> 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.
>>
>>
>

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [PIC] 18F...K22, K42, K40

Chuck Olson
In reply to this post by Neil
> Date: Tue, 29 Sep 2020 23:48:25 -0400
> From: Neil <[hidden email]>
> Subject: [PIC] 18F...K22, K42, K40

> 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.

Neil -

I gave up on MPLABX, too.

With newer parts I put a link to MPASMX.exe on my desktop and just
assemble the code with that.

P.S.  not crazy about MPLAB IPE programmer app included with MPLABX either :)

--
Best Regards,

Chuck Olson, WB9KZY
Jackson Harbor Press
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [PIC] 18F...K22, K42, K40

Neil
In reply to this post by Neil
Okay, let's do this a bit more coherently... I went back through some
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
settings, function 1 settings, and function 2 settings.

#pragma romdata eedata_scn=0xf00000
     rom unsigned char eedata_values0[] = {2};                    //
Self-test cycles
     rom unsigned char eedata_values1[] = {9, 1};                //
Brightness levels
     ...
#pragma romdata


Then function 1 settings has it's own section of EEPROM data like this...
#pragma romdata eedata_scnA=0xf00020
     rom unsigned char eedata_valuesA1[] = {0x15, 0xC6};     // Amb ref
calibration
     rom    unsigned char eedata_valuesA2[] = {1};     // Res
     ...
#pragma romdata


And similarly for function 2 at 0xf00040.

This system made the relatively large piece of code much cleaner and
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
since I've looked at this.
The project I'll be doing will have a few configurations, so it's
probably not a major deal, but would be nice if this is somehow doable
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 chip.
>>> 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.
>>>
>>>

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [PIC] 18F...K22, K42, K40

Neil
In reply to this post by Chuck Olson
Hmmm... that's not a bad idea.




On 9/30/2020 12:37 PM, Chuck Olson wrote:

>> Date: Tue, 29 Sep 2020 23:48:25 -0400
>> From: Neil <[hidden email]>
>> Subject: [PIC] 18F...K22, K42, K40
>> 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.
> Neil -
>
> I gave up on MPLABX, too.
>
> With newer parts I put a link to MPASMX.exe on my desktop and just
> assemble the code with that.
>
> P.S.  not crazy about MPLAB IPE programmer app included with MPLABX either :)
>

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist