grodansparadis / vscp-firmware

Firmware for the VSCP project
http://www.vscp.org
28 stars 9 forks source link

Issue in eeprom.c with PIC registers #2

Closed waaslandwolf closed 9 years ago

waaslandwolf commented 9 years ago

Ake,

I am just updating my firmware with a git pull I did today. The file eeprom.c throws an error because it does not recognize the register PIR2bits.EEIF. In the old code there was a compiler preprocessor statement that compiled PIR4bits.EEIF for some PICs (like my 18F45K80), and PIR2bits.EEIF for everything else. This seems to have been removed in the latest code on Git. I wonder why, since this seems to break compilation for some PICs. Wouldn't it be better to include it again?

David.

This is the code I'm talking about, in the function writeEEPROM(): ...

if defined(18F25K80) || defined(18F26K80) || defined(18F45K80) || defined(18F46K80) || defined(18F65K80) || defined(18F66K80)

    while (!PIR4bits.EEIF); // wait for interrupt to signal write complete
    PIR4bits.EEIF = 0;              // clear EEPROM write operation interrupt flag

else

    while (!PIR2bits.EEIF); // wait for interrupt to signal write complete
    PIR2bits.EEIF = 0;              // clear EEPROM write operation interrupt flag

endif

...

grodansparadis commented 9 years ago

Hi David,

when I check the history

https://github.com/grodansparadis/vscp_firmware/commits/master/pic/common/eeprom.c

it looks like it has not been there for at least since 2012, if ever.

I have added the suggested change. Please test.

/Ake

waaslandwolf skrev den 2014-12-30 19:00:

Ake,

I am just updating my firmware with a git pull I did today. The file eeprom.c throws an error because it does not recognize the register PIR2bits.EEIF. In the old code there was a compiler preprocessor statement that compiled PIR4bits.EEIF for some PICs (like my 18F45K80), and PIR2bits.EEIF for everything else. This seems to have been removed in the latest code on Git. I wonder why, since this seems to break compilation for some PICs. Wouldn't it be better to include it again?

David.

This is the code I'm talking about, in the function writeEEPROM(): ...

if defined(18F25K80) || defined(18F26K80) || defined(__18F45K80)

|| defined(18F46K80) || defined(18F65K80) || defined(__18F66K80) while (!PIR4bits.EEIF); // wait for interrupt to signal write complete PIR4bits.EEIF = 0; // clear EEPROM write operation interrupt flag

else

while (!PIR2bits.EEIF); // wait for interrupt to signal write complete PIR2bits.EEIF = 0; // clear EEPROM write operation interrupt flag

endif

...

— Reply to this email directly or view it on GitHub https://github.com/grodansparadis/vscp_firmware/issues/2.

Be Hungry - Stay Foolish! Åke Hedman, Grodans Paradis AB / Paradise of the Frog Brattbergavägen 17, 82050 LOS, SWEDEN Phone: +46 (0)840011835 CellPhone: +46 (0)730-533146 http://www.grodansparadis.com http://www.vscp.org


Detta e-postmeddelande har sökts igenom efter virus med antivirusprogram från Avast. http://www.avast.com

waaslandwolf commented 9 years ago

Ake,

For me the change as I proposed below works fine on 18F45K80. Probably Kurt wrote this code for his Hasselt module but it never made it into the main branch. So the kudos go to him J

David.

From: Ake Hedman [mailto:notifications@github.com] Sent: dinsdag 30 december 2014 20:18 To: grodansparadis/vscp_firmware Cc: waaslandwolf Subject: Re: [vscp_firmware] Issue in eeprom.c with PIC registers (#2)

Hi David,

when I check the history

https://github.com/grodansparadis/vscp_firmware/commits/master/pic/common/eeprom.c

it looks like it has not been there for at least since 2012, if ever.

I have added the suggested change. Please test.

/Ake

waaslandwolf skrev den 2014-12-30 19:00:

Ake,

I am just updating my firmware with a git pull I did today. The file eeprom.c throws an error because it does not recognize the register PIR2bits.EEIF. In the old code there was a compiler preprocessor statement that compiled PIR4bits.EEIF for some PICs (like my 18F45K80), and PIR2bits.EEIF for everything else. This seems to have been removed in the latest code on Git. I wonder why, since this seems to break compilation for some PICs. Wouldn't it be better to include it again?

David.

This is the code I'm talking about, in the function writeEEPROM(): ...

if defined(18F25K80) || defined(18F26K80) || defined(__18F45K80)

|| defined(18F46K80) || defined(18F65K80) || defined(__18F66K80) while (!PIR4bits.EEIF); // wait for interrupt to signal write complete PIR4bits.EEIF = 0; // clear EEPROM write operation interrupt flag

else

while (!PIR2bits.EEIF); // wait for interrupt to signal write complete PIR2bits.EEIF = 0; // clear EEPROM write operation interrupt flag

endif

...

— Reply to this email directly or view it on GitHub https://github.com/grodansparadis/vscp_firmware/issues/2.

Be Hungry - Stay Foolish! Åke Hedman, Grodans Paradis AB / Paradise of the Frog Brattbergavägen 17, 82050 LOS, SWEDEN Phone: +46 (0)840011835 CellPhone: +46 (0)730-533146 http://www.grodansparadis.com http://www.vscp.org


Detta e-postmeddelande har sökts igenom efter virus med antivirusprogram från Avast. http://www.avast.com

— Reply to this email directly or view it on GitHub https://github.com/grodansparadis/vscp_firmware/issues/2#issuecomment-68387487 . https://github.com/notifications/beacon/AGim4HKYxPQc55HQQiaMGDah2aXpAlt2ks5ncvH-gaJpZM4DNQow.gif


Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. http://www.avast.com