DigitalWrite & DigitalRead and Delay in ns

Hello everyone,

I have an Arduino UNO R4, and the fastest digitalWrite or DigitalRead or Delay
are in us (microsecond)

I'm looking for a single chip if possible (not an complete dev. Board) that I can program with Arduino IDE, and achieve a DigitalWrite / DigitalRead/ Delay in ns (nanosecond) without using direct port manipulation as for ATMega328p can do.

Also if possible the uC should be as small as possible no need for more than 8 ports all digital no analog.

Is this possible?

My task is to write a 1 to port and a 0 the fastest (in nanosecond) I can get from the uC.

The future project will be draw around the uC , and Arduino IDE possibility.

Let me know if you did program or have any experience with Arduino IDE and some uC with the ns timing in mind.

All kindly comments are welcome.

  • Nanoseconds ? :thinking:
    Not going to happen.

  • What exactly are you needing this for ?

Care to reword that? I think you said, "my task is to write a 1 to a pin, and then as soon as possible after that, write a 0 to the same pin". Is that correct? So you're trying to create a short high pulse, on a signal that's primarily low? If so, how short do you need/how long can you tolerate?

Even with an Arduino Uno, I think that works out to about 125 ns, with back-to-back pin writes, working directly in the IDE.

without using direct port manipulation as for ATMega328p can do.

Which you seem to not want to do. Why not?

Thank you LarryD

Hello camsysca

sure my description of my project is not well details, the project consist of programming an parallel EEprom and to get the datasheet timing accurate the uC
need to put a 1 or 0 and back to previous state to simplify
to be able to write to the eeprom write pin and to control in the mean time the OE (output enable) pin.
all the timing are at the minimum 100ns to 1000ns Max.
so I'm looking to write a pulse of 4us and also a pulse of 600ns.
please see the timing pic.
Thanks again for your comments.

HI Delta_G
can you elaborate about the code if possible.

Thanks

and all this is possible with the current Arduino IDE?

Is this the only solution, or is there a smaller uC like around 20 pins total , I'm thinking.

I tested an ATMega328P , with direct port pulse and it's fast around 64ns
but cannot send 1 pulse of 4us and in the middle of that pulse send to another pin pulse of 620ns.
all I got was 1 pulse of 4us start to end , and then another pulse of 64ns but not
both at the same time.
like the oscilloscope pic.

Have you considered handling the timing with simple digital IC's?

here's my try

void setup() {
 
  DDRB = 0b00000100;
}

void loop() {
 
  PORTB = 0b00000100;
  PORTB = 0b00000000;
 }

I will need to research more code examples on this forum and learn from it.

MM74HC221 work great, but looking to expand with a uC , to control the address,data, controls pin of the Parallel EEPROM.

Are you sure you understood the datasheet correctly? It is very rare that working with logic signals requires such precision of pulses

this is was is left on my directory, but I understand your comment about taking Pin high then...

Hi b707
here's the AT28C16 EEPROM datasheet Timing for WE,OE
This chip datasheet dated from 1998, so it's been well used by many company.


according to this chart the timing is at least 100ns ~ to 1000ns Max.
that's mean to write properly I'm looking for 300ns~700ns around but less than 1000ns.

I'm sure there's a solution

MM74HC221 and it's work ok
but looking to use a uC to control address, data, control pin also

This related to WE|CE writing pulse only.

Sorry, but your code in #18 does not show anything in common with the described protocol. How do you suppose they can help you if you yourself have not even started the work?

Dear b707
This is why I'm here asking for guidance but not reprimand
Let me thank you for your time.

Let's see. 11 address lines, 8 data lines, WE, OE, CE. Sounds to me like you need 20 useful signals, 8 bidirectional and 12 output. Ideal for a '328. The timing won't be much of a problem, given what I said before. Draw yourself a sketch with 5 relevant lines(WE,CE,OE,A0,D0; the rest of the addresses and data lines will be concurrent), and map out the timing needed. Presume direct port pin writing, use _NOP to stretch timing between logic changes if necessary.
Good luck!
edit. Need more fingers. 11+3+8 = 22. can't be done with a '328. Sorry!

1 Like

I assumed that a 328 will be short of pin's.
But I was looking to another uC with more pin's but not 100 for sure
but small as it can fit.
Thanks camsysca