View Full Version : Need Help
Michael
30-03-2005, 07:54 PM
I am new at this! Am trying to send a pulse command at two different values of throttle JS1.A3. The first pulse should be sent when A3 is decreasing [(throttle moved forward) passing through point one (34) at point two (29)] and the second pulse is sent when A3 is increasing [throttle is retarded crossing point two (29) at point one ]. Are there any other good resources available in addition to the Forum and the CM Programming Section? Regards!
Here is is:
cms.b10 = d4;
IF ( [js1.a3 < 34] ) THEN
IF ( [js1.a3 < = 29] ) THEN
PULSE ( d4 );
ENDIF
ENDIF
IF ( [js1.a3 > 29] ) THEN
IF ( [js1.a3 > = 34] ) THEN
PULSE ( d4 );
ENDIF
ENDIF
Bob Church
30-03-2005, 10:33 PM
Hi Michael,
>>
IF ( [js1.a3 < 34] ) THEN
IF ( [js1.a3 < = 29] ) THEN
PULSE ( d4 );
ENDIF
ENDIF
IF ( [js1.a3 > 29] ) THEN
IF ( [js1.a3 > = 34] ) THEN
PULSE ( d4 );
ENDIF
ENDIF
<<
I think you've got the comparisons a little out of line. The way they're written, they boil down to "js1.a3 < 28" and "js1.a3 > 33". Also, you usuall shouldn't use PULSE in the IF/THEN block since the IF will disable it unless the IF is TRUE. Also, you can't use the same timer bit (D4 in this case) more than once. Finally, you should use the PULSE for this. It's on for one logical scan, not one character scan, and so can easily be missed outside of the script. Use the PERIOD timer instead, it's clocked in character times. Finally, you're trying to assign a bit variable (d4) to and analog variable (cms.a10). It has to go to a bit variable, I'm guessing you meant cms.b10.
I'd try something like this:
timer( PERIOD, d4, 1 ) = [ js1.a3 > 33 ];
timer( PERIOD, d5, 1 ) = [ js1.a3 < 30 ];
cms.b10 = d4 OR d5;
which should implement a 1-character time pulse on cms.a10 when the lever goes through 33 going up or through 30 coming down.
If you're just going to send a character with cms.a10, though, it can be more easily accomplished just passing the bit up to the GUI and programming the character there.
cms.b10 = [ js1.a3 < 30 ] OR [ js1.a3 > 33 ];
Then progam cms.a10 up in the GUI to send the character an a NULL like "a NULL" and it should just send one character when you hit 34 going up or 29 coming down. The cms.b10 axis will remain on, but the NULL will force a single character so that won't matter.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Michael
31-03-2005, 09:36 AM
Originally posted by Bob Church@Mar 30 2005, 09:33 PM
Hi Michael,
>>
IF ( [js1.a3 < 34] ) THEN
IF ( [js1.a3 < = 29] ) THEN
PULSE ( d4 );
ENDIF
ENDIF
IF ( [js1.a3 > 29] ) THEN
IF ( [js1.a3 > = 34] ) THEN
PULSE ( d4 );
ENDIF
ENDIF
<<
I think you've got the comparisons a little out of line. The way they're written, they boil down to "js1.a3 < 28" and "js1.a3 > 33". Also, you usuall shouldn't use PULSE in the IF/THEN block since the IF will disable it unless the IF is TRUE. Also, you can't use the same timer bit (D4 in this case) more than once. Finally, you should use the PULSE for this. It's on for one logical scan, not one character scan, and so can easily be missed outside of the script. Use the PERIOD timer instead, it's clocked in character times. Finally, you're trying to assign a bit variable (d4) to and analog variable (cms.a10). It has to go to a bit variable, I'm guessing you meant cms.b10.
I'd try something like this:
timer( PERIOD, d4, 1 ) = [ js1.a3 > 33 ];
timer( PERIOD, d5, 1 ) = [ js1.a3 < 30 ];
cms.b10 = d4 OR d5;
which should implement a 1-character time pulse on cms.a10 when the lever goes through 33 going up or through 30 coming down.
If you're just going to send a character with cms.a10, though, it can be more easily accomplished just passing the bit up to the GUI and programming the character there.
cms.b10 = [ js1.a3 < 30 ] OR [ js1.a3 > 33 ];
Then progam cms.a10 up in the GUI to send the character an a NULL like "a NULL" and it should just send one character when you hit 34 going up or 29 coming down. The cms.b10 axis will remain on, but the NULL will force a single character so that won't matter.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
<div align="right">11803
[/quote]
Thank you very much for you help., Bob. I learned several very important points from your reply. Will try not to make these mistakes again.
vBulletin® v3.7.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.