Cascading 5-MC14489s - issues?
xanatos
Posts: 1,120
Hi there,
I'm cascading 5 MC14489 5-Digit LED controllers. The first three banks work like a charm... The last two display "L" when the other 3 are displayijng "FALL", and nothing when the other three are displaying the other two phrases (POOL and bALL).
See video: http://www.youtube.com/watch?v=WQFeHp_97Uo
Code below... why would the first three banks display correctly, but not the last two?
Note that each 14489 is only using 4 of 5 digits. I have designated segs0 as a common blank character (See the SHIFTOUT command) for the unused display position.
The first three displays are controlled by segs 1-4, 5-8, 9-12 (see VARs).
Currently the rest of the program code is circumvented by a GOTO that just makes everything display the POOL bALL FALL intro display, so nothing after that figures in other than the subroutines.
See video: http://www.youtube.com/watch?v=WQFeHp_97Uo
Thanks for your help!
Dave
I'm cascading 5 MC14489 5-Digit LED controllers. The first three banks work like a charm... The last two display "L" when the other 3 are displayijng "FALL", and nothing when the other three are displaying the other two phrases (POOL and bALL).
See video: http://www.youtube.com/watch?v=WQFeHp_97Uo
Code below... why would the first three banks display correctly, but not the last two?
Note that each 14489 is only using 4 of 5 digits. I have designated segs0 as a common blank character (See the SHIFTOUT command) for the unused display position.
The first three displays are controlled by segs 1-4, 5-8, 9-12 (see VARs).
Currently the rest of the program code is circumvented by a GOTO that just makes everything display the POOL bALL FALL intro display, so nothing after that figures in other than the subroutines.
' ========================================================================= ' ' File....... PoolBallFalls-0.bsx ' Purpose.... Pool Ball Falls Museum Exhibit for 42 Design ' Author..... (c) David Xanatos, Xanatos.com and Xanatronics ' E-mail..... [email]Xanatos@xanatos.com[/email] ' Started.... 2012/08/11 ' Updated.... 2012/08/11 ' ' {$STAMP BS2sx} ' {$PBASIC 2.5} ' ' -----[ I/O Definitions ]------------------------------------------------- Cend1 PIN 0 ' I Count enable/disable signals to 4066.13 Cend4 PIN 1 ' I 4066.12 Cend2 PIN 2 ' I 4066.5 Cend3 PIN 3 ' I 4066.6 Clock PIN 4 ' I 14489.11 Enable PIN 5 ' I 14489.10 DataIO PIN 6 ' I 14489.12 startButton PIN 7 ' E Solenoids PIN 8 ' E ballsLoaded PIN 9 ' E LOW when all 5 balls loaded Rend5 PIN 10 ' E Rend4 PIN 11 ' E Rend3 PIN 12 ' E Rend2 PIN 13 ' E Rend1 PIN 14 ' E Run End signals from microswitches in PBF ball exit tube. flowCount PIN 15 ' I CT505.3 ' -----[ Constants ]------------------------------------------------------- #SELECT $STAMP #CASE BS2, BS2E, BS2PE T2400 CON 396 T9600 CON 84 T19K2 CON 32 #CASE BS2SX, BS2P T2400 CON 1021 T9600 CON 240 T19K2 CON 110 #CASE BS2PX T1200 CON 3313 T2400 CON 1646 T4800 CON 813 T9600 CON 396 T19K2 CON 188 T38K4 CON 84 #ENDSELECT ' MC14489 characters ' decode mode Ltr_A CON $0A ' Hex Ltr_b CON $0B ' Hex Ltr_C CON $0C ' Hex Ltr_c2 CON $01 ' Special Ltr_d CON $0D ' Hex Ltr_E CON $0E ' Hex Ltr_F CON $0F ' Hex Ltr_H CON $02 ' Special Ltr_h2 CON $03 ' Special Ltr_J CON $04 ' Special Ltr_L CON $05 ' Special Ltr_n CON $06 ' Special Ltr_O CON $00 ' Hex Ltr_o2 CON $07 ' Special Ltr_P CON $08 ' Special Ltr_r CON $09 ' Special Ltr_S CON $05 ' Hex Ltr_U CON $0A ' Special Ltr_u2 CON $0B ' Special Ltr_Y CON $0C ' Special Blank CON $00 ' Special or No ULine CON $08 ' No Dash CON $0D ' special Equal CON $0E ' Special DegSym CON $0F ' Special Colon CON %011 ' No DegSym2 CON %100 ' No ' -----[ Variables ]------------------------------------------------------- task VAR Nib ' Current task - selects via BRANCH which program section to run cwv VAR Word ' 5 words to hold the count data cww VAR Word cwx VAR Word cwy VAR Word cwz VAR Word cwv0 VAR cwv.BYTE0 ' Byte alias for first Byte, for SERIN cwd VAR Word ' Word to hold duration of header pulse ps VAR Byte ' Byte to hold current state of CT515 pins bs VAR ps ' Alias for ps. bs just shows ball status and can be overwritten by ps when the runs are done. config VAR Byte ' configuration register display VAR config.BIT0 ' 0 = off, 1 = on dPnts VAR Nib ' decimal point control segs20 VAR Nib ' segs - bank 1 (right) cwz segs19 VAR Nib segs18 VAR Nib segs17 VAR Nib segs16 VAR Nib ' segs - bank 2 cwy segs15 VAR Nib segs14 VAR Nib segs13 VAR Nib segs12 VAR Nib ' segs - bank 3 cwx segs11 VAR Nib segs10 VAR Nib segs9 VAR Nib segs8 VAR Nib ' segs - bank 4 cww segs7 VAR Nib segs6 VAR Nib segs5 VAR Nib segs4 VAR Nib ' segs - bank 5 (left) cwv segs3 VAR Nib segs2 VAR Nib segs1 VAR Nib segs0 VAR Nib x VAR Nib ' Test Counter ' -----[ Initialization ]-------------------------------------------------- 'CONFIG INFO 14889: 'Bit0 Display control; 0 = off, 1 = on 'Bit1 Bank 1 mode; 0 = Hex decode, 1 = Set by Bit6 'Bit2 Bank 2 mode; 0 = Hex decode, 1 = Set by Bit6 'Bit3 Bank 3 mode; 0 = Hex decode, 1 = Set by Bit6 'Bit4 Bank 4 mode; 0 = Hex decode, 1 = Set by Bit7 'Bit5 Bank 5 mode; 0 = Hex decode, 1 = Set by Bit7 'Bit6 0 = No decode, 1 = Special decode (for Banks 1 3) 'Bit7 0 = No decode, 1 = Special decode (for Banks 4 5) GET 0, task BRANCH task, [Init_Sys,Main] Init_Sys: config = %00000000 ' This just turns the display off. GOSUB Set_Cfg PAUSE 500 segs0 = %0000 Reset: HIGH Enable ' deselect 14489s INPUT flowCount ' CT505 LOW Cend1 LOW Cend2 LOW Cend3 LOW Cend4 'LOW Cend5 ' Not needed LOW Solenoids ' Make sure solenoids are off so balls don't drop through... Welcome: ' Displays POOL bALL FALL segs1 = Ltr_L segs2 = Ltr_O segs3 = Ltr_O segs4 = Ltr_P segs5 = Ltr_L segs6 = Ltr_O segs7 = Ltr_O segs8 = Ltr_P segs9 = Ltr_L segs10 = Ltr_O segs11 = Ltr_O segs12 = Ltr_P segs13 = Ltr_L segs14 = Ltr_O segs15 = Ltr_O segs16 = Ltr_P segs17 = Ltr_L segs18 = Ltr_O segs19 = Ltr_O segs20 = Ltr_P dPnts = %1000 GOSUB Set_Digits PAUSE 20 config = %11100111 ' This sets the decode mode on each display, and turns the display on. GOSUB Set_Cfg PAUSE 1000 segs1 = Ltr_L segs2 = Ltr_L segs3 = Ltr_A segs4 = Ltr_b segs5 = Ltr_L segs6 = Ltr_L segs7 = Ltr_A segs8 = Ltr_b segs9 = Ltr_L segs10 = Ltr_L segs11 = Ltr_A segs12 = Ltr_b segs13 = Ltr_L segs14 = Ltr_L segs15 = Ltr_A segs16 = Ltr_b segs17 = Ltr_L segs18 = Ltr_L segs19 = Ltr_A segs20 = Ltr_b dPnts = %1000 GOSUB Set_Digits config = %11001111 GOSUB Set_Cfg PAUSE 1000 segs1 = Ltr_L segs2 = Ltr_L segs3 = Ltr_A segs4 = Ltr_F segs5 = Ltr_L segs6 = Ltr_L segs7 = Ltr_A segs8 = Ltr_F segs9 = Ltr_L segs10 = Ltr_L segs11 = Ltr_A segs12 = Ltr_F segs13 = Ltr_L segs14 = Ltr_L segs15 = Ltr_A segs16 = Ltr_F segs17 = Ltr_L segs18 = Ltr_L segs19 = Ltr_A segs20 = Ltr_F dPnts = %1000 GOSUB Set_Digits PAUSE 3000 config = %00000000 ' This just turns the display off. GOSUB Set_Cfg GOTO Welcome ' -----[ Program Code ]---------------------------------------------------- Main: DO:LOOP UNTIL ballsLoaded = 1 ' When ballsLoaded goes HIGH (?), signal used to light START BUTTON via hardware (direct from ballsLoaded input- use a 2N2222) DO:LOOP UNTIL startButton = 1 GOSUB zeroCT ' Zero the counter HIGH Cend1 ' Enable the 4066 lines so all counters get the count pulses HIGH Cend2 HIGH Cend3 HIGH Cend4 'HIGH Cend5 ' Not needed - 555 is hardwired to counter "5" (doesn't go through 4066) HIGH Solenoids ' Fire the Solenoids bs = %00000000 DO IF Rend1 = 0 THEN LOW Cend1 ' Disable the counter channels as the run ends bs.BIT0 = 1 ENDIF IF Rend2 = 0 THEN LOW Cend2 ' These will set the Cend value low, despite the Rend value returning to HIGH bs.BIT1 = 1 ENDIF IF Rend3 = 0 THEN LOW Cend3 ' This means that the Rend values can't be expected to be all 0 when Rend 5 comes in. bs.BIT2 = 1 ENDIF IF Rend4 = 0 THEN LOW Cend4 bs.BIT3 = 1 ENDIF IF Rend5 = 0 THEN ' **** NOTE!!!! Rend 5 MUST BE the track that ALWAYS IS LAST! Else 5's time will be long. bs.BIT4 = 1 ENDIF IF bs = %00011111 THEN EXIT LOOP GOSUB Get_Counts dPnts = %1101 ' Sets DP to be after the first digit in each display (may need to edit/hardwire in case the 4 digit ' span and the 5 digit 14489 control cause the DPs to shift) segs1 = cwz DIG 0 ' ALSO: order (cwv to cwz) may need to be reversed... not sure. segs2 = cwz DIG 1 segs3 = cwz DIG 2 segs4 = cwz DIG 3 segs5 = cwy DIG 0 segs6 = cwy DIG 1 segs7 = cwy DIG 2 segs8 = cwy DIG 3 segs9 = cwx DIG 0 segs10 = cwx DIG 1 segs11 = cwx DIG 2 segs12 = cwx DIG 3 segs13 = cww DIG 0 segs14 = cww DIG 1 segs15 = cww DIG 2 segs16 = cww DIG 3 segs17 = cwv DIG 0 segs18 = cwv DIG 1 segs19 = cwv DIG 2 segs20 = cwv DIG 3 config = %00000000 ' turn off display GOSUB Set_Cfg GOSUB Set_Digits config = %00000001 GOSUB Set_Cfg PAUSE 15000 GOSUB zeroCT GOTO Main END ' -----[ Subroutines ]----------------------------------------------------- Set_Cfg: Enable = 0 ' enable 14489s SHIFTOUT DataIO, Clock, MSBFIRST, [config,0,0,config,0,0,config,0,0,config,0,0,config] ' send config register 'SHIFTOUT DataIO, Clock, MSBFIRST, [config,0,0,config,0,0,config,0,0,config,0,0,config] ' send config register Enable = 1 ' disable 14489 RETURN Set_Digits: Enable = 0 ' enable 14489s SHIFTOUT DataIO, Clock, MSBFIRST, [dPnts\4, segs20\4, segs19\4, segs18\4, segs17\4, segs0\4, dPnts\4, segs16\4, segs15\4, segs14\4, segs13\4, segs0\4, dPnts\4, segs12\4, segs11\4, segs10\4, segs9\4, segs0\4, dPnts\4, segs8\4, segs7\4, segs6\4, segs5\4, segs0\4, dPnts\4, segs4\4, segs3\4, segs2\4, segs1\4, segs0\4] 'SHIFTOUT DataIO, Clock, MSBFIRST, [0,0,dPnts\4, segs16\4, segs15\4, segs14\4, segs13\4, segs0\4, dPnts\4, segs12\4, segs11\4, segs10\4, segs9\4, segs0\4, dPnts\4, segs8\4, segs7\4, segs6\4, segs5\4, segs0\4, dPnts\4, segs4\4, segs3\4, segs2\4, segs1\4, segs0\4] Enable = 1 ' disable 14489s RETURN Get_Counts: LOW flowCount ' Get attention of CT515-1 PAUSE 10 INPUT flowCount ' Pullup resistor pulls the pin high PULSIN flowCount,0,cwd ' Header pulse duration - use this line ONLY when using the cwv0\10 line below. SERIN flowCount,T9600,100,noData,[ps,STR cwv0\10] PAUSE 50 DEBUG DEC cwv, " ", DEC cww, " ", DEC cwx, " ", DEC cwy, " ", DEC cwz, CR RETURN noData: DEBUG "ND1", CR GOTO Main RETURN zeroCT: LOW flowCount ' Get attention of CT515-1 PAUSE 10 INPUT flowCount ' Pullup resistor pulls the pin high PAUSE 200 cwv = 0 cwd = 0 PAUSE 200 RETURN
See video: http://www.youtube.com/watch?v=WQFeHp_97Uo
Thanks for your help!
Dave
Comments
How does it 'know' they are the last two ? - If you swap the order, does it stay the last two, or follow the same chip ?
Usually with this type of problem, you divide and swap, to uncover the important pivot issue.
Drop the clock speed is another simple variation.
Additionally, the 14489s are daisy-chained. The DataOut from one chip feeds the DataIn on the next, that's how it "knows" it's a given position. The two display banks that are not displaying correctly are the two at the end of the chain. Only the first (right-most) 14489 display bank is actually fed from the BS2sx. These chips are basically shift registers with 7-segment-decoded outputs. They are fed with the BS2's SHIFTOUT command (see the subroutine SetDigits). The config register is also possibly incorrect, but I can't figure out why it would be correct for the first three digit banks but not the last two...
Dave
Hoping this may be useful...
Dave
ie You want to check you can light every segment, one at a time.
If they were direct drive, for example, a single ON bit would shift one segment over on each clock.
Let me just say now, for the record, that I love you kwinn! :-)
I swapped the last "good" chip in the chain with the first "bad" chip in the chain, expecting, basically, nothing. And lo & behold, now all five displays are functioning perfectly. How the "bad" chip could be working perfectly in another socket is a mystery to me, which I will explore in the morning. Bad socket maybe? The solder joints are impeccable, inspected under a magnifying glass and tested with a meter. Somehow just unseating the thing & reseating it, maybe.
In any case, two wonderful things have resulted in the past six hours of digging at this: 1. It is now working! and 2: I now know more about the MC14489 than any human should ever have to know.
Thanks again kwinn!
Dave
PS., jmg, you were on the right track too, but when I swapped on your suggestion, I swapped the two chips at either end of the chain. So you get props too :-)
You might want to swap a few more times, (including back how it was) to see if it is a pairing issue, or a clearly-one-device issue.
If you have more, try them too.
You want to ensure it is not a marginal issue, that only just works.
On some instruments a PM started with pulling out all the boards, tightening all the Y connector pins on the motherboard, removing and reinserting every socketed chip, cleaning the pcb contacts, and replacing the board in the chassis. A very relaxing zen like exercise, but pretty boring when you had 10 - 20 boards with 30 - 40 socketed chips on each board.