Hi, Kova !
I'm using MPLAB-C18 for this code. It is ANSI-C Standard and you can port it easy to an another
compiler i.e. Hitech or CCS. In the headerfile you can defenine the ports. I'm using PORTD and PORTB
for this small project and for testing. I using three 74HC373 for Addressmultiplexing. The code ist
a little compacter as mit a use of extra Portpins for A16 and A17.
DATAPORT ist PORTB in the at the define in the headerfile you can use an another complete 8-Bit wide
Port. I'm using allway a headerfile for processorspecific defines. The code is more portable. You must
change only the defines in the headerfiles. It isn't a allacolable code for universal lib's. I have not the
experience for this procedure.
iWaddr ist the long word (32-Bit) Addressvariable and with ">>16" and ">>8" i shift it to the 8-Lower
8-Bit Location (PORTB) >> 16 ist for the HighByte (Bit 24 ... Bit 16) to Bit 7 ... 0, >> 8 ist for MiddleByte
(Bit 15 ...
to Bit 7 ... 0.
ALEH ist Latchpulse for the HighByte 74HC373, ALEM ist Latchpulse for the Middlebyte
74HC373 and ALEL is Latchpulse for the LowByte 74HC373. ALE = Address Latch Enable i.e. MCS51
The NOP's are a little Waitstate for the Pulse to give the Port a little of time to switch. When the test with the
hardware is ok you can delete those lines for a new test.
I can draw the schematic today and can send this snipped to you.
Best regard, Prommer