Skip to main content
edited body
Source Link

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a disjunctiveconjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

In the c1 expression you are also suddenly using the + operator in a chain of logical expressions, which looks wrong.

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access or an interrupt-based approach. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a disjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access or an interrupt-based approach. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a conjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

In the c1 expression you are also suddenly using the + operator in a chain of logical expressions, which looks wrong.

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access or an interrupt-based approach. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

added 462 characters in body
Source Link

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a disjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access or an interrupt-based approach. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a disjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a disjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access or an interrupt-based approach. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

added 462 characters in body
Source Link

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a disjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

One potential error source: In your D-Flip-Flop code, you have

boolean flipflopD(boolean D, boolean Q, boolean CLK){
  boolean Qo=false;
    if (CLK=true) {
      Qo=D;
    } else {
  Qo=Q;
  }
  return Qo;
}

You probably want to do a comparison with double == instead of an assignment with = in the line

if(CLK=true)

This causes the if to always evaluate to true and set Qo=D.

Also, I am not really sure if this is what you want:

a1 = !A||B||D && !A||B||C & A||!B||!C||!D;

First, you're mixing && (logical-and) with the bitwise & here. Next, C++ operator precedence dictates that the && has a higher priority than ||. This looks like a disjunctive-normal-form of some boolean function, thus I would group the AND terms in parenthesis, like

a1 = (!A||B||D) && (!A||B||C) && (A||!B||!C||!D);

Overall I don't quite get how this should work. If you have an IR receiver connected to A2, from which you read the "CLK" input, it will get some 39kHz input wave when you point a IR remote at it and press a button. And you want that on each CLK rise/fall the Arduino reacts to it by calculating the output for a seven-segment display? Your Arduino Uno/Nano with its 16MHz will take some time to execute each of the statements in the loop, sequentally. So what you're doing is actually sampling the A2 input every now and then -- how often exactly, I don't know, maybe with a few kilohertz. Your Arduino might sample the input at the wrong time or not fast enough to react the way you expect. digitalRead and digitalWrite are notoriously slow, maybe try direct port access. Of course, calculating all these AND, OR and NOT expressions will take some processing time, too.

This sort of combinational logic is more suited for an FPGA implementation, not for an Arduino.

added 673 characters in body
Source Link
Loading
Source Link
Loading