I am trying to write general procedure with the C51, who use name that I can easily assign to a port for a specific controler. Ex: I want to replace port P4 in a procedure with a name like DATA
Well SFR's are global because they're hardware of course. C knows nothing of hardware and thus it's (sic) scoping rules can't really be made to apply. Yes, of course that's absolutely true - it's one of those things which explains everything after you've been bitten and had to go through and work it out. My point (a gripe at Keil, not you) is, why can't Keil just explain that up-front in the documentation of their 'sfr' etc extensions - rather putting us off the track with "...sfr variables are defined just like other C variable declarations." when, as we now know, there are important differences & therefore restrictions. As an earlier post asked, is the restriction actually stated explicitly anywhere in any Keil manual? The restriction seems even more obscure with bdata.