Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
57dbf79
ajout structure2donnees
Khaldoche Nov 1, 2024
8562e9f
test
Khaldoche Nov 1, 2024
ada8d39
test2
Khaldoche Nov 1, 2024
6a70602
temporaire pour fusion master
Khaldoche Nov 6, 2024
cfc0eed
Merge branch 'master' of https://github.com/Team-Arduino-Logique/Ardu…
Khaldoche Nov 6, 2024
181e9f8
2eme fusion master
Khaldoche Nov 6, 2024
d2b2a05
Merge branch 'master' of https://github.com/Team-Arduino-Logique/Ardu…
Khaldoche Nov 6, 2024
a0e52f7
bug save-open logicFunction
Khaldoche Nov 6, 2024
f838f0a
circuit 2 fonctions
Khaldoche Nov 6, 2024
0f5f16d
circuit 2 fonction correctifs
Khaldoche Nov 10, 2024
db46c0a
correctif 2 : cir 2 fonc
Khaldoche Nov 10, 2024
a0b20d4
Merge branch '63-delete-items' of github.com:Team-Arduino-Logique/Ard…
charlotrudel Nov 10, 2024
b4e61d5
Fix menu
charlotrudel Nov 10, 2024
020db76
Load ios
charlotrudel Nov 10, 2024
5579dad
Merge branch 'master' of https://github.com/Team-Arduino-Logique/Ardu…
Khaldoche Nov 12, 2024
722afd0
téléversement
Khaldoche Nov 15, 2024
d9c8215
verif etn fonction finies
Khaldoche Nov 22, 2024
b68402c
Merge branch 'master' of github.com:Team-Arduino-Logique/Arduino-Logi…
charlotrudel Nov 22, 2024
d4e0778
Fixes after merge
charlotrudel Nov 22, 2024
00e8841
correction bug verif
Khaldoche Nov 23, 2024
2be63e0
bug sur boucle corrigé
Khaldoche Nov 23, 2024
c70b3ee
fonction valeur fixe
Khaldoche Nov 24, 2024
5e6f584
fonction avec entrée et valeurs fixes
Khaldoche Nov 24, 2024
e2ae22d
fonction simple terminées
Khaldoche Nov 24, 2024
04cf41c
script fonction de base tous les cas possibles
Khaldoche Nov 25, 2024
de921a1
MUX avec 3 tests
Khaldoche Nov 30, 2024
4070719
DMUX ok début bascule D
Khaldoche Dec 1, 2024
14a9cf7
DMUX debug cascade
Khaldoche Dec 2, 2024
2927768
made lists
charlotrudel Dec 3, 2024
9b06bd8
made lists
charlotrudel Dec 3, 2024
b091856
Added 74hc163
charlotrudel Dec 3, 2024
9064707
fix 163
charlotrudel Dec 3, 2024
7307539
JK à tester
Khaldoche Dec 5, 2024
417cdd0
Merge branch 'master' of github.com:Team-Arduino-Logique/Arduino-Logi…
charlotrudel Dec 5, 2024
7298ad5
merge fix
charlotrudel Dec 5, 2024
4c4f3eb
Merge branch 'dummy' into generate_script
Khaldoche Dec 5, 2024
ba29ac0
Moved zip
charlotrudel Dec 6, 2024
363cea7
commit menu show correspondance
Khaldoche Dec 6, 2024
7712c8a
Fix mac import
charlotrudel Dec 6, 2024
f552936
Ignored more files
charlotrudel Dec 6, 2024
44b9e25
JK 109 et 112 testées
Khaldoche Dec 6, 2024
fb833d9
correction bug 112
Khaldoche Dec 6, 2024
d08169e
fix quotes
charlotrudel Dec 8, 2024
a4b746c
Merge branch 'master' of github.com:Team-Arduino-Logique/Arduino-Logi…
charlotrudel Dec 8, 2024
440f307
fix os selection
charlotrudel Dec 8, 2024
8c34cf1
CB163 testé
Khaldoche Dec 11, 2024
40085ee
fix chips in sidebar
charlotrudel Dec 11, 2024
1636d98
correction bug lab 1 et 3
Khaldoche Dec 12, 2024
883fc72
dbug
Khaldoche Dec 12, 2024
0993793
Merge branch 'generate_script' of https://github.com/Team-Arduino-Log…
Khaldoche Dec 12, 2024
fba4522
dbug
Khaldoche Dec 12, 2024
2ccc83c
version de la prez
Khaldoche Dec 13, 2024
246d1e6
fix window size
charlotrudel Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
__pycache__/
.mypy_cache/
build/
dist/
dist/
*.DS_Store
*.tmp
*.temp
*.docx~
~*.docx
*.docx.tmp
*.docx.temp
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"configurations": [
{
"name": "ArduinoLogique",
"type": "debugpy",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/arduino_logique.py",
"console": "integratedTerminal"
Expand Down
2 changes: 1 addition & 1 deletion Components/Chips/Logical/74HC238_DEMUX_3_8.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"functions": [
{
"func_type": "DEMUX",
"address_pins": [1, 2, 3],
"input_pins": [1, 2, 3],
"output_pins": [15, 14, 13, 12, 11, 10, 9, 7],
"enable_pins": [6],
"inv_enable_pins": [4, 5]
Expand Down
8 changes: 4 additions & 4 deletions Components/Chips/Sequential/74HC109_JK.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"inv_j_input_pin": null,
"k_input_pin": null,
"inv_k_input_pin": 3,
"output_pin": 6,
"inv_output_pin": 7
"output_pins": 6,
"inv_output_pins": 7
},
{
"func_type": "JK_FLIP_FLOP",
Expand All @@ -32,8 +32,8 @@
"inv_j_input_pin": null,
"k_input_pin": null,
"inv_k_input_pin": 13,
"output_pin": 10,
"inv_output_pin": 9
"output_pins": 10,
"inv_output_pins": 9
}
],
"datasheet": "https://www.alldatasheet.com/datasheet-pdf/view/15527/PHILIPS/74HC109.html"
Expand Down
8 changes: 4 additions & 4 deletions Components/Chips/Sequential/74HC112_JK.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"inv_j_input_pin": null,
"k_input_pin": 2,
"inv_k_input_pin": null,
"output_pin": 5,
"inv_output_pin": 6
"output_pins": 5,
"inv_output_pins": 6
},
{
"func_type": "JK_FLIP_FLOP",
Expand All @@ -32,8 +32,8 @@
"inv_j_input_pin": null,
"k_input_pin": 12,
"inv_k_input_pin": null,
"output_pin": 9,
"inv_output_pin": 7
"output_pins": 9,
"inv_output_pins": 7
}
],
"datasheet": "https://www.alldatasheet.com/datasheet-pdf/view/15529/PHILIPS/74HC112.html"
Expand Down
27 changes: 27 additions & 0 deletions Components/Chips/Sequential/74HC163.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "74HC163",
"description": "Presettable synchronous 4-bit binary counter; synchronous reset",
"package": "DIP16",
"vcc_pin": 16,
"gnd_pin": 8,
"functions": [
{
"func_type": "BINARY_COUNTER",
"clock_pin": 2,
"clock_type": "RISING_EDGE",
"reset_pin": null,
"inv_reset_pin": 1,
"count_enable_pin": 7,
"inv_count_enable_pin": null,
"load_enable_pin": null,
"inv_load_enable_pin": 9,
"up_down_input_pin": null,
"inv_up_down_input_pin": 10,
"terminal_count_pin": 15,
"ripple_clock_output_pin": null,
"data_pins": [3, 4, 5, 6],
"output_pins": [14, 13, 12, 11]
}
],
"datasheet": "https://www.alldatasheet.com/datasheet-pdf/view/15547/PHILIPS/74HC163.html"
}
2 changes: 2 additions & 0 deletions Components/Chips/Sequential/74HC191_CB4CLED.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"func_type": "BINARY_COUNTER",
"clock_pin": 14,
"clock_type": "RISING_EDGE",
"reset_pin": null,
"inv_reset_pin": null,
"count_enable_pin": null,
"inv_count_enable_pin": 4,
"load_enable_pin": null,
Expand Down
24 changes: 12 additions & 12 deletions Components/Chips/Sequential/74HC74_D.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
"functions": [
{
"func_type": "D_FLIP_FLOP",
"clock_pin": 3,
"clock_pin": [3],
"clock_type": "RISING_EDGE",
"reset_pin": null,
"inv_reset_pin": 1,
"inv_reset_pin": [1],
"set_pin": null,
"inv_set_pin": 4,
"data_pin": 2,
"output_pin": 5,
"inv_output_pin": 6
"inv_set_pin": [4],
"input_pins": [2],
"output_pins": [5],
"inv_output_pins": [6]
},
{
"func_type": "D_FLIP_FLOP",
"clock_pin": 11,
"clock_pin": [11],
"clock_type": "RISING_EDGE",
"reset_pin": null,
"inv_reset_pin": 13,
"inv_reset_pin": [13],
"set_pin": null,
"inv_set_pin": 10,
"data_pin": 12,
"output_pin": 9,
"inv_output_pin": 8
"inv_set_pin": [10],
"input_pins": [12],
"output_pins": [9],
"inv_output_pins": [8]
}
],
"datasheet": "https://www.alldatasheet.com/datasheet-pdf/view/15659/PHILIPS/74HC74.html"
Expand Down
Binary file added Mc/bascule_essai_120.zip
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#include <Arduino.h>

