Animation in Crimson 3

ais

Member
Join Date
Apr 2012
Location
Bangkok
Posts
59
I have been able to use the image primitive with 2 fan images and animate the fans using DispCount.
However, I had to use 2 image primitives, one for the fan images and one for the complex code. If I put the complex code in the same primitive as the fan images, I don't get any animation.
Where am I going wrong?

The next step is to implement is to use 3 images as follows :
2 x green fans (offset) and 1 x red fan.
A status tag with options 0, 1, 2.
Status 0 = stopped, green fan is shown stationary.
Status 1 = running, green fans are rotating.
Status 2 = fault, red fan is shown stationary.

What would be the best way to do this?
Thanks for any help.
 
Thanks Bullzi.
Using your code as an example I was able to progress.
However, DispCount gives me a flashing image and not rotating.
FWIW I am testing using the emulator with buttons to set tag values.
 
After some experimenting, I figured out where I went wrong.
I can now get a single colour fan say (green) to rotate.

Next step...
It seems when using DispCount, the first image is always used - so if my first image is green, then I can have a green rotating fan.

Now for example if I have an auto-man selector. In auto I want the rotating fan to be green, in manual I want the rotating fan to be blue.

Any help would be appreciated.
 
After some experimenting, I figured out where I went wrong.
I can now get a single colour fan say (green) to rotate.

Next step...
It seems when using DispCount, the first image is always used - so if my first image is green, then I can have a green rotating fan.

Now for example if I have an auto-man selector. In auto I want the rotating fan to be green, in manual I want the rotating fan to be blue.

Any help would be appreciated.

This is simply a matter of programming. Spend a little time thinking about the various images and what value determines which one is shown.

Once you fully understand this, you should be able to write a program that returns the appropriate value to achieve your desired result.

I could tell you how to do it, but if you take the help you have received from others and spend some time thinking about it, you will be much better off for future applications.
 
@JHarbin
I already fully understand how to return any particular image.
My actual project has nine images.
I have programmed to return the colour I want.
The problem is that for rotation it always uses image 0 in conjunction with the image I return.

So if I want green rotation, all I have to do is make sure image 0 is green. If my second offset green image is 5, I can get rotation with 0 and 5.

But if my first blue image is 3 and the second offset blue image is 4, when I return 4 and use DispCount, it uses image 0. I need to know how to use image 3 anf 4 for rotation.

The obvious workaround is to superimpose 2 animated images and and program the visibility, but I am looking for a cleaner solution.

There is nothing in the manual to help.

If someone else is prepared to help, thanks in advance.
 
@JHarbin
I already fully understand how to return any particular image.
My actual project has nine images.
I have programmed to return the colour I want.
The problem is that for rotation it always uses image 0 in conjunction with the image I return.

So if I want green rotation, all I have to do is make sure image 0 is green. If my second offset green image is 5, I can get rotation with 0 and 5.

But if my first blue image is 3 and the second offset blue image is 4, when I return 4 and use DispCount, it uses image 0. I need to know how to use image 3 anf 4 for rotation.

The obvious workaround is to superimpose 2 animated images and and program the visibility, but I am looking for a cleaner solution.

There is nothing in the manual to help.

If someone else is prepared to help, thanks in advance.

You're not using DispCount correctly.

Here's a hint.

If you can make the program return 3 when you want to show the blue fan, just take the value that is returned and add DispCount.0 to it. That way it will always return 3, but every other DispCount update it will add 1 to it and display the image assigned to the value 4. This is because DispCount.0 is 0 one update and 1 the next update.

You can also do this in the Program, but this is a simple solution.

Honestly, based on all the other help I have given you over the last few months, I would have thought you could figure this out on your own.

EDIT - the previous line is not meant to be snarky, but I admit it could be taken that way. I just know that if a person is given hints and then works it out on their own, he will become a better programmer. If he is given all the answers, he doesn't. The old "Give a man a fish, teach a man to fish" adage.
 
