Hi all
I want create a new screen on the teach pendant with karel language
Is there someone that have examples?
Thanks all
Hi all
I want create a new screen on the teach pendant with karel language
Is there someone that have examples?
Thanks all
You have examples in Karel Reference Manual.
Thank you.
I see the example but if i copy it doesn't work.
My problem is on the karel program
Have you got another simple example that work please?
Thanks
Can you post your code and error?
Thank you dha
The target example is attached
i have this form :
------------------------------------------------------------
.kl ftstex
.form
$-,form1
&home &reverse "Sample screen" &standard &new_line
" Sample label " &new_line
@3,5" Integer: " @3,28"-%10d(1,32767)" &new_line
@4,5" Real: " @4,28"-%12f" &new_line
@5,5" Program name(TP):" @5,28 "-%12pk(1)" &new_line
@6,5" Program name(PC): " @6,28"-%12pk(2)" &new_line
@7,5" DIN[1] " @7,28"-%7P(io_c)" &new_line
@8,5" DOUT[1] " @8,28"-%7P(io_c)" &new_line
@9,5" Select item" @9,28"-%12w(item_c)" &new_line
^form1_fkey * specifies element which contains
* function key labels
?form1_help * element which contains help
.endform
$-,form1_fkey * function key labels
" F1" &new_line
" F2" &new_line
" F3" &new_line
" F4" &new_line
" HELP"
$-, form1_help * help text
"Help Line 1" &new_line
"Help Line 2" &new_line
"Help Line 3" &new_line
* You can have a maximum of 48 help lines
$-, io_c
" OFF" &new_line
" ON "
$-, item_c
"item 1"
$-
"item 2"
$-
"item 3"
$-
"¥a"
------------------------------------------------------
And this is the karel program
PROGRAM formtest
%INCLUDE klevkmsk
%INCLUDE klevkeys
%INCLUDE ftstex
VAR
l_status:INTEGER
value_array: ARRAY[7] OF STRING[30]
change_array:ARRAY[1] OF BOOLEAN --Allows setting size [1] if not use
inact_array:ARRAY[1] OF BOOLEAN--Allows setting size [1] if not use
test_int:INTEGER
test_real:REAL
prog_name1:STRING[40]
prog_name2:STRING[40]
select_item: INTEGER
def_item :INTEGER
term_mask:INTEGER
term_char:INTEGER
exit_menu:BOOLEAN
device_stat:INTEGER
BEGIN
test_int = 12345
test_real = 12.345
-- There are 7 data to display such as %d in *.ftx
-- Then value_array is ARRAY[7]
value_array[1] = 'test_int' --First data item %10d is test_int of INTEGER
value_array[2] = 'test_real' --Second %12f is test_real of REAL
value_array[3] = 'prog_name1'--Third %12pk is prog_name1 of STRING
value_array[4] = 'prog_name2'--Fourth %12pk is prog_name2 of STRING
value_array[5] = 'DIN[1]' --Fifth %7P is BOOLEAN to show DI[1]
value_array[6] = 'DOUT[1]' --Sixth %7P is BOOLEAN to show DO[1]
value_array[7] = 'select_item' --Seventh %12w is INTEGER
def_item = 1
term_mask = kc_func_key
device_stat=TP_PANEL
--Force to switch USER2 screen
FORCE_SPMENU(device_stat, SPI_TPUSER2, 1)
exit_menu = FALSE
REPEAT
--Display and wait for input keys.
DISCTRL_FORM('ftst', form1, value_array, inact_array, change_array,
term_mask, def_item, term_char, l_status)
IF term_char = KY_NEW_MENU THEN
--Exit loop if requested.
exit_menu = TRUE
else
ENDIF
UNTIL exit_menu
END formtest
I build this file and then i Select the karel program formtest and i execute it with shift+forward keys.
But then the virtual teach pendant lock and roboguide crashed.
I think the problem is on the karel program but i don't know where
Can you give me an help?
Thanks
Try adding DELAY instruction into REPEAT statement.
Hi dha
i tried without reply istruction and i try in the way you suggest me.
Roboguide didn't crash, but tp screen didn't compare.
I attach the screen that compare.
It seems like the program doesn't call the form.
I don't understand
thanks
I'm sorry but I don't see any errors in code and I currently have no time to test it.
For test I would first try to put only plain text to display and then add integers and reals ...
Ok thank you for your interest.
I try but it doesn't work. I don't know karel in depth way so it is difficult to me find the bug on this code.
If somebody else has an idea it is accept
Thanks all
In Karel Reference Manual you will find example for "USING DYNAMIC DISPLAY BUILT-INS".
Maybe this can help you ...
I already read this part but the code seems correct.
Code is also an example of the manual, but doesn't work.
So i don't understand why and i think only a person that know karel in a depth way can help me.
I might be able to help you out. I have done quite a bit of Karel and also done programs with the forms manger ald dictionaries etc.
It looks like the form in those PNG files are displayed
And then the program is aborted and is on line 0, have you debugged it in step mode or added any pause statements to see where it hangs or blows up
Also you can use the KCL console to see the execution history or what is called the call stack
Did you make your form in the form of formname.ftx and theprog in thename of progname.kl
did use KCDICT to make the form and it would create formwhatever.tx and also a formconstants.kl file and you use that in the karel program
then you need to load the form into the controller using the KCL or command file.
then you translate the Karel program after you make the form and get it constants file, if you change or add to the form and the constants file changes you have to rebuild the karel program
then after the karel is loaded run the program if it is not working comment out a lot and add WRTIE TPDISPLAY lines to track it those would be on the TP Menus-9
then once you get it going you cna start uncommenting out lines until you find what is giving you the problem
You can also have an initroutine and force all your vars to have actual values
If that all fails write simple hello world and work your way out , do the forms part last. Good luck