|
|
||||||||||
A microprocessor-based system controls the flow of objects at the exit of an industrial assembly line. The assembly line has four separated exit paths. Every 200 mS it communicates to the control room, sending a report about the number of objects produced in the last 200 mS interval, for each exit path. Write and test the control program of the whole system, according to the following specification. A timer, connected to the DMC8 processor, sends an interrupt request !INT every 0.5 mS: the processor interrupt acknowledge signal !INTA clears automatically the interrupt request when the interrupt sequence starts. The parallel input port SENSORS (address 00h, see the figure) reads the outputs of four optical sensors (A, B, C and D), each placed on every exit path. The sensors generate ‘0’ in the idle state, and a ‘1’ when an object passes through their visual field. The parallel output ports COUNT (address 03h) and CODE (address 02h) enable communication with the control room. The COUNT port sends the count of objects (lines N7..N0) passed on a given exit path. The CODE port specifies the binary code of the exit path (‘00’ = A, ‘01’ = B, ‘10’ = C, ‘11’ = D) to which the count refers (lines C1, C0), and drives the Strobe line (C7). Firmware specifications The microprocessor, in the main program, controls continuously the SENSORS port. It compares their previous and current state, detecting the ‘0’ to ‘1’ transitions of the sensors outputs and incrementing, for each exit path, the corresponding count of objects. Suppose that, during the interval of 200 mS, much less than 255 objects will pass through a single path. The interrupt handling routine, executed at every “timer tick”, will count the number of times that it is called (so counting the elapsed time, in steps of 0.5 mS). When the 200 mS interval elapses, the count of time will be restarted and a variable SEND will be set. SEND will signal the main program to send the count information to the control room, for each exit path. The main program, while testing the sensors, controls also the SEND variable. If SEND is set, the main program proceeds to transmit data to the control room, according to the following rules:
Note that the control room will take into account the negative-edge transition on the Strobe line to read the Code and Count information. After the main program has completed the transmit sequence, the variable SEND is internally cleared. Here three templates are available for possible solutions, in assembly DMC8 code, in descending order of difficulty:
Who wants to deal only with the analysis of already written code, and the simulation of the system, will find here a complete solution. When finished to write and test the program in the d-McE, you would load it in the ROM of the microcomputer and simulate the whole circuit. Click on the next figure to open the schematic in the d-DcS. Note that, to test the receiver, the input "TestSequence" is available in the timing diagram window. |