I send to the industrial machine a file via wifi through a program that I elaborated through Labview.
all the information required by the operator of the machine appears on a screen oled, when the operator wants it, it loads in the machine the last file sent to esp8266.
everything works perfectly, but I would like to improve the speed of sending the file to the machine, currently sending 40 bytes per second.
I have the cpu speed at 160 mhz.
the freq. of port I2C in 400,000 attached part of the code I want to improve, I think it would be a good idea to remove the PCF8574P and write the output byte in 8 pins of esp8266, I have pins available, but I have not found any module or instruction to write simultaneously in 8 pins, any ideas? Thanks in advance.
Code: Select all
with open("Design.DST", "rb") as f: # open design file in binary.
f.seek(511) # point to start of design data.
byte = f.read(1) # buffer one byte only.
while byte != b"": # read until end of design file.
if D_set.value()== False: #Request data from machine.
time_out=0
byte = f.read(1) # read design file byte by byte.
byte_out = ~byte[0]&0xff #invert the byte
i2c.writeto(0x20,bytearray([byte_out])) # write to output port.
time.sleep_us(1)# delay for stable data on output port
Strobe.value(1) # strobe pulse for machine.
time.sleep_ms(7) # min. width of strobe pulse.
Strobe.value(0)