Some of the chips have internal latches, wouldn't this feature counter flickering? HV5522/HV5622 seem to be similar to chips you're using, differing mostly in presence of latches (and some differences in pinout, too).
W dniu poniedziałek, 8 października 2018 20:31:21 UTC+2 użytkownik SWISSNIXIE - Jonathan F. napisał: > > I'm using HV5122/HV5222 in all my applications, and im pretty sure most of > the microchip HV series are identical only differ in voltage and some > protocol types. > > They can be driven at 5V, but 'm using a Level Shifter (CD4504) to shift > from 5 to 12V > > How ever, one major issue with these IC's is that if you use arduino, > flicker can occur depending on your arduino and code. > If you translate the "digitalWrite()" to assembler code, you get about 55 > assembler commands. > > To shift out 64bit of data, you need around 130 "digitalWrite()"'s if you > do it sloppy, if you check for following 0 or 1 you can save some, but lets > figure you need 130. > > 130 digitalWrite() * 55 Assembler commands = 7150 commands. > If your Arduino runs at 16Mhz one command takes about 62ns > If your Arduino runs at 8Mhz one command takes about 124ns > > To run 7150 commands, it would take 443us for 16Mhz and 886us for 8Mhz. > And this calculation does not include delays in execution that are created > by interrupts! So in some case you will se flickering in the digits! It > happened to me alof of times, so i created the follwing function that can > be way faster than digital write: > > https://github.com/sgtJohnny/sunix/blob/master/sunix.ino > > #define DATA PD5 //define Dataline >> #define OE 6 //define latch pin >> #define CLK PD7 //define clockline >> #define thePort PORTD //define Hardware port where Shift-Registers are >> connected >> > > >> 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 >> >> } >> > > If one would use a Arduino Mega or STM32 you could use the second SPI Port > to shift out to the Registers > > >> -- 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/e1186912-4f14-4935-a204-11758eae4979%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
