If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Display Problem
10 posts
• Page 1 of 1
Display Problem
Hello Gang,
Well I have a new problem. I am creating a schematic with many divided square waves in it. I need to see these in my test circuit, but as I add more scopes and square waves the scope displays all the same square wave as the previous and not the divided wave forms.
I have attached an example. Press the switch/button and you will notice the upper display changes. This is not good. I need to see the divides from each flip flop on the scope.
Like I said this is ONLY an example. My true schematic has many, many more divisions and as I add more and more scopes to view them they all change like in the example.
Can anyone fix this. Please, please.
Many thanks in advance!
Later then, BobF.....
- BobF
- Posts: 598
- Joined: Mon Apr 20, 2015 9:54 pm
Re: Display Problem
In one of your code modules (0 and 1 only) you where writing to an input variable. That was causing the memory glitch. I changed it from:
to:
BTW: I have no idea what you want to achieve with that code, but it doesn't make any sense to me. It's basically the same as: out = tmp & 1;
- Code: Select all
streamin in;
streamout out;
//float in;
in = in + 0.25;
out = (in <= 0)&(in & 0)|(in >= 1) & (in & 1);
to:
- Code: Select all
streamin in;
streamout out;
float tmp;
tmp = in + 0.25;
out = (tmp <= 0)&(tmp & 0)|(tmp >= 1) & (tmp & 1);
BTW: I have no idea what you want to achieve with that code, but it doesn't make any sense to me. It's basically the same as: out = tmp & 1;
- Attachments
-
- Bobs Display Problem (MyCo).fsm
- (325.19 KiB) Downloaded 779 times
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: Display Problem
Hello MyCo,
Many thanks! I should have asked you a long time ago. I use this in several modules. When I did it, it seemed to work so I thought nothing more about it until now. What I am trying to achieve is, any stream that comes in (sine, triangle, square, etc), comes out a square wave that swings from 0 to +1 ONLY and NOT from -1 to +1. The flip flop and several other logic gates I built , would never work without it. Not knowing any programming really screws me sometimes.
If there is still yet a better way, please, please, let me know.
Again thank you so much. This helps me out greatly!
Later then, BobF.....
Many thanks! I should have asked you a long time ago. I use this in several modules. When I did it, it seemed to work so I thought nothing more about it until now. What I am trying to achieve is, any stream that comes in (sine, triangle, square, etc), comes out a square wave that swings from 0 to +1 ONLY and NOT from -1 to +1. The flip flop and several other logic gates I built , would never work without it. Not knowing any programming really screws me sometimes.
If there is still yet a better way, please, please, let me know.
Again thank you so much. This helps me out greatly!
Later then, BobF.....
- BobF
- Posts: 598
- Joined: Mon Apr 20, 2015 9:54 pm
Re: Display Problem
I guess that is what you want:
- Code: Select all
streamin in;
streamout out;
out = (in > 0) & 1;
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: Display Problem
Hi MyCo,
So, so easy. Boy do I feel dumb! Again, much thanks.
Take care, BobF.....
So, so easy. Boy do I feel dumb! Again, much thanks.
Take care, BobF.....
- BobF
- Posts: 598
- Joined: Mon Apr 20, 2015 9:54 pm
Re: Display Problem
MyCo wrote:
- Code: Select all
streamin in;
streamout out;
out = (in > 0) & 1;
@MyCo
One Question regarding the programming technique. I see just one condition: "if in greater than zero then set out to 1".
Does DSP code automatically set out to 0 if the condition is not true, or does it just send the current state of out, even if it is undefined? But in that last case, wouldn't out then have the last state (for example a to 1 corrected value)?
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Display Problem
The comparison (in > 0) returns either:
Bitmask 0000000000... - for false
Bitmask 1111111111... - for true
The bitmasks also have float values:
Bitmask 0000000000... = 0
Bitmask 1111111111... = NaN (not a number)
When you & (binary and) the bitmasks with any arbitrary number you get:
Bitmask 0000000000... & x = Bitmask 0000000000... (Float = 0)
Bitmask 1111111111... & x = Bitmask of x (Float value = x)
Basically it's just plain and simple binary logic
Bitmask 0000000000... - for false
Bitmask 1111111111... - for true
The bitmasks also have float values:
Bitmask 0000000000... = 0
Bitmask 1111111111... = NaN (not a number)
When you & (binary and) the bitmasks with any arbitrary number you get:
Bitmask 0000000000... & x = Bitmask 0000000000... (Float = 0)
Bitmask 1111111111... & x = Bitmask of x (Float value = x)
Basically it's just plain and simple binary logic
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: Display Problem
Ah, finally!
Now I see how it actually works. I was still too much into standard branching, instead of binary logic. Now it makes sense to me. And for human logic this basically means, that with a condition set, out will always be set to a value, either x or the defined one from the condition. With that in mind I start to understand the larger bitmask chains that some people realized.
Say I want to set everything that's greater than 0.5 to 1, else 0.5, but only if it is also greater than -0.5:
in = -1 => out = 0
in = -0.2 => out = 0.5
in = 0.3 => out = 0.5
in = 0.6 => out = 1
etc.
Would this be correct?
Now I see how it actually works. I was still too much into standard branching, instead of binary logic. Now it makes sense to me. And for human logic this basically means, that with a condition set, out will always be set to a value, either x or the defined one from the condition. With that in mind I start to understand the larger bitmask chains that some people realized.
Say I want to set everything that's greater than 0.5 to 1, else 0.5, but only if it is also greater than -0.5:
in = -1 => out = 0
in = -0.2 => out = 0.5
in = 0.3 => out = 0.5
in = 0.6 => out = 1
etc.
Would this be correct?
- Code: Select all
out = (in>-0.5) & (((in>0.5) & 0.5) + 0.5)
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Display Problem
Yep, that's correct. I think this would do the same:
- Code: Select all
out = (in>-0.5) & 0.5 + (in>0.5) & 0.5
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: Display Problem
Thanks, MyCo!
Another hurdle taken that brings me closer to actually create meaningful dsp code. Couldn't wish for any better teacher regarding programming aspects!
For the other hurdles, like filter design and theory, I'm already learning from the best. Since I worked with him on the SSE-supporting Shared Mem Wavetable Oscillator, Martin is kind of a godfather of dsp for me...
Another hurdle taken that brings me closer to actually create meaningful dsp code. Couldn't wish for any better teacher regarding programming aspects!
For the other hurdles, like filter design and theory, I'm already learning from the best. Since I worked with him on the SSE-supporting Shared Mem Wavetable Oscillator, Martin is kind of a godfather of dsp for me...
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 55 guests