const int MAX_INPUTS = 8;
const int MAX_OUTPUTS = 6;

const int inputPins[MAX_INPUTS] = {22, 23, 24, 25, 26, 27, 28, 29}; // Broches pour I1 à I8
const int outputPins[MAX_OUTPUTS] = {32, 33, 34, 35, 36, 37}; // Broches pour O1 à O6

String logicExpressions[MAX_OUTPUTS];

void setup() {
Serial.begin(9600);
for (int i = 0; i < MAX_INPUTS; i++) {
pinMode(inputPins[i], INPUT);
}
for (int i = 0; i < MAX_OUTPUTS; i++) {
pinMode(outputPins[i], OUTPUT);
digitalWrite(outputPins[i], LOW);
}
}

void loop() {
if (Serial.available()) {
String input = Serial.readStringUntil('\n');
parseMultipleExpressions(input);
}
updateOutputs();
}

void resetOutputs() {
for (int i = 0; i < MAX_OUTPUTS; i++) {
logicExpressions[i] = "";
digitalWrite(outputPins[i], LOW);
}
}

void parseMultipleExpressions(String input) {
resetOutputs();
input.trim();
int start = 0;
while (start < input.length()) {
int end = input.indexOf(';', start);
if (end == -1) {
end = input.length();
}
String expression = input.substring(start, end);
parseExpression(expression);
start = end + 1;
}
}

