document

10
Light Controller through HC574 D-flip-flops Xiaoxu Li December 10, 2013 1 Description This projects studies controls over multiple LEDs with 8-bit addressing through software Labview. The key idea is to divide LEDs into groups and each group is controlled by a HC574 D type flip-flop. Each HC574 can control up to 8 LEDs by 8-bit input address and uses an edge triggered clock pin to update the 8-bit output. As demonstration, this project uses 10 ports to control 16 LEDs with 2 HC574 chips. 8 of 10 occupied ports are used as addressing and 2 are used as clock control for the chips. From here, for every single control port added, it enables control over 8 more LEDs with little adjustment. 2 Circuits As shown in Figure 2, 8 bits address ports from DAQ are connected to the 8 bits input of both HC574s. And the last two ports are connected to the CP pin individually to function as clock control. OE ( OE) pin is the enable output pin and active low, thus in this project both OE pins are pulled to ground. The CP pin is rising edge triggered and once triggered the readings in D pins will be updated to Q pins, otherwise the readings on D pins are ignored, and Q pins are kept until next update. Figure 1: bread board 1

Upload: xiaoxu-li

Post on 14-Aug-2015

18 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: document

Light Controller through HC574 D-flip-flops

Xiaoxu Li

December 10, 2013

1 Description

This projects studies controls over multiple LEDs with 8-bit addressing through software Labview. The keyidea is to divide LEDs into groups and each group is controlled by a HC574 D type flip-flop. Each HC574 cancontrol up to 8 LEDs by 8-bit input address and uses an edge triggered clock pin to update the 8-bit output.As demonstration, this project uses 10 ports to control 16 LEDs with 2 HC574 chips. 8 of 10 occupied portsare used as addressing and 2 are used as clock control for the chips. From here, for every single control portadded, it enables control over 8 more LEDs with little adjustment.

2 Circuits

As shown in Figure 2, 8 bits address ports from DAQ are connected to the 8 bits input of both HC574s.And the last two ports are connected to the CP pin individually to function as clock control. OE (OE) pinis the enable output pin and active low, thus in this project both OE pins are pulled to ground. The CP pinis rising edge triggered and once triggered the readings in D pins will be updated to Q pins, otherwise thereadings on D pins are ignored, and Q pins are kept until next update.

Figure 1: bread board

1

Page 2: document

Figure 2: schematic for the test circuit

2

Page 3: document

3 Labview Program

3.1 Front Panel

Figure 3: front panel

The front panel of the program consists of individual switches, clear all, blink and stop function:

• Individual switches: The switch is on if pressed, the led above the switch displays the current state ofexternal LED.

• Clear All: When pressed, all LEDs are turned off no matter what the states are individual switchesat. When unpressed, all LEDs are resumed to previous states.

• Blink: When pressed, all LEDs that are already turned on start to blink, this function takes secondarypriority compare to Clear All.

• Stop: Stop the program.

3

Page 4: document

3.2 Main Body

Figure 4: main body for the program

In the main block of the program (”LightControl.vi”). The states of each individual switches are summedup as binary numbers to obtain the total sum in decimal which will be used in DAQ control. Then thenumbers are sent to sub VI to process, then according to conditions the proper output are passed to DAQ.

The display of LEDs are results from simulations of the bread board circuits and additional functions(”Clear All”, ”Blink”) are selected by sub VIs for which details are included in the corresponding section.

4

Page 5: document

3.3 Function Select Sub VI

Figure 5: ControlSelect.vi

This ”ControlSelect.vi” outputs numerical values when corresponding boolean input (switches) are given.Only one function is output at a single time according to priority. In this case ”func1” has higher prioritycompare to ”func2”. Though it’s possible to encode functions as product of prime numbers to enable multiplefunctions combined in a single output, such complexity is ignored since there’re only two functions in thisprogram.

5

Page 6: document

3.4 Central Control Sub VI

This ”DACControl.vi” functions through codes to manage inputs and outputs. It consists of three mainblocks: individual controls, functions, and resume from interrupts.

• Initialization and individual controls:

Figure 6: DACControl.vi individual control part

”latch1” and ”latch2” conresponds clock pin control for the flip-flops, they are initialized 0 at thebeginning every time the formula node starts. ”interrupt” and ”interrupted” correspond to activationof function mode and resuming mode. We’ll enter individual control mode only if both values are 0.

After entering individual mode we check if any configuration of switches has changed by comparingthe binary sums from switches ”sum1” and ”sum2” with feedback from previous execution ”mem1”and ”mem2” (”memory1” and ”memory2”). If changed, we set corresponding latch to 1 and set ”out”(”output”) equals to the corresponding sum and updates memory. When both are changed, sum1 takespriority in processing.

6

Page 7: document

• Function Mode:

Figure 7: DACControl.vi function control part

Function model is only entered when there is an interrupt signal (interrupt ! = 1), then switched toindividual function according ”request” input.

Case 1 corresponds ”Clear All” function, where latch1 and latch2 are contantly switch between 0 and1 and output is set to 0. It’s necessary to make the program robust by setting latch to 0 then back to1 is because HTC574 is rising edge triggered, there’s no guarantee that previous latch output is not 1.

Case 2 corresponds ”Blink” function, where we set a timer as blink interval, then switch between clearall and resume. It can be treat as a combination of ”Clear All” function and the resuming mode willtalk about in the next part. ;

7

Page 8: document

• Resuming Mode:

Figure 8: DACControl.vi resuming from interrupt part

Resuming Mode simply set LEDs back to its original state in individual control mode. LED array 1takes priority to be reset in the first cycle, then LED array 2 takes turn to be reset. The empty case 1is to ensure both latches are set to low and then being given a rising edge to trigger clock and updatestates. ;

8

Page 9: document

4 74HTC574 Simulation VI

”HTC574SIMU 1.vi” and ”HTC574SIMU 2.vi” have identical structure. The reason to use two separatefiles is in Labview objects construct from the same file shares the same state memory. An analogy is it’s likea server you can access from wherever you want, but once you changed some file on the server through oneaccess, the results obtained from other access will automatically be changed. This is no the behavior for 2separate chips in reality and thus not what we desired.

Figure 9: HTC574SIM.vi code

This is not an identical simulation of 74HTC574 since it’s level triggered instead of rising edge triggeredand memory updates when latch=0, but good enough for the display purpose. As shown, the d valuesrepresent 8-bit address input and q values represent 8-bit address output. Every time after an output isgiven, the q values feedback and are stored as m values.

9

Page 10: document

5 Conclusion

This project can be easily extend to accommodate more functions such as display LEDs in sequence orcontrol by inputting lines and columns numbers. The time interval for ”Blink” can be improved where inthis project it’s not equal interval due to the necessity to skip every 2 counts to create a rising edge and therefill of timer.

Figure 10: board and screen

10