HI and thanks in advance for Open Source
to everyone who helps to make it better and better to someone like me law student who learns through you.
being that said, straight to issue.
I have a 74HC393, is an integrated of 2 parallel 4digits asynchronus shiftregister, it has 0 to 15 cicles.
i've created some functions (you can see them in the code of "TEST.h"), the logic behind is that one cycle requiers a LOW to HIGH for 6 NanoSeconds according to the datasheet, i've tryed it and in a sketch everything works OK.
my idea is to create a library to do this. And i'am stuck. i'll paste below the .h and then de .cpp.
If you have any suggestion on how to do this in an other way is also welcome.
TEST.h:
#ifndef TEST_H
#define TEST_H
#if defined(ARDUINO) && (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
class TEST
{
public:
float LATCH(int pin);
float MRESET(int pin);
void TEST0a();
void TEST1a();
void TEST2a();
void TEST3a();
void TEST4a();
void TEST5a();
void TEST6a();
void TEST7a();
void TEST8a();
void TEST9a();
void TEST10a();
void TEST11a();
void TEST12a();
void TEST13a();
void TEST14a();
void TEST15a();
void TESTReset();
private:
int _LATCH;
int _MRESET;
};
#endif
TEST.cpp:
#include "TEST.h"
TEST::LATCH(int pin)
{
pinMode(pin, OUTPUT);
_LATCH = pin;
};
TEST::MRESET(int pin)
{
pinMode(pin1, OUTPUT);
_MRESET = pin1;
};
void TEST::TEST0a()
{
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
}
void TEST::TEST1a()
{
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
}
void TEST::TEST2a()
{
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
}
void TEST::TEST3a()
{
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
}
void TEST::TEST4a()
{
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
}
void TEST::TEST5a()
{
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
delayMicroseconds(6);
digitalWrite(_LATCH, LOW);
delayMicroseconds(6);
digitalWrite(_LATCH, HIGH);
}
//And so on until sequence 15
void TEST::TESTReset()
{
digitalWrite(MRESET, HIGH);
delayMicroseconds(50);
digitalWrite(MRESET, LOW);
}
THANKS in advanced. ![]()