Tried to print ticks divided by 1000 yet get a line of zero's ?. What is wrong with the below ?. Also what is the command to print at a particular location on the screen ?.
EXPORT TEST()
BEGIN
LOCAL TIC;
PRINT();
REPEAT
TIC=TICKS();
TIC=TIC/1000;
PRINT(TIC);
UNTIL GETKEY >-1;
END;
(05-18-2015 10:39 PM)Digitaldreams Wrote: [ -> ]Tried to print ticks divided by 1000 yet get a line of zero's ?. What is wrong with the below ?. Also what is the command to print at a particular location on the screen ?.
EXPORT TEST()
BEGIN
LOCAL TIC;
PRINT();
REPEAT
TIC=TICKS();
TIC=TIC/1000;
PRINT(TIC);
UNTIL GETKEY >-1;
END;
I'm not sure why TIC=TICKS() produces a zero result. However, the following will get what I think you want:
EXPORT TEST()
BEGIN
PRINT();
REPEAT
PRINT(TICKS/1000);
UNTIL GETKEY >-1;
END;
Eddie
(05-18-2015 10:39 PM)Digitaldreams Wrote: [ -> ]Tried to print ticks divided by 1000 yet get a line of zero's ?. What is wrong with the below ?. Also what is the command to print at a particular location on the screen ?.
You got a line of zero's because you used "TIC=" instead of "TIC:=".
PRINT is printing to the terminal with each PRINT being on a different line, so if you want to print to a particular location on the screen you should use TEXTOUT_P instead of PRINT:
Code:
EXPORT TEST()
BEGIN
LOCAL TIC;
RECT();
REPEAT
TIC:=TICKS()/1000;
TEXTOUT_P(STRING(TIC),0,0,0,0,100,#FFFFFF);
UNTIL GETKEY>-1;
END;
(05-19-2015 02:46 AM)Eddie W. Shore Wrote: [ -> ] (05-18-2015 10:39 PM)Digitaldreams Wrote: [ -> ]Tried to print ticks divided by 1000 yet get a line of zero's ?. What is wrong with the below ?. Also what is the command to print at a particular location on the screen ?.
EXPORT TEST()
BEGIN
LOCAL TIC;
PRINT();
REPEAT
TIC=TICKS();
TIC=TIC/1000;
PRINT(TIC);
UNTIL GETKEY >-1;
END;
I'm not sure why TIC=TICKS() produces a zero result. However, the following will get what I think you want:
EXPORT TEST()
BEGIN
PRINT();
REPEAT
PRINT(TICKS/1000);
UNTIL GETKEY >-1;
END;
Eddie
Thanks Eddie...believe it or not that was my first attempt and it didn't work, now it does !?. Maybe the recent firmware update did the trick....
Regards
(05-19-2015 03:22 AM)Didier Lachieze Wrote: [ -> ][quote='Digitaldreams' pid='35504' dateline='1431988787']
Tried to print ticks divided by 1000 yet get a line of zero's ?. What is wrong with the below ?. Also what is the command to print at a particular location on the screen ?.
You got a line of zero's because you used "TIC=" instead of "TIC:=".
PRINT is printing to the terminal with each PRINT being on a different line, so if you want to print to a particular location on the screen you should use TEXTOUT_P instead of PRINT:
[code]EXPORT TEST()
BEGIN
LOCAL TIC;
RECT();
REPEAT
TIC:=TICKS()/1000;
TEXTOUT_P(STRING(TIC),0,0,0,0,100,#FFFFFF);
UNTIL GETKEY>-1 ;
END;[/code ]
[/quote ]
Thanks Didier......I shortened it too by removing TIC altogether. What is the function of ':' after a variable ??
Regards
(05-19-2015 06:18 AM)Digitaldreams Wrote: [ -> ]What is the function of ':' after a variable ??
With "TIC=TICKS()" you get the result of the test "TIC equal TICKS()" which in your case in false (zero).
With "TIC:=TICKS()" you assign the value of TICKS() to the the variable TIC, it's the same as with the Sto command "TICKS()▶TIC" where you store the value to TICKS() into the TIC variable.
So in your original program you were comparing TIC to TICKS(), then TIC to TIC/1000 but never assigning a value to TIC, so the default value (zero) assigned to TIC at its creation by the "LOCAL TIC;" statement was printed.
(05-19-2015 06:36 AM)Didier Lachieze Wrote: [ -> ] (05-19-2015 06:18 AM)Digitaldreams Wrote: [ -> ]What is the function of ':' after a variable ??
With "TIC=TICKS()" you get the result of the test "TIC equal TICKS()" which in your case in false (zero).
With "TIC:=TICKS()" you assign the value of TICKS() to the the variable TIC, it's the same as with the Sto command "TICKS()▶TIC" where you store the value to TICKS() into the TIC variable.
So in your original program you were comparing TIC to TICKS(), then TIC to TIC/1000 but never assigning a value to TIC, so the default value (zero) assigned to TIC at its creation by the "LOCAL TIC;" statement was printed.
Thanks again Didier !....I'm sure with other devices I've used, if you want to comparison test you would enter '==' !, no wonder It confused me
Regards