Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using latches to capture 8086 bus

I'm trying to capture the data using stm32, I have used two latches as the following diagram enter image description here
and this is the schematic of the bus for your reference

a4998301-c7de-42d7-a55c-e84dc594a7fc.jpeg

I'm not getting any LCD commands that was referenced in the answer, I only get two LCD Commands 0x60, and CS1,CS2 = 1, A1 = 0 or 1, and they are always like that. I'm not sure how to debug that, I need some ways to debug that issue.
Latches are LS374
Here is my coding part:

Code:
void processData(uint32_t buffer) {

// Extracting control signals

uint32_t data_word = buffer;

int16_t A1 = (data_word >> 0) & 0x01;  // PD0

int16_t CS1 = (data_word >> 1) & 0x01; // PD1

int16_t CS2 = (data_word >> 2) & 0x01; // PD2

// Extracting data bits

uint8_t data_bits = (data_word >> 3) & 0xFF; // PD3 to PD10
// Control logic for LCD1 and LCD2
if ((!CS1) && (!A1)) {
LCD1_write_cmd(data_bits);
}
if ((!CS1) && (A1)) {
LCD1_write_dat(data_bits);
}
if ((!CS2) && (!A1)) {

LCD2_write_cmd(data_bits);
}

if ((!CS2) && (A1)) {

LCD2_write_dat(data_bits);

}

}[/CODE]
CpP0w.png
 
Why not externally gate /IOWR, /CS1 and /CS2, so ONLY data being written to the LCD is being latched? As it is, you are trying to read every peripheral write regardless of destination.

You then just need to check A1 and store the latched data byte as control or display data.

I'd also connect the decoded latch signal to an SR bistable, to generate an interrupt each time a new byte is latched, then reset that with an output as you read the stored data, so you can exactly track new bytes even if they are duplicates.
 
The LCD is only written to when /CS1, /CS2 and /IOWR are ALL low. Looking at the signals separately is meaningless.

Connecting all three of those to a thee input OR gate (or eg. the two /CS to a two input OR, with the output of that and /IOWR to another two input) should produce a low-going pulse at each write access.

That would be OK to gate an LS373, which would capture the data at the end of the pulse when the data bus should have stabilised.

You could use eg. an LS74 with that, one half with the A1 line as its D input to capture that, and the other section with D fixed at high level as the write detect.
Both halves with the same clock as the 373.

Use the RESET input on the write detect LS74 to arm it / re-enable it after each LCD write is captured.

When a write occurs and is latched, the write detect latch will be set - use either Q or /Q to trigger an interrupt, or poll one fast enough.

Read the data from the other latches then reset that ready for the next write.

That uses a total of ten inputs and one output on the STM32.
 

Latest threads

New Articles From Microcontroller Tips

Back
Top