(26-06-2015, 11:40 PM)regis Wrote: Please share your modification or do you want to keep it only for you ?
First, thank you for the great product.
I recently have a chance to use PIC18F27J53 and encountered this issue and fixed it in the following way.
1) according to spec sheets, 27J53 has CCP4 to CCP10 (same as 47J53), but not in 26J50 (so the following wouldn't be an ideal fix).
pinguino-libraries/p8/include/pinguino/core/pin.h
/**********************************************************************/
#elif defined(PINGUINO26J50) || defined(PINGUINO27J53)
/**********************************************************************/
#define RTCC 1
#define CCP1 10 // cf. io.c
#define CCP2 11
#define LED1 12
#define USERLED 12
#define CCP4 4 // RB4
#define CCP5 5 // RB5
#define CCP6 6 // RB6
#define CCP7 7 // RB7
#define CCP8 17 // RC1
#define CCP9 22 // RC6
#define CCP10 23 // RC7
#endif
2a) since 27J53 doesn't have ADCON2 (same as 47J53), rerouting to 47J53 configuration would work.
pinguino-libraries/
p8/
include/
pinguino/
core/
analog.c
Line 58: #elif defined(PINGUINO27J53) || defined(PINGUINO47J53)
Line 59: // RB 09/09/2013: Analog Conversion Mode is set to 12-bit in Bootloader Config file
Line 60: // #pragma config ADCSEL = BIT12 // 12-bit conversion mode is enabled
2b) 27J53 doesn't have TRISE (or PORTE), in analogread(), I copied 47J53 codes except TRISE setting.
pinguino-libraries/
p8/
include/
pinguino/
core/
analog.c
inserted at Line 170:
#elif defined(PINGUINO27J53)
if (channel > 15)
return 0;
if (channel >= 8 && channel <= 15)
channel = channel - 8; // A0=8 to A7=15
if (channel < 5)
TRISA |= 1 << channel; // channel as INPUT
// if (channel >= 5 && channel <= 7)
// TRISE |= 1 << (channel - 5);// channel as INPUT
ANCON0 |= 1 << channel; // channel enabled
ADCON0 = channel << 2; // A0=0 to A7=7
I think these were all modification I made for 27J53 analog input. I only tested wit 27J53, and it seems working fine.
-- yoc