How do I show only an one digit in the 4 digit segment on a Basys2 board? - xilinx

When I used to output an one digit number in the Basys2 board, all the 4 digits glowed. eg:- When I wanted 2, it showed 2222. I want only the right most digit to work.
To achieve this, I made a ground port connected to three out puts through 3 NOT gates on the schematic file. Next I LOC that three outputs to the 3 anodes, AN1, AN2, AN3 of the board in the ucf file.
But, is there any proper way to do this?

You have to implement a time multiplexer.
That takes your four input digits and displays only one at a time by selecting the proper AN* signal. You should multiplex the digits > 100 Hz and < 1 kHz.

Related

How to create a generalized dataset to detect all display digits with Roboflow

I want to detect digits on a display. For doing that I am using a custom 19 classes dataset. The choosen model has been yolov5-X. The resolution is 640x640. Some of the objets are:
0-9 digits
Some text as objects
Total --> 17 classes
I am having problems to detect all the digits when I want to detect 23, 28, 22 for example. If they are very close to each other the model finds problems.
I am using roboflow to create diferent folders in which I add some prepcocessings to have a full control of what I am entering into the model. All are checked and entered in a new folder called TRAIN_BASE. In total I have 3500 images with digits and the majority of variance is with hue and brightness.
Any advice to make the model able to catch all the digits besides being to close from each other?
Here are the steps I follow:
First of all, The use of mosaic dataset was not a good choice the purpose of detecting digits on a display because in a real scenario I was never gonna find pieces of digits. That reason made the model not to recognize some digits if it was not shure.
example of the digits problem concept
Another big improvement was to change the anchor boxes of the yolo model to adapt them to small objects. To know which anchor boxes I needed. Just with adding this argument to train.py is enought in the script provided by ultralitics to print custom anchors and add them to your custom architecture.
To check which augmentations can be good and which not, the next article explains it quite visually.
P.D: Thanks for the fast response to help the comunity gave me.

Comparing values between lines within a group

I'm looking to create a column denoting if a survey respondent has changed locations from Wave 6 to Wave 7. I do not care about previous waves (although they are there in the data).
So the logic I want is: If the email from Wave 6= the email from Wave 7 and location from 6 <> location from 7 then 1. So I'm only concerned about respondents that show up in both waves 6 and 7.
Here is an example of the output that I would want: (I want the 1 to appear both on Wave 6 and Wave 7, denoting the change for both waves).
I'm unsure how to logically write this in SPSS. Any tips would be appreciated. Thanks!
Many ways to do this, so here's one that should work assuming there is only one occurrence of every wave X Email_A combination:
sort cases by Email_A wave.
compute changeLocation=
(Email_A=lag(Email_A) and wave=7 and lag(wave)=6 and location<>lag(location)).
at this point you have the 1 in every relevant row of wave=7. Now to get this to the wave=6 rows there are also a few ways but here's a fun one:
sort cases by Email_A wave (d).
if Email_A=lag(Email_A) and wave=6 and lag(changeLocation)=1 changeLocation=1.

Math and physic in programing [duplicate]

This question already has answers here:
Is floating point math broken?
(31 answers)
Closed 6 years ago.
I have one simple question..
I have this code:
program wtf;
var i:integer;
begin
for i:=1 to 20 do
if sqrt(i)*sqrt(i)<>i then writeln(i);
readln
end.
...
it goes through the loop 20 times and for numbers from 1 to 20 and it checks if square root multiplied buy square root of same number is equal to that number.
If we use mathematical rules this program should never have anything on output but ....
I get this :
2
3
5
6
7
8
10
12
13
15
18
19
20
can sombody explain what is going on?
This is because of precision. The square root of a number that is not a perfect square will give an irrational number, which cannot be represented in memory properly using floating-point arithmetic.
Instead, the number gets truncated after some digits (in binary, but the concept is the same as in decimal).
The number is now very close to, but not quite, the square root of the original number. Squaring it will produce a number that is very close to the original, but not quite.
Imagine it like this, the square root of 2 is 1.4142135623........(etc.) but it gets cut off to 1.414213 for memory reasons. 1.414213 * 1.414213 = 1.99999840937 and not 2.
However, the square root of 4 is 2, and this can be stored in memory fully, without being cut off after a few decimal places. When you then do 2 * 2 you do get exactly 4.
Sometimes the number might get cut off, but when squaring it is still close enough to produce the original value. This is why 11 does not show.
sqrt generates floating point numbers. When using floats, on a computer, you cannot compare values and expect absolute equality. You must use a threshold difference comparison. floats are not used to count things, they are used to measure things, (to count things, use integers),. No two measured (even in the real world) values are ever exactly the same. they are only "close enough".
On a computer, it is impossible to represent every possible real number. SO every calculated value gets represented by the "closest" number in the set of possible numbers, (for that data type), that can be represented on the computer. This means that it is very slightly incorrect, and therefore after a few calculations, it will not conform to perfect equality comparisons.

NetLogo Histogram - Distribution of visits

I've a simple problem.
In my code there are some patches that contain food. I computed the # of visits for each one of these "resources". Now I want to put in a histogram the # of visits for each one of these "resource-patches" .
If I write in the GUI:
histogram [visits] of resource-patches
It plots me something strange.
This is because, usually, you put the "x" values in the brackets [ ] of the patches-own attribute. Instead, I want that
-in the "x-axis" there are the labels (for example) of the resource-patches (or their amount of food) whereas
-in "y-axis" I want the #of visits for each one of the resource-patches.
I'm struggling since yesterday but I can't find a solution.
Thank you in advance guys!
A histogram only takes in the values for the x-axis. The y-axis will always be the number of occurrences of x in the list provided. For you, it'll plot the frequency of each of yours visits.
If your visits list is [1 1 3 5 2 3 4 5]
You'll see a histogram of
x, y
1->2
2->1
3->1
4->1
5->2
I think you may want to look at another plotting tool if this is not what you want.

Compare means between groups SPSS

I have this problem.
I have an SPSS sheet that looks like this (it's an analogy, so don't ask me how I have measured it). This example is about tennis players.
Player % of points won % of points won
own service opponent's service
1 50 10
2 80 60
3 70 40
4 80 50
Now I want to know if there's a difference between your own service, and the opponent's service, in terms of points won. (As you see, there probably is. But is it significant?)
Link naar boxplot
So Hypothesis: Own service -+-> points won
Now, Kruskal-Wallis, Independent-samples t test, One Way ANOVA, all require a grouping variable or something, but this is already implied. I could have chosen to make the data set:
Player Own service Won
1 1 0
2 1 1
3 0 1
For all games, group them on own service and see if there is a statistical difference between these groups. Perfectly doable.
The first set of data contains the same information, but presented differently. I just want to compare means between variables, only based on their own value. Can SPSS handle this type of information as well?
If the two variables are inter-related like points in a tennis match (per your example), and organized in different columns like that, a paired-samples t-test should work for you.

Resources