diff --git a/SDPPython/__pycache__/chip.cpython-312.pyc b/SDPPython/__pycache__/chip.cpython-312.pyc index f856001..faef868 100644 Binary files a/SDPPython/__pycache__/chip.cpython-312.pyc and b/SDPPython/__pycache__/chip.cpython-312.pyc differ diff --git a/SDPPython/__pycache__/chips.cpython-312.pyc b/SDPPython/__pycache__/chips.cpython-312.pyc index dfcd2af..502528b 100644 Binary files a/SDPPython/__pycache__/chips.cpython-312.pyc and b/SDPPython/__pycache__/chips.cpython-312.pyc differ diff --git a/SDPPython/chip.py b/SDPPython/chip.py index f59e103..3f8c601 100644 --- a/SDPPython/chip.py +++ b/SDPPython/chip.py @@ -70,13 +70,9 @@ def pin_configuration_json(self): Returns the pin configuration as a JSON string. """ config = { - "chip_number": self.chip_number, - "logic_type": self.logic_type, - "pin_count": self.pin_count, - "description": self.description, "pins": self.pin_config } - return json.dumps(config) + return json.dumps(self.pin_config) def send_pin_configuration(self, uart_port, baudrate=250000): """ diff --git a/SDPPython/chips.py b/SDPPython/chips.py index caaf23d..a6a24e2 100644 --- a/SDPPython/chips.py +++ b/SDPPython/chips.py @@ -1,68 +1,68 @@ from chip import IC74Series ic_7400 = IC74Series(chip_number="00", logic_type="NAND",n = 2,description="Quad 2-input NAND gate") -ic_7400.set_pin(1, "input") -ic_7400.set_pin(2, "input") -ic_7400.set_pin(3, "output") -ic_7400.set_pin(4, "input") -ic_7400.set_pin(5, "input") -ic_7400.set_pin(6, "output") -ic_7400.set_pin(7, "ground") -ic_7400.set_pin(8, "output") -ic_7400.set_pin(9, "input") -ic_7400.set_pin(10, "input") -ic_7400.set_pin(11, "output") -ic_7400.set_pin(12, "input") -ic_7400.set_pin(13, "input") +ic_7400.set_pin(1, "INPUT") +ic_7400.set_pin(2, "INPUT") +ic_7400.set_pin(3, "OUTPUT") +ic_7400.set_pin(4, "INPUT") +ic_7400.set_pin(5, "INPUT") +ic_7400.set_pin(6, "OUTPUT") +ic_7400.set_pin(7, "GND") +ic_7400.set_pin(8, "OUTPUT") +ic_7400.set_pin(9, "INPUT") +ic_7400.set_pin(10, "INPUT") +ic_7400.set_pin(11, "OUTPUT") +ic_7400.set_pin(12, "INPUT") +ic_7400.set_pin(13, "INPUT") ic_7400.set_pin(14, "VCC") ic_7400.set_truth_table([1,1,1,0]) ic_7408 = IC74Series(chip_number="08", logic_type="AND",n = 2,description="Quad 2-input AND gate") -ic_7408.set_pin(1, "input") -ic_7408.set_pin(2, "input") -ic_7408.set_pin(3, "output") -ic_7408.set_pin(4, "input") -ic_7408.set_pin(5, "input") -ic_7408.set_pin(6, "output") -ic_7408.set_pin(7, "ground") -ic_7408.set_pin(8, "output") -ic_7408.set_pin(9, "input") -ic_7408.set_pin(10, "input") -ic_7408.set_pin(11, "output") -ic_7408.set_pin(12, "input") -ic_7408.set_pin(13, "input") +ic_7408.set_pin(1, "INPUT") +ic_7408.set_pin(2, "INPUT") +ic_7408.set_pin(3, "OUTPUT") +ic_7408.set_pin(4, "INPUT") +ic_7408.set_pin(5, "INPUT") +ic_7408.set_pin(6, "OUTPUT") +ic_7408.set_pin(7, "GND") +ic_7408.set_pin(8, "OUTPUT") +ic_7408.set_pin(9, "INPUT") +ic_7408.set_pin(10, "INPUT") +ic_7408.set_pin(11, "OUTPUT") +ic_7408.set_pin(12, "INPUT") +ic_7408.set_pin(13, "INPUT") ic_7408.set_pin(14, "VCC") ic_7408.set_truth_table([0,0,0,1]) ic_7432 = IC74Series(chip_number="32", logic_type="OR",n = 2,description="Quad 2-input OR gate") -ic_7432.set_pin(1, "input") -ic_7432.set_pin(2, "input") -ic_7432.set_pin(3, "output") -ic_7432.set_pin(4, "input") -ic_7432.set_pin(5, "input") -ic_7432.set_pin(6, "output") -ic_7432.set_pin(7, "ground") -ic_7432.set_pin(8, "output") -ic_7432.set_pin(9, "input") -ic_7432.set_pin(10, "input") -ic_7432.set_pin(11, "output") -ic_7432.set_pin(12, "input") -ic_7432.set_pin(13, "input") +ic_7432.set_pin(1, "INPUT") +ic_7432.set_pin(2, "INPUT") +ic_7432.set_pin(3, "OUTPUT") +ic_7432.set_pin(4, "INPUT") +ic_7432.set_pin(5, "INPUT") +ic_7432.set_pin(6, "OUTPUT") +ic_7432.set_pin(7, "GND") +ic_7432.set_pin(8, "OUTPUT") +ic_7432.set_pin(9, "INPUT") +ic_7432.set_pin(10, "INPUT") +ic_7432.set_pin(11, "OUTPUT") +ic_7432.set_pin(12, "INPUT") +ic_7432.set_pin(13, "INPUT") ic_7432.set_pin(14, "VCC") ic_7432.set_truth_table([0,1,1,1]) ic_7486 = IC74Series(chip_number="86", logic_type="XOR",n = 2,description="Quad 2-input XOR gate") -ic_7486.set_pin(1, "input") -ic_7486.set_pin(2, "input") -ic_7486.set_pin(3, "output") -ic_7486.set_pin(4, "input") -ic_7486.set_pin(5, "input") -ic_7486.set_pin(6, "output") -ic_7486.set_pin(7, "ground") -ic_7486.set_pin(8, "output") -ic_7486.set_pin(9, "input") -ic_7486.set_pin(10, "input") -ic_7486.set_pin(11, "output") -ic_7486.set_pin(12, "input") -ic_7486.set_pin(13, "input") +ic_7486.set_pin(1, "INPUT") +ic_7486.set_pin(2, "INPUT") +ic_7486.set_pin(3, "OUTPUT") +ic_7486.set_pin(4, "INPUT") +ic_7486.set_pin(5, "INPUT") +ic_7486.set_pin(6, "OUTPUT") +ic_7486.set_pin(7, "GND") +ic_7486.set_pin(8, "OUTPUT") +ic_7486.set_pin(9, "INPUT") +ic_7486.set_pin(10, "INPUT") +ic_7486.set_pin(11, "OUTPUT") +ic_7486.set_pin(12, "INPUT") +ic_7486.set_pin(13, "INPUT") ic_7486.set_pin(14, "VCC") ic_7486.set_truth_table([0,1,1,0]) diff --git a/SDPPython/serialcommunication.py b/SDPPython/serialcommunication.py index 308248d..277be82 100644 --- a/SDPPython/serialcommunication.py +++ b/SDPPython/serialcommunication.py @@ -11,7 +11,7 @@ # Sending data message = ic_7400.pin_configuration_json() -ser.write((message).encode('utf-8')) +ser.write((message+"\n").encode('utf-8')) print(f'Sent: {message}')