# How do I detect revision of a particular PIC microcontroller?

I have a PIC18F4680. After reading the datasheet, it's still no clear to me how can I determine which revision the chip is.

So how do I determine the revision of the microcontroller other than asking the supplier to provide that information to me?

Answers relevant to other PIC series are welcome too.

If you look in the Flash Programming Specification for your device (document DS39622L in your case) you'll see this table which includes the device ID bits:

There are two Device ID bytes DEVID which you should be able to read along with the config bits in MPLAB. The device ID bits include a 5-bit revision code.

The errata sheets for the different revisions give a revision code, so you can match this bit string with the right revision code. e.g. the rev A3 code is 0 0100, whereas the rev B1 code is 0 0111.

If all else fails, or if you have a bunch of ICs in a tube + can't easily hook them up to a programmer, the IC should have a date code that's the last two digits of the year followed by the week number. (e.g. 1214 for 2012, April 1 which is week 14) You should be able to call up your Microchip rep and if you ask nicely they should be able to tell you what silicon revision that is. (I can't remember if they put the silicon rev # on the packaging. TI C2800 DSPs do.)

• Is there any way to read the data in MPLABX? As far as I can see, it only shows configuration bits up to 30000D using the window>pic memory views>configuration bits option. I'm using a PICkit 2 compatible programmer, if it matters. Also the revision number isn't on the packaging, only the week is. – AndrejaKo Apr 2 '12 at 20:43
• unfortunately it's been a while since I've run MPLAB so I'm not sure I can help with that. But if they don't provide you with a means to display the two DEVID bytes, this is a missing feature in MPLAB -- won't help you today but they should be able to provide that functionality. – Jason S Apr 2 '12 at 20:47
• Looks like the MPLABX doesn't have that functionality. Even the official article doesn't mention reading of configuration bits from the device itself. – AndrejaKo Apr 2 '12 at 20:51

Not sure about MPLABX, but in earlier versions, the programmers (certainly for ICD2,3 and PICkit3) display the rev in the output window when they connect.

• Unfortunately PICkit 2 doesn't seem to be able to read configuration bits that high. – AndrejaKo Apr 3 '12 at 6:14

It seems I managed to find the answer to my question.

In the PICkit 2 installation directory, there should be file named PICkit2.ini. This line: REVS: needs to be added to it in order to display the revision of the connected chip. The revision will appear to the right of the checksum value. This feature needs software version 2.10 or later.

Source