Questions tagged [circuit]
In a programming context, a circuit usually refers to a combination of logical operators to achieve a desired response. Use this tag to ask about basic logical implementations and loops you can't get your head around.
303
questions
0
votes
1
answer
32
views
My code ignores the if condition when checking the button state
I want to press my button and then the leds will start turning on and off in a sequence.
int buttonState = 0;
int tDelay = 500;
int latchPin = 11; // output register clock
int clockPin = 9; // ...
0
votes
1
answer
14
views
Multisim - AND Gate Always Giving An Output
I recently downloaded Multisim to give it a try. I used it many years ago and recently have a need to design some circuits so it was my first go-to. However, I am run into issues where the ...
0
votes
1
answer
16
views
Why Circuit (circom) can't compare timestamp?
I have this circuit where I want to compare 2 timestamp.
If I try with smaller numbers, it's working, if I try with timestamps, it does not work.
Here's the circuit (.circom)
pragma circom 2.0.0;
...
0
votes
0
answers
17
views
TLC4502QD with PH sensor [closed]
Schematic Diagram
I'm using TLC4502QD IC to amplify the PH sensor output as in the diagram. It was observed that sometimes the output is lower and not constant( not converging) for the same PH sensor ...
-1
votes
1
answer
83
views
Arduino Id Instance error on python vscde
Whenever I try to run a code that is supposed to transmit a signal using Sonar HC-SR04 module and then receive that signal to ouput the distance.
But as soon as I run the code, it stops immediately ...
0
votes
0
answers
11
views
How to construct XOR of A and B
I am having trouble turning this truth table into a logic circuit:
a[1]
a[0]
b[1]
b[0]
s[1]
s[0]
0
0
0
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
0
0
1
1
1
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
1
0
1
1
0
1
1
1
1
...
0
votes
0
answers
24
views
Design A Circuit That Can Detect 4 Consecutive 1'S. Draw State Diagram & State Table
Using the design procedure for sequential circuits, we have to design a circuit that can detect 4 consecutive 1s or more, there was a similar question but with 3 consecutive 1s or more, in that ...
-1
votes
2
answers
77
views
How do I identify the Boolean Expression of this logic circuit?
As the title says, what can be the possible boolean expression of the logic circuit given? The Truth table is also included.Logic Circuit
I have tried to solve my own Boolean Expression and coded it ...
0
votes
0
answers
106
views
Raspberry Pi Pico not executing main.py upon 5V
I have a Raspberry Pi Pico W with code on it that lights up the onboard LED once it has successfully connected to WiFi, otherwise the onboard LED will blink. Most times upon start up however, (I have ...
0
votes
1
answer
65
views
Choosing the appropriate diode for TLV1117 regulator
Can I use 1N4148 or 1N4150 diode for D2 to connect it before the TLV1117 regulator?
1
vote
1
answer
312
views
PySpice: Simulate circuit with capacitor with defined initial condition
with PySpice I'm trying to simulate the discharging behavior of a capacitor with a defined initial condition in a circuit. This is a simplified example:
import PySpice.Logging.Logging as Logging
...
2
votes
1
answer
1k
views
What does "no compatibility mode selected" means in ngspice and how to solve it?
I want to write the code for fullwave bridge rectifier with resistance as load and I wrote the following code. But it showed an error. It showed "No compatibility mode selected". This is the ...
0
votes
1
answer
31
views
Circuits , Hazards/Karnaugh diagram || Can a Karnaugh-Vetch diagram consisting of 2 variables x and y even contain a hazard?
i dont understand completely but to me it seems like there cant be a problematic/hazardous path.
So its about hazards that can occur in a half-adder circuit with Inverters XORs and Ands. Cant get to ...
-1
votes
1
answer
102
views
How do microcontrollers store and retrieve data from RAM? [closed]
I am developing my own academic processor for myself and a problem arose. And I don't know how to implement reading and writing data from memory to a register. I can do exactly the order of ...
-1
votes
1
answer
111
views
How do I create a circuit based on this truth table?
So this is the truth table
In_1 In_2 In_3 Out
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 ...
-1
votes
2
answers
275
views
How to create a circuit that outputs only 1, regardless of inputs
So this is the truth table:
In_1 In_2 In_3 Out
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 ...
2
votes
1
answer
146
views
Why when i try to send heart rate values to real time database the sensor stops working arduino
I'm using NodeMCU and max30100 sensor module, everything works fine in the code until I add this line to loop()
if (Firebase.ready() && (millis() - sendDataPrevMillis > 15000 || ...
0
votes
1
answer
42
views
Short-Circuit property C
According to the short-circuit property in C:0&&(anything) gives 0 and 1||(anything) gives 1.
so according to the property-0&&5||6&&7||4&&!6,this should give us 0.
But ...
0
votes
1
answer
194
views
Errors when using MCMT to create a multi control cz gate and trying to measure
Multi control cz gate:
The error is saying that:
[Experiment 0] Circuit mcmt contains invalid instructions {"gates": {ccz}} for "statevector" method. , ERROR: Circuit mcmt ...
0
votes
1
answer
142
views
Get the result of sim in matlab code with input parameter returns not found
I have this circuit in Matlab simulation
As you can see I have R7 variable in my picture .
I want to run this simulink using Matlab script as you can see here :
simOut = sim('ehsaaan.slx','R7','1e-...
5
votes
1
answer
392
views
Pedersen circom/circomlibjs inconsistency?
As a unit test for a larger use case, I am checking that indeed the pedersen hash I am doing in the frontend aligns with the expected hash done through a circom circuit. I am using a simple assert in ...
0
votes
1
answer
96
views
what would be the most efficient algorithm for logic circuit synthesis if the only known knowledge about the problem is the fitness function?
I'm developing a program that tries to build logic circuit from NOR gates given some fitness function (logic_circuit => fitness_value).
currently I'm using some kind of simulated annealing(make N ...
0
votes
1
answer
130
views
Why XOR gates use "=1" to indicate
As shown in the title, why do you use "=1" in the IEC symbol for XOR instead of "=2", "3", or write XOR directly. Similarly, I have the same doubts about other gate ...
0
votes
1
answer
180
views
How to set a start value of the temperature for the simulation of a cooling circuit in Modelica?
I am currently simulating a cooling circuit in OpenModelica. I want to give the simulation a starting value of the temperature. To do this, I insert the model of the medium into the circuit and ...
0
votes
1
answer
159
views
How to create a logic circuit that takes 3 inputs and returns 1 only when all the inputs are equal?
I'm struggling with creating a logic circuit that could implement the following truth table:
0
votes
2
answers
235
views
Converting circuit benchmark to CNF formula to use to solve with SAT solvers
Is there any tool that can convert circuit benchmarks (ISCAS) to CNF so that it can be used in SAT solver? The main goal is to find some input patterns for the circuit which will give some predefined ...
1
vote
1
answer
490
views
How to run a loop with unknown number of iterations in Circom?
I have the following circuit in Circom cicuit compiler:
pragma circom 2.0.0;
template MAIN() {
signal len;
len <== 32;
for (k = 0; k < maplen; k++) {
// do something
}...
2
votes
1
answer
998
views
How to write a constraint that depends on a condition in Circom?
I have code of the following form in Circom circuit compiler
template DecodeUint(len) {
signal input x;
signal input pos;
signal output value;
signal output nextpos;
component ...
1
vote
1
answer
274
views
How to use & (AND) operator in a signal in Circom
I'm trying to use & operator on a signal and get another signal in Circom circuit compiler language like so:
pragma circom 2.0.0;
template MAIN() {
signal input a;
signal output x;
...
2
votes
1
answer
751
views
How to access array element with an "Unknown" index in Circom?
I have the following Circom (circuit compiler language) program:
pragma circom 2.0.0;
template MAIN() {
signal input array[2512];
signal output d;
signal v;
v <== 168;
d <...
1
vote
1
answer
291
views
How to pass function argument by reference in Circom?
How to pass function argument by reference in the circom circuit language?
I'm trying to do the following:
pragma circom 2.0.0;
function increment(foo) {
foo++;
}
template MyTemplate() {
...
-1
votes
1
answer
357
views
In logic circuit with one output , how to get all combination of input which produces a certain output ? (Without brute forcing) [closed]
Suppose i have a logic circuit , the logic circuit consist of input , static bit value (either 0 or 1) , and logic gate . All logic gate in the logic circuit takes two input and produce one output (...
3
votes
2
answers
138
views
How to represent combinational circuits in code
I'm writing a python program that does some operations on combinational circuits like comparing for equality to other circuits, merging gates, counting gates, counting connections, finding fanout ...
-1
votes
1
answer
136
views
random moving character on lcd
I bought a new LCD 16*2 and the last one worked very well with this code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
analogWrite(6, 20);
...
-7
votes
1
answer
69
views
I don't understand how to do this Lesson :'(
Lesson 2: Design an address decoder for 64 KB memory from 16KB memory ICs, knowing that the memory base address is 94000H and the address decoder is designed using circuits combinatorial logic.
-1
votes
1
answer
325
views
Fitting impedance of simple randles circuit to Fourier transform formula
I have this simple circuit that i want to find parameters of,
and its real-world magnitude frequency response derived from impedance spectroscopy.
(magnitude frequency response.Frequency is 10-...
0
votes
2
answers
947
views
How to simulate circuit of logic gates and flipflops
I'm currently learning C# and WPF, and i'm trying to simulate a circuit of logic gates and flipflops, but it won't work.
Could someone please show me a possible way to achive this? (maybe a simple ...
1
vote
0
answers
543
views
How do I get HC-06 Module to send signals to my Android Device?
I am trying to send messages to my Android device's terminal through the HC-06 Bluetooth Module.
Here is the current code.
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | ...
1
vote
1
answer
2k
views
How to generate Karnaugh maps from state transition table?
I have a state transtion table that looks like this:
And the binary equation obtained from this is:
I don't have any example in my text book that solves this table with Karnaugh map. The text book ...
-1
votes
2
answers
120
views
LTspice: unexpected current behavior
Driving a power mosfet with a gate driver w/ PWM toggle. When high, mosfet is expected to sink most of the current (current and voltage values in schematic are for testing purposes) through R1, ...
0
votes
1
answer
134
views
Adding points to a race circuit
I have 2 arrays in Python with latitude and longitude coordinates. They correspond to coordinates of a circuit. A plot of it looks like this :
Plot of the race
The fact is that I need more points on ...
0
votes
0
answers
129
views
How do I set up a convex optimisation problem where the variables to be optimised are input to another function?
I am formulating a convex optimisation problem using cvxpy in Python.
The goal is to optimise (minimise) the cost of an electrical network. The cost is a sum of the cost of wires (which depends on the ...
0
votes
1
answer
1k
views
A logic circuit is given two 2-bit binary numbers A and Bas its inputs. The circuit consists of two outputs Y1 and Y2
A logic circuit is given two 2-bit binary numbers A and Bas its inputs. The circuit consists of two outputs Y1 and Y2. The output values of Y1 and Y2 are obtained as follows:
If A<B, then Y1 and Y2 ...
1
vote
1
answer
136
views
YOSYS simulating a combinatorial circuit with a specific input
I have a very simple combinatorial circuit written in .blif, such as:
.model circuit
.inputs a b
.outputs c
.names a b c
11 1
.end
Now I'd like to simulate it with yosys, and I'd like to specify ...
0
votes
1
answer
69
views
How to simplify circuits
The answer to the question is A in case someone thinks Im cheating for a test or something. I really wan't to understand how to solve such questions. I am guessing there is some way to bring these ...
1
vote
1
answer
758
views
How do you use both curved and straight voltages in LaTeX with circuitikz package? [closed]
Currently I am using:
\usepackage[european,straightvoltages]{circuitikz}
and in the body I have only:
\begin{circuitikz}
\draw
(0,0) to[R = $R_6$, v = $U_{R6}$] (1.5,0)
to[R = $R_6$,...
0
votes
0
answers
923
views
Logic gates: Why is the sum of 1 and 1 in an OR gate 1?
According to arithmetics of binary numbers, the sum would be 2 a decimal 2. This is 10 in binary. so the sum would be 0 and the carry 1. But the carry is not represented in, right?
1
vote
2
answers
155
views
Why is the red light not lighting up?
So I am very new to this IoT stuff and what I am trying to create here is somewhat like traffic violation detection.
My idea is: when the red light is on and if the PIR sensor detects movement, the ...
0
votes
1
answer
180
views
Can you create an inverting function using only 2-input AND ports?
If yes, show how it can be done. If not, explain why not
Wondering if it can be done or not, and the reason why it does/doesn't work/can be done.
0
votes
2
answers
50
views
Is there a way to write a LabView VI to do slow conversion on DIO lines?
I am not looking for an answer/solution to this problem, rather I am so so lost and just need help figuring out a starting point. Are there any controls or functions in the pallet that definitely need ...