Hi all,
I'm playing with a DS28EA00's PIOs and a LM393 based rain detector (the
classical schema used as well on light detector, vibration detector, etc ...).
* PIO.A is used to switch ON / OFF the detector by controlling it's VCC through
a transistor : no problem here.
* PIO.B is connected LM393 output with an inboard pull-up.
The problem is if LM393 is low when PIO.A is set low (to switch on the
detector), PIO.B is forced as output LOW.
It's clearly an issue with OWFS as I tested with an ESP8266 with following code
and I haven't this issue :
---
#include <OWBus.h>
#include <OWBus/DS28EA00.h>
#define ONE_WIRE_BUS 5 // Where 1-wire bus is connected to
(GPIO-5)
OneWire oneWire(ONE_WIRE_BUS); // Initialize oneWire library
OWBus bus(&oneWire);
void setup() {
Serial.begin(115200);
delay(100);
}
void status(DS28EA00 &p){
uint8_t pios = p.readPIOs();
Serial.print(pios, HEX);
Serial.print(" (val, flipflop) PIO.A : ");
Serial.print(p.getPIOA() ? "1,":"0,");
Serial.print(p.getFlipFlopA() ? "1":"0");
Serial.print(" / PIO.B : ");
Serial.print(p.getPIOB() ? "1,":"0,");
Serial.println(p.getFlipFlopB() ? "1":"0");
}
void loop() {
DS28EA00 p( bus, 0x42886847000000bf );
p.readPIOs(); // Get "initial" value
Serial.println("\nPIO.A = On (0)");
p.writePIOs( p.getFlipFlopB() ? DS28EA00::PIObitsvalue::PIOBbit : 0 );
// PIO.A set to 0, PIO.B value kept
status(p);
delay(1e3);
Serial.println("Retour état initial (PIO.A = 1)");
p.writePIOs(
DS28EA00::PIObitsvalue::PIOAbit | // set PIO.A to HIGH
( p.getFlipFlopB() ? DS28EA00::PIObitsvalue::PIOBbit : 0 )
// and keep PIO.B
);
status(p);
delay(1e3);
}
---
As you know, both PIOs are set at the same time and I suspect the status of
PIO.B latch is not checked and then resent when PIO.A is modified.
Consequently, its bit is set low and makes its transistor conducting.
Best regards,
Laurent
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers