Page 1 of 1

PIC18f2553 RE3/Mclr

Posted: Sat Nov 16, 2019 6:36 pm
by alanwms
Attempting to read RE3 but the compiler refuses to compile. See bellow picture. Any thoughts?
RE3-MCLR.jpg
RE3-MCLR.jpg (62.09 KiB) Viewed 5477 times

Re: PIC18f2553 RE3/Mclr

Posted: Mon Nov 18, 2019 3:01 pm
by LeighM
The problem is that with RE3 being only input there is no TRISE for this device, so our generic port control throws the error.
This is a similar issue viewtopic.php?f=76&t=20252
A work-around might be to try adding this code into the (Build->Project Options) Supplementary code (Definitions and function declarations) …

Code: Select all

#define TRISE TRISE
extern volatile unsigned char TRISE @ 0xF96;

Re: PIC18f2553 RE3/Mclr

Posted: Tue Nov 19, 2019 5:21 am
by alanwms
Thanks you. I will attempt that resolve.

On another note - I think (maybe) that the project option config which disables mclr in leu for Re3 is not working. I think that the mclr pin is still an mclr pin? I can get the pic to reset using this pin.
To be clear - It will compile with the Re3 pin selected in place of the mclr pin if I don't insert a "Input" component, but I don't think that the config changes or disables the mclr pin - Thoughts?

In will check out the supplemental code.

Regards

Re: PIC18f2553 RE3/Mclr

Posted: Tue Nov 19, 2019 12:59 pm
by LeighM
I think (maybe) that the project option config which disables mclr in leu for Re3 is not working
I've checked the FCD against the device datasheet and it looks OK, I'll see if Ben has a view on this one

Re: PIC18f2553 RE3/Mclr

Posted: Wed Nov 20, 2019 12:15 pm
by Benj
Hello,

I'll see if I can get this fixed in a more elegant manner. Basically Flowcode looks for a data direction register and on your device there isn't one for PortE as the single port pin can only ever be an input.

For now you can work around the problem like this.

If you click on Build -> Project Options.

Then check the "Use Supplementary Code" checkbox.

Click the "Supplementary Code" button.

In the definitions section enter this code.

Code: Select all

unsigned char TRISE;
Then Click OK and OK again and the project should now compile correctly.

Re: PIC18f2553 RE3/Mclr

Posted: Wed Nov 20, 2019 7:27 pm
by alanwms
Thank you Ben.

The system compiles now. The reason I was doing this is because I can get the system to reset by a low signal on the pin (mclr). My thought were that making this an input would resolve the issue.
Unfortunately it didn't. I can still get the system to reset under a low condition on the mclr pin 1.

I'm thinking that the project option to disable the mclr and use the RE3 may not be working. Can you investigate that and let me know if the mclr is truly being disabled?
I should not reset my software if I hit an input on RE3

Regards

Re: PIC18f2553 RE3/Mclr

Posted: Thu Nov 21, 2019 11:01 am
by Benj
Hello,

Please can you attach your Flowcode project file and also your .hex file and I'll investigate for you.

Re: PIC18f2553 RE3/Mclr

Posted: Thu Nov 21, 2019 9:44 pm
by alanwms
Thanks Ben - Here are my files I call "Musings" because I change lots of stuff in order to attempt resolve.

Re: PIC18f2553 RE3/Mclr

Posted: Fri Nov 22, 2019 11:00 am
by Benj
Hello,

I've loaded your .hex file into MPLAB-X and this confirms that the config value is correct and that there are no issues in the Flowcode definition file etc.
Config.jpg
Config.jpg (22.3 KiB) Viewed 5336 times
Have you checked the errata datasheet on the Microchip website for the chip as it should list any known problems with the silicone as well as potential workarounds.

Re: PIC18f2553 RE3/Mclr

Posted: Sat Nov 23, 2019 2:52 am
by alanwms
Thank you very much Ben. That removes the question for me. I will check the docs you reference.