Hi Can someone tell me how does XDATA works? I got the code below but i do not understand how can a simple code like #define Port_D XBYTE [0xFFA0], define Port D and what input or output goes to which bit?See the code below #define Port_D XBYTE [0xFFA0] // bit 0: switch S1 // bit 1: switch S2 // bit 4: LED D1 // bit 5: LED D2 Thanx for the help
I imaging there must be some address decoding logic in your circuit which is organised so that some switches and LEDs appear at address 0xFFA0. You need to read up on 'memory mapping'. When you read/write a byte to/from address 0xFFA0 the bits in that byte should correspond to those defined in the comments. Stefan
" ... how can a simple code ... " just because something looks simple doesn't stop it from being powerful. Often the simplest solutions are the best! " ... define ... what input or output goes to which bit?" The code you showed does not define individual bits - they are just comments to inform (or remind) you what the individual bits do. The actual functions of the individual bits are defined by the wiring in your target hardware.