I'm trying to make a program to power a dc motor for 2 seconds when a 1 is inputted. I already have a circuit designed with an LED and a capacitor for the motors protection, but i can't figure out a way to make this VHDL script.
if i try to use a "wait" statement or something, it conflicts with my "if" statements. This is for a cyclone IV FPGA
The "wait" statement is not synthesizable.
This means, you will not be able to run it on any board. It is more like a "helping" tool for modelling - e.g. when you need to model the real time delays of flipflops or make a testbench.
The easiest way to create a time delay on your board is to create a counter, that counts up to a given value and changes signal/output when value reached.
I've spent many hours and and a ton of paper sketching and I haven't been able to stumble upon anything to get me past this problem.
I can't figure out how to solve this task using PLC ladder language. PLC programme must compute actual flow of water. The gate is moving and the time of gate is set to 5 minutes. In this gate the impulses are counted (with wage for example - wage of 1 m^3). The overall time (the space where the gate can move) is set to 1 hour.
Gate time: for example 5 minutes Overall time: 1 hour Impulse is triggered by me.
Example if we trigger the I1 input - 3 times (one input have wage 1 m^3) in a gate of 5 minutes (5 minutes is 1/12 hour) so 3 * 1m^3 divided by (1/12)h = 36 m^3 / h It gave us actual water flow. I can only use TON timer and I've got 2 binary inputs.
Do you have any idea how to start this?
It's a logger I tried to base on, but now I don't know what to do next.
#include "MT-101.h"
IF FS1_fs MOVE 0, REG2
IF FS1_fs MOVE RTC_Sec, REG2
NE RTC_Sec, REG2, Q1
IF NOT Q1 EXT
MOVE RTC_Sec, REG2
IF NOT I1 EXT
TCPY XREG1, 511, XREG2
MOVE AN1, XREG1
I am implementing an experiment in Psychopy in which I am designing a same-different discrimination task comparing two sounds that are of variable duration (sound_1, sound_2) played in succession with an interval of 0.5 s in between. Now I have managed to start sound_1 at 0.0 and sound_2 at 0.5 s after the end of sound_1 using "$sound_1.getDuration() + 0.5"; however, I want to get a key press response with the RT measured from the end of sound_2 on; I tried start time "$sound_1.getDuration() + 0.5 + sound_2.getDuration()", however the keypress is already functional during the presentation of sound_2 and RTs appear to be too long as compared with usual RTs observed for this kind of task. Does anyone know how to obtain the accurate onset for measuring RTs here?
Btw my question is similar, however not fully answered by the following thread:
variable stimuli duration but two kinds of fixed ISI in PsychoPy
I'm trying to create code in AppleScript that will click my mouse randomly every 1-2 seconds... I want a video game I'm playing to not know or be able to tell that a robot is clicking for me so I need it to be RANDOM... not every second or every 2 seconds but every x seconds where x is a constantly changing variable in-between 1 and 2 seconds... Here is the code so far but it clicks every 1 second:
on idle
tell application "System Events"
key code 87
end tell
return 1
end idle
I thought changing the return 1 to return random number 1 to 2 would work
Something like this:
on idle
tell application "System Events"
key code 87
end tell
set randomDelay to random number from 1 to 2
return randomDelay
end idle
but it didn't work /:
Make it into
random number from 1.0 to 2.0
If you give integers as the bounds for the random numbers, it will just select random integers. By giving floating point literals, AppleScript switches to giving a random floating point number in the range. From the documentation of random number in the StandardAdditions, it seems that the limits are both inclusive, which is strange for floats but isn't a problem in your case.
I've done my program ages ago here as a uni project, at least it works to some extent (you may try the Monkey and Novice level:) ).
I'd like to redesign and re-implement it, so to practice on data structure and algorithm.
In my previous project, min-max search and alpha-beta pruning was the missing part, as well as a lack of opening dictionary.
Because the game board is symmetric both horizontally and vertically, I need a better data structure than my previous approach:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
-1 11 12 13 14 15 16 17 18 -1
-1 21 22 23 24 25 26 27 28 -1
-1 31 32 33 34 35 36 37 38 -1
. . . . . .
In this way, one can easily calculate the adjacent positions given any cell value like this:
x-11 x-10 x-9
x-1 x x+1
x+9 x+10 x+11
Those -1s are acting like "walls" to prevent wrong calculation.
The biggest issue is it doesn't take any consideration of symmetric/orientation, i.e., same opening like parallel opening would have 4 corresponding opening cases in database, one for each orientation.
Any good suggestion? I am also considering to try ruby as to have a quicker calculation speed than PHP (just for min-max alpha-beta pruning, in case I will program it to look n steps ahead).
Many thanks for the suggestions in advance.
When you hash a position to store or lookup in your database, takes hashes of all eight symmetric positions, and store or lookup only the smallest of the eight. Thus all symmetric positions hash to the same value.
This reduces the size of your database by 8 but multiplies the cost of hashing by 8. Is this a good trade-off? It depends on how big your database is and how often you do database lookups.
After you move to C/C++ :-) consider representing the game board as "bit-boards" e.g. two 64-bit-vectors e.g. for white and black e.g. struct Board { unsigned long white, black };
With care you can then avoid array indexing to test piece positions, and in fact can search in parallel for all up-captures, up-right-captures, etc. from a position using a series of bit logical operators, shifts, and masks, and no loops (!). Much faster.
This representation idea is orthogonal to your questino of opening book symmetries though.
Happy hacking.
The problem is easy to deal with if you seperate the presentation of the board from the internal representation. Once the opening move is made, you get parallel, diagional, or perpendicular opening. Each one of them can be in any of the 4 orientations. Rotate the internal board representation, until it is aligned with your opening book. Then simply take the rotation into account when drawing the board.
In regard to play, you need to look into Mobility Theory. Take a look at Hugo Calendars book on the topic. Also Nick Buro has written a bit about his program Logistello. A FAQ
As that parallel opening only applies for the very first move, I would just make the first move fixed.
If you really want speed, I'd recommend C++.
I would also imagine checking the space is on the board is faster than checking if the space contains a -1.