I'm having to upgrade some sources from the obsolete AT89S8252 to the 253.
I'm having trouble though working out the inlude file to use in the project. At first glance it seems to be the "REG8253.H" file which states in its header that it is for this chip.
However, in the datasheet for the 253, it states that the watchdog functions now use WDTCON and not the WMCON of the 252.
But this 253 header file still lists WMCON and not WDTCON
So, what include file should I be using, and is this include file actually wrong?
Or am I missing something somewhere?
The Datasheet is the definitive document (with due regard to any Errata).
There is nothing magic about the header files - if they don't give you what you need, modify them to suit, or write your own from scratch.
I was just trying to confirm (or deny) whether or not the supplied Keil include files were correct.
My initial presumption was that Keil have supplied the correct inlude file for the chip and that I'd missed something somewhere, hence my post here.
Never mind.
I've now found that Keil have produced a different version of the REG8253.H files for download.
This one is correct, and removed the errors in the file supplied with the compiler.
by simple reasoning it is obvious that the Keil REGxxx.h files can not be 'tested' by Keil, just visualize the effort for each and every new chip (I have no doubt the files are 'checked'). Thus it should not be expected that they (especially new ones) will not have errors. So, if a bug could be due to an error in the REGxxx.h file it is always prudent to check the SFR assignment against the datasheet. This, of course is a non-problem for ICE users "why does a move to SFRxxx not set it" but I would assume the Keil simulator uses the same file.
Erik
From my recent wanderings of upgrading chips, I have found this scenario you tell about frequently.
One should not go blind with these headers files at all. You must comb these files and make them appropriate. Trust the manual.
Some musings:
First comes this habit of using snippets from many sources, so one uses some header files from here and there and some have been upgraded or modified and when you realize a small change somewhere in the program will create several dozens of errors. (Using snippets is euphemism for COPYWARE).
Second, there are some inconsistencies in the naming. Some people like EA some type Ea or ea or whatever. Again, some dozen errors are created.
And finally, some of the headers have been trimmed for some examples and do not cover for all functions. I have several examples of this with ATMEL. Some features are not going to be used, so they are not in the file at all. Sometimes a new feature is introduced and you have some old features renamed as well.
This is just to say that you are not alone. This happens a lot.
Ed