Looking for library NixieBeta4.h

More
3 years 9 months ago - 3 years 9 months ago #9117 by Ian
Well, that should defintely work, as long as you get the allocation of the pins right. I have found that there are many different ways of naming the pins on the 74(HC(T))595, and everyone seems to use different ones.

The "shiftOut" works fine in my experience.

There is one other gotcha with the 595. You need to set up the !SRCLR (pin10) and the !OE (pin13) correctly. For normal operation, pin13 needs to be held low and pin10 needs to be held high.

Soon, I'll be publishing code and data for a new VFD clock, and you can take "inspiration" from those... ;)
Last edit: 3 years 9 months ago by Ian. Reason: typos, dammit

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago #9119 by Ty_Eeberfest
I prefer my Atmegas butt naked (I'm not a big Arduino expert), so I haven't ever tried the Arduino shiftOut() function. But looking it up I can see how it works and based on that I'd say your code should work.

Not sure what you mean by:
" am using: Serial = D4; Clock = D5; RCK = D6
I think that I should be defining "Data" as opposed to "Analogue" but I haven't figured out how to do that just yet." BUT...

What I don't like the looks of is, as you said, pin definitions. Arduino IDE libraries provide pre-defined constants with names like PD0 or PA4 (etc.) that contain the correct values to point to the named pins.

int dataPin = PD3; //example not real definition
OR maybe it's just
int dataPin = D3; //example not real definition

Constants are part of the board definition files since they vary between different models of Arduino. Make sure you have the correct board selected (board manager) for the physical board you are working with. Look for board specific docs or just play around to determine what the pin naming conventions are for the board.

Look into it later when the dust is clearing off the crater.

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago #9120 by Ty_Eeberfest
Incidentally, if you are interested in how it's done without Arduino libraries, here's how I drive a string of 4 '595s (32 bits total) from C using WinAVR libraries.
/** SH (74HC595 PIN 11 - Shift Strobe) **/
#define SH_PIN PD2
#define SH_PORT PORTD
#define SH_DDR DDRD

/** DS (74HC595 Pin 14 - Data Source) **/
#define DS_PIN PD6
#define DS_PORT PORTD
#define DS_DDR DDRD

/** ST (74HC595 Pin 12 - Store Strobe) **/
#define ST_PIN PD3
#define ST_PORT PORTD
#define ST_DDR DDRD



void HC595_shifter(uint32_t outDword)
{
// Low-level control of the 32 outputs in the HC595 array	
    for (uint32_t bit=0x80000000; bit; bit>>=1) 
    {
        if (outDword & bit) // True bit
            DS_PORT |= _BV(DS_PIN);
        else                // False bit
            DS_PORT &= ~_BV(DS_PIN);
		
        SH_PORT |= _BV(SH_PIN);	// Clock shift register
        SH_PORT &= ~_BV(SH_PIN);        				
    }
    ST_PORT |= _BV(ST_PIN); // Move data into latches
    ST_PORT &= ~_BV(ST_PIN);	
}

Look into it later when the dust is clearing off the crater.

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago - 3 years 9 months ago #9121 by RedeyePete
I briefly sidetracked to take the clock apart.
I had top touch up some paint, elongate the mounting holes for the RHS Hours socket as it was misaligned, and some other minor modifications.

I could not find much info on the pin labeling for the Leostick. And there was not much on the Freetronics website.
I guess that not many people experimented with this unit.

However I did find out that the Digital pins are labeled 0 - 13 and the Analogue pins are 14 - 19.
If you use an analogue specific command like analogWrite() then you can reference the Analogue pins as 0 - 5

I have attached some pics. Note the crooked RHS Hours tube.




Fun fact: The Leostick has 28 header pins and the Nano has 30!
Attachments:
Last edit: 3 years 9 months ago by Ian. Reason: Put the images inline

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago #9123 by Ty_Eeberfest
Is the Leostick treated as a Leonardo in the IDE or is there a separate set of board definitions specific to Leostick that you installed?

Assuming you are on Windows...

If it's treated as a Leonardo see
C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\leonardo\pins_arduino.h

If it has its own board defs try looking in
My Documents\Arduino\hardware\leostick\variants\leostick\pins_arduino.h
(or something like that - look around My Documents\Arduino\hardware\ for something that looks like the name of the board you have)

That pins_arduino.h contains everything you need to know about pin mapping for your board. It's kind of cryptic but not impossibly so.

Look into it later when the dust is clearing off the crater.

Please Log in or Create an account to join the conversation.

More
3 years 9 months ago #9127 by RedeyePete
I am using Leostick specific board definitions.
I had a quick look at some of the files (there was no specific file called pins_arduino.h)
But decided to approach this in a different way.
I was able to confirm that I had the correct pins by writing each of the 3 pins individually and looking at the output on my scope.
I then used the shiftout command and that worked too.
Now to put the Leostick back into the circuit and see what happens.

Please Log in or Create an account to join the conversation.

Moderators: AccutronTy_EeberfestIan
Time to create page: 0.106 seconds
Go to top
JSN Boot template designed by JoomlaShine.com