Glad you made it work! :)
Here is my version for the HV5122/HV5222 - note this has no "POL", but
since POL is static as BL, it is not a problem of code.
My code takes care of 2 chips, and uses standart hardware pins, i had to
get rid of "digitalWrite()" since its to slow.
//*********************************************
#define thePort PORTD //define Hardware port where Shift-Registers are
connected
#define DATA PD5 //define Dataline
#define OE 6 //define latch pin
#define CLK PD7 //define clockline
void setOutputs(unsigned long val_one, unsigned long val_two) { //Function
to shift out 2 x 32bit fast enough to prevent flicker!
// ------------WARNING!--------------------
// This functions operates directly on ports, not via digitalWrite()
// because digitalWrite() would be to slow, and display would flicker
// if different pins are used, you maybe hav to change the variable
"thePort"
// to the matching I/O port letter of the controller!
digitalWrite(OE, LOW); //Disable Outputs to prevent flicker
//Send first 32-bit variable value
for (int i = 0; i < 32; i++) {
thePort &= ~_BV(DATA); //Data LOW
if ( bitRead(val_one, i) == 1) {
thePort |= _BV(DATA); //Data HIGH
}
thePort |= _BV(CLK); //CLK HIGH
thePort &= ~_BV(CLK); //CLK LOW
}
//Send second 32-bit variable value
for (int i = 0; i < 32; i++) {
thePort &= ~_BV(DATA); //Data LOW
if ( bitRead(val_two, i) == 1) {
thePort |= _BV(DATA); //Data HIGH
}
thePort |= _BV(CLK); //CLK HIGH
thePort &= ~_BV(CLK); //CLK LOW
}
digitalWrite(OE, HIGH); //Enable Outputs
}
--
You received this message because you are subscribed to the Google Groups
"neonixie-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/neonixie-l/e642c57a-8043-482c-bd64-1cddd8388ee5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.