Nixie tubes and no NIBs
Jonathan
Posts: 1,023
Hi All,
I am working on a project that uses Nixie tubes for the display. I have used these many times with the BS2 and with PICs. I can't seem to find the easy way to do this in Spin.
Basically, the project uses 2X 74HC595's to drive 4X 74141's, which drive the Nixie tubes. Each nixie needs 4 bits. So, for 4 digits, I need to shiftout·2 bytes.
In the past, I have used two different methods. In PBASIC, I would use the NIB capability to set the high/low nib of each byte, like:
nixSecs········ VAR···· byte
nixScLo········ VAR···· nixSecs.LOWNIB
nixScHi········ VAR···· nixSecs.HIGHNIB
SHIFTOUT DataOut, Clock, MSBFIRST, [noparse][[/noparse]nixSecs]
With a PIC, I would just shiftout the lower 4 bits of each byte, like:
shiftout DAT,CLK,1,[noparse][[/noparse]nixMinutesHi\4,nixMinsLo\4,nixSecHi\4,nixSecLo\4]
Of course, Spin does not have NIBs, so that rules out method #1. I would have thought that method #2 would work. However, using·either the BS2_Functions or SPI_Engine, it does not work correctly, like:
shift.shiftout(datPin,CLK,msbfirst,4,nixMinsTens)
shift.shiftout(datPin,CLK,msbfirst,4,nixMinsOnes)
shift.shiftout(datPin,CLK,msbfirst,4,nixSecTens)
shift.shiftout(datPin,CLK,msbfirst,4,nixSecOnes)
If I shiftout the entire word, manually setting the bits in it, it works correctly, like:
config := %1001_1101_1101_1101
shift.shiftout(datPin,CLK,msbfirst,16,config)
So essentially, what I am looking for is a way to load 4 nibs into a word, or a way to shiftout the lower 4 bits of a byte. The valid nixie codes for each digit can be stored in DATA or in a lookdown.
Many thanks, I know this is an easy thing to do.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
I am working on a project that uses Nixie tubes for the display. I have used these many times with the BS2 and with PICs. I can't seem to find the easy way to do this in Spin.
Basically, the project uses 2X 74HC595's to drive 4X 74141's, which drive the Nixie tubes. Each nixie needs 4 bits. So, for 4 digits, I need to shiftout·2 bytes.
In the past, I have used two different methods. In PBASIC, I would use the NIB capability to set the high/low nib of each byte, like:
nixSecs········ VAR···· byte
nixScLo········ VAR···· nixSecs.LOWNIB
nixScHi········ VAR···· nixSecs.HIGHNIB
SHIFTOUT DataOut, Clock, MSBFIRST, [noparse][[/noparse]nixSecs]
With a PIC, I would just shiftout the lower 4 bits of each byte, like:
shiftout DAT,CLK,1,[noparse][[/noparse]nixMinutesHi\4,nixMinsLo\4,nixSecHi\4,nixSecLo\4]
Of course, Spin does not have NIBs, so that rules out method #1. I would have thought that method #2 would work. However, using·either the BS2_Functions or SPI_Engine, it does not work correctly, like:
shift.shiftout(datPin,CLK,msbfirst,4,nixMinsTens)
shift.shiftout(datPin,CLK,msbfirst,4,nixMinsOnes)
shift.shiftout(datPin,CLK,msbfirst,4,nixSecTens)
shift.shiftout(datPin,CLK,msbfirst,4,nixSecOnes)
If I shiftout the entire word, manually setting the bits in it, it works correctly, like:
config := %1001_1101_1101_1101
shift.shiftout(datPin,CLK,msbfirst,16,config)
So essentially, what I am looking for is a way to load 4 nibs into a word, or a way to shiftout the lower 4 bits of a byte. The valid nixie codes for each digit can be stored in DATA or in a lookdown.
Many thanks, I know this is an easy thing to do.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Comments
without knowing the exact requirements can't help much.
The 595's are slow use 373's or 374's I can send you A handful
if you're stuck.
Best Regards
Ian
CON
·nibmask = %1111
then use shifts (the << operator)
shift.shiftout(datPin,CLK,msbfirst,16, (nixMinsTens & nibmask) << 12 | (nixMinsOnes & nibmask) << 8 | (nixSecTens & nibmask) << 4 | nixSecOnes & nibmask)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I took a look at the '373 and 374. I don't see where they would help. The 595s are working fine as far as I can tell. Thanks for the offer of chips. If it turns out the 595s are a problem, I'll take you up on that.
The problem is loading the word variable with four sperate nibs. I have been trying shifting bits and masks, but with no luck.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
DataOut := 16*(nixSecs/10) + nixSecs//10
Where the 16* shifts the tens number left four places and the //10 separates the units number
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
As an ex 68K engineer everything is about speed
as usual I'm talking Smile your NIXES are very slow devices
so the 595's are fine I'm talking sub 30nS transistion times!!!
I'll just go and stick my head in the microwave.!!!
This is exactly what comes to mind, after it took me some time to understand the background of the problem, i.e. what IAN called the "requirements"
BTW I cannot understand what a '373 has to do with this, as it is a simple latch and not a SIPO !?
The SHIFTOUT is no secret, you can understand it - and even adapt it to your needs
The funny thing is, that Jonathan reports the "solution #2" in his first posting as "does not work"!? This is somewhat dubious...
Post Edited (deSilva) : 9/25/2007 7:58:15 PM GMT
Thanks for all the help!! I got it going, here is what I wound up with:
I still wonder why method #2 from above won't work. Any ideas?
Many thanks for the help. Paul, I was working on something similar, but was not using the pipe. Good thing to know about.
Ian, as noted, I have a 1 sec epoch, so speed isn't an issue. Thanks for the kind offer though!
I bet I'm the first person to drive Nixies with a Prop! :-)
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Yes, there is some difference between LSBFIRST and MSBFIRST.
I feel a little bit "put on". In fact you gave NOT your "requirements" in the first place!!
I'm very sorry if you feel "put on". I did set out the requirements to the best of my (limited) abilities. Why does it make a big difference? It only reverses the display, but I don't see where it really changes the "requirements".
Sorry and thanks for the help!
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Just to be sure looked @ the spec sheet the 595 is a 373 with an O/P
latch.
Best Regards Ian
:- This a comment about me and nobody else
please engage brain before operating computer.
you don't,my fault totally, read the wrong page
looked at it again today and felt a total pratt.
Many many apologies
Best Regards Ian