void parseExpression(String input) {
input.trim();
int eqIndex = input.indexOf('=');
if (eqIndex != -1 && input.startsWith("O")) {
int outputIndex = input.substring(1, eqIndex).toInt() - 1;
if (outputIndex >= 0 && outputIndex < MAX_OUTPUTS) {
logicExpressions[outputIndex] = input.substring(eqIndex + 1);
}
}
}

bool evaluateExpression(String expr) {
expr.trim();
expr.replace(" ", "");
for (int i = 0; i < MAX_INPUTS; i++) {
expr.replace("!I" + String(i + 1), String(!digitalRead(inputPins[i])));
expr.replace("I" + String(i + 1), String(digitalRead(inputPins[i])));
}
return evaluateComplexExpression(expr);
}

bool evaluateComplexExpression(String expr) {
struct Stack {
bool values[64];
char operators[64];
int valueTop = -1;
int operatorTop = -1;

void pushValue(bool value) {
values[++valueTop] = value;
}

bool popValue() {
return values[valueTop--];
}

void pushOperator(char op) {
operators[++operatorTop] = op;
}

char popOperator() {
return operators[operatorTop--];
}

char peekOperator() {
return operators[operatorTop];
}

bool isOperatorStackEmpty() {
return operatorTop == -1;
}
} stack;

for (int i = 0; i < expr.length(); i++) {
char c = expr.charAt(i);

if (c == '0' || c == '1') {
stack.pushValue(c == '1');
} else if (c == '(') {
stack.pushOperator(c);
} else if (c == ')') {
while (!stack.isOperatorStackEmpty() && stack.peekOperator() != '(') {
char op = stack.popOperator();
bool val2 = stack.popValue();
bool val1 = (op == '!') ? false : stack.popValue();
stack.pushValue(applyOperator(val1, val2, op));
}
stack.popOperator();
} else if (c == '&' || c == '|' || c == '!' || c == '^') {
while (!stack.isOperatorStackEmpty() && stack.peekOperator() != '(' && precedence(stack.peekOperator()) >= precedence(c)) {
char op = stack.popOperator();
bool val2 = stack.popValue();
bool val1 = (op == '!') ? false : stack.popValue();
stack.pushValue(applyOperator(val1, val2, op));
}
stack.pushOperator(c);
}
}

while (!stack.isOperatorStackEmpty()) {
char op = stack.popOperator();
bool val2 = stack.popValue();
bool val1 = (op == '!') ? false : stack.popValue();
stack.pushValue(applyOperator(val1, val2, op));
}

return stack.popValue();
}

bool applyOperator(bool a, bool b, char op) {
if (op == '&') return a && b;
if (op == '|') return a || b;
if (op == '^') return a != b;
if (op == '!') return !b;
return false;
}

int precedence(char op) {
if (op == '!') return 4;
if (op == '&') return 3;
if (op == '^') return 2;
if (op == '|') return 1;
return 0;
}

void updateOutputs() {
for (int i = 0; i < MAX_OUTPUTS; i++) {
if (logicExpressions[i] != "") {
bool outputValue = evaluateExpression(logicExpressions[i]);
if (outputValue) {
digitalWrite(outputPins[i], HIGH);
} else {
digitalWrite(outputPins[i], LOW);
}
}
}
}
Binary file not shown.
Binary file added Mc/simul61_testee_fonctionnelle.zip
Binary file not shown.
Loading
Loading