Last edited:
hmmm.... this sounds like be mean to ais day :( - not sure what I did to deserve it.

Actually I am pretty good at figuring things out, especially if I have literature on it.

I know I am using DispCount incorrectly - I am trying to find the instruction set for how to use it, hence my request for help.

If u think I am trying to take the easy/lazy way out, u are way off base. I have been hunting for 3 days for the instruction set for DispCount without success.

If someone can point to some literature on the use of DispCount other than the reference manual, I would appreciate it.
 
hmmm.... this sounds like be mean to ais day :( - not sure what I did to deserve it.

Actually I am pretty good at figuring things out, especially if I have literature on it.

I know I am using DispCount incorrectly - I am trying to find the instruction set for how to use it, hence my request for help.

If u think I am trying to take the easy/lazy way out, u are way off base. I have been hunting for 3 days for the instruction set for DispCount without success.

If someone can point to some literature on the use of DispCount other than the reference manual, I would appreciate it.

DispCount is simply a system variable that returns the number of updates since the last display reset. This is in the manual - mine is on page 262.

We use a bit selection from that system variable (hence DispCount.0) for a value that toggles from 0 to 1 rapidly. If it toggles too rapidly, use DispCount.1 or DispCount.2 These bits will be 0 or 1 at a slower rate - based on how quickly they change.

As a system variable, the only way to know how to use it (especially in your application) is to think about how you might use it to accomplish your purposes. I'm not sure how much more info you need.

I thought I had helped you with this before - If I haven't I am sorry for my poor memory.
 
hmmm.... this sounds like be mean to ais day :( - not sure what I did to deserve it.

Actually I am pretty good at figuring things out, especially if I have literature on it.

I know I am using DispCount incorrectly - I am trying to find the instruction set for how to use it, hence my request for help.

If u think I am trying to take the easy/lazy way out, u are way off base. I have been hunting for 3 days for the instruction set for DispCount without success.

If someone can point to some literature on the use of DispCount other than the reference manual, I would appreciate it.

Put a Data Primitive on the screen and make DispCount the source. Then you will see what it does. Increment is *all* it does. There is no instruction set for a system variable.
 
I don't recall ever having used DispCount until now.
Per post number 6 above, if image 0 is green and if image 4 is green (offset), I can simulate rotation with the following code for my auto mode :
if (FanC.AvailStat&&FanC.AutoStat&&FanC.RunStat&&DispCount.0) return 4;

The display will toggle between image 0 and image 4.

My blue fan is image 6 and the offset blue fan is image 7 and I have the following code for manual mode :

if (FanC.AvailStat&&!FanC.AutoStat&&FanC.RunStat&&DispCount.0) return 6;

This causes the display to toggle between image 0 and image 6.

Per your earlier post how do I "add DispCount.0" to the returned image 6 sothat it toggles between image 6 and 7.

I tried :
if (FanC.AvailStat&&!FanC.AutoStat&&FanC.RunStat) return 6&&DispCount.0;

But it did not work.

Maybe DispCount won't work for what I am trying to do...?

FWIW I have 3 test configurations and one of them does have the DispCount displayed in a primitive, so I know it is effectively counting.
 
I don't recall ever having used DispCount until now.
Per post number 6 above, if image 0 is green and if image 4 is green (offset), I can simulate rotation with the following code for my auto mode :
if (FanC.AvailStat&&FanC.AutoStat&&FanC.RunStat&&DispCount.0) return 4;

The display will toggle between image 0 and image 4.

My blue fan is image 6 and the offset blue fan is image 7 and I have the following code for manual mode :

if (FanC.AvailStat&&!FanC.AutoStat&&FanC.RunStat&&DispCount.0) return 6;

This causes the display to toggle between image 0 and image 6.

Per your earlier post how do I "add DispCount.0" to the returned image 6 sothat it toggles between image 6 and 7.

I tried :
if (FanC.AvailStat&&!FanC.AutoStat&&FanC.RunStat) return 6&&DispCount.0;

But it did not work.

Maybe DispCount won't work for what I am trying to do...?

FWIW I have 3 test configurations and one of them does have the DispCount displayed in a primitive, so I know it is effectively counting.

First, the easiest solution is to rearrange your images so that the two fan images in each color are next to each other. In other words, 1 = Green1 and 2 = Green2, 3 = Blue1 and 4 = Blue2, etc. Let 0 be your default

Create a Program - not complex logic - and call it something like FanColor() and make it return an integer.

In FanColor(), create logic that will return 0 if you just want to display the default fan.

Return 1 if you want to display the green fan.

Return 3 if you want to display the blue fan.

Etc.

In the Image Select of the image primitive set the source as =FanColor() + DispCount.0

The Image select will change from the (Returned value + 0) and the (Returned Value + 1).

There are other ways to do this, but this is the easiest.
 
ok thanks.
I was doing this as complex code with if and else statements.
I will switch to using a function.

Actually all I needed to do was to change "&&DispCount" to "+DispCount"
Now it works the way I want it to in complex code.
 
Last edited:
ok thanks.
I was doing this as complex code with if and else statements.
I will switch to using a function.

You could do it with complex code and just add the DispCount.0 to the return value before you return it, but I think my way is simpler and easier to understand.

The "&&" functions you were using were not actually returning what you thought they should.

At least in one place you were using && when you should have been using + (where you had return 6&&DispCount.0)

"&&" is a relational function, not an arithmetic function. It is a Logical AND, which means return a 1 (True) when both sides of the "&&" are true.

Search for && in the Crimson 3 User Manual for an explanation.
 
ok thanks.
I was doing this as complex code with if and else statements.
I will switch to using a function.

Actually all I needed to do was to change "&&DispCount" to "+DispCount"
Now it works the way I want it to in complex code.

Our posts crossed in the Ether...

Please read my previous post.
 

Similar Topics

Hello all I would like a goto display button to blink/flash red in the state of an active alarm. I cant find anything in the program or the...
Replies
4
Views
2,407
I've got a few images I want to play together in series to make an animation. I've got the frames already setup as in a single image object, but...
Replies
4
Views
2,990
From what I read, one is able to add animation behaviour to primitives. When I select a symbol, there is no option to add behaviour. However, I...
Replies
1
Views
2,632
I am using Crimson 3 and I am still learning how to use it. I have used the primitives when I needed to make a button, panel, etc flash in...
Replies
11
Views
6,902
Back
Top Bottom