Denny Esterline wrote: > I need a simple logic function, a two input AND feeding a two > input OR feeding another two input AND [see picture]. Since I don't > need any other logic in the project I hate waste the space and use > two chips, is anyone else's Boolean algebra less rusty that mine? > Is there a one part implementation (other than a PAL or CPLD)? Danny: A PIC could do it if you don't mind a six-microsecond propagation delay... ; Written for the 12C508A. ; ; GP0 = GND ; GP1 = A input ; GP2 = B input ; GP3 = C input ; GP4 = D input ; GP5 = OUTPUT ; ; OUTPUT = ((A and B) or C) and D LOOP: MOVF GPIO,W ADDWF PCL BCF OUTPUT ;0000 = 0 GOTO LOOP BCF OUTPUT ;0001 = 0 GOTO LOOP BCF OUTPUT ;0010 = 0 GOTO LOOP BSF OUTPUT ;0011 = 1 GOTO LOOP BCF OUTPUT ;0100 = 0 GOTO LOOP BCF OUTPUT ;0101 = 0 GOTO LOOP BCF OUTPUT ;0110 = 0 GOTO LOOP BSF OUTPUT ;0111 = 1 GOTO LOOP BCF OUTPUT ;1000 = 0 GOTO LOOP BCF OUTPUT ;1001 = 0 GOTO LOOP BCF OUTPUT ;1010 = 0 GOTO LOOP BSF OUTPUT ;1011 = 1 GOTO LOOP BCF OUTPUT ;1100 = 0 GOTO LOOP BSF OUTPUT ;1101 = 1 GOTO LOOP BCF OUTPUT ;1110 = 0 GOTO LOOP BSF OUTPUT ;1111 = 1 GOTO LOOP ; A second copy, since we don't know what GP5 will be ; when we execute the MOVF GPIO,W... BCF OUTPUT ;0000 = 0 GOTO LOOP BCF OUTPUT ;0001 = 0 GOTO LOOP BCF OUTPUT ;0010 = 0 GOTO LOOP BSF OUTPUT ;0011 = 1 GOTO LOOP BCF OUTPUT ;0100 = 0 GOTO LOOP BCF OUTPUT ;0101 = 0 GOTO LOOP BCF OUTPUT ;0110 = 0 GOTO LOOP BSF OUTPUT ;0111 = 1 GOTO LOOP BCF OUTPUT ;1000 = 0 GOTO LOOP BCF OUTPUT ;1001 = 0 GOTO LOOP BCF OUTPUT ;1010 = 0 GOTO LOOP BSF OUTPUT ;1011 = 1 GOTO LOOP BCF OUTPUT ;1100 = 0 GOTO LOOP BSF OUTPUT ;1101 = 1 GOTO LOOP BCF OUTPUT ;1110 = 0 GOTO LOOP BSF OUTPUT ;1111 = 1 GOTO LOOP -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist