Hx0Readme.txt Hx0Readme --------- The Hextor programs Hxtr0-0.BSx to Hxtr7-0.BSx now contain everything that was in Hextor_21.BSx and more. Although the programs are extensively commented so that the general workings can be followed it can be difficult to obtain an overview. This file attempts to remedy that situation. It should be read in conjunction with the comments in the program files themselves. It is presumed that you have already worked through Hextor_0.BSx to Hextor_21.BSx and are familiar with writing Activity-sequences and Rule-sets for Behaviour control using the ultrasonic-sensor. In the main it will not be necessary to alter the program code except to add more DATA statements in programs 1 and 2, and to add menu items in program 0. This will be explained later. Program0 presents a two level menu of options on the LCD and allows you to alter some settings and start all the Activity- sequences, Ultrasonic-behaviours, User programs and routines to control Hextor from the LCD-keypad or from an IR controller. Program1 holds the Activity-sequences in DATA statements and the sequence-engine which interprets the sequence codes and sends messages to the BOS chip. Activities can call or run other program pages as required. Program2 holds the Ultrasonic-behaviour rules in DATA statements and the rule-engine which interprets the rules and sends messages to the BOS chip and runs the Activity-sequencer program as required. Program3 holds the routines necessary for experimenting with direct BOS control. Program4, Program5 and Program6 are free for use. Program7 holds two routines which wouldn't fit in Program0 if there was to be left room for additional menu items. The routines are invoked from the menu system of Program0 and allow direct control of Hextor using either the Pendant or a standard IR-remote-control. When using programs in the eight pages of the BS2Sx the Common- Ram can be used to store information needed by the various programs. In each of the programs Hxtr0 - 7 the common ram locations are specified. Those at the beginning are in no particular order, as a new common variable was needed the next location was used. The top end of Common-Ram is used for a stack and its associated variables. The stack is used to enable Activity-sequences to call other sequences as subroutines. The main program is of course Program0 which is the first to run, this holds the menu routine from which can be invoked all the other user routines. The title of a menu list is in capitals and the selectable elements are in lower case. OPTIONS is the top menu. By using the buttons labelled 'back < > do' by the lower line of the LCD, the various elements can be selected. Pressing 'back' first takes you back to the title of the current menu and then for the second level, back to the relevant item in the menu above, '<' takes you to the previous entry and '>' to the next. The menus do not wrap round so pressing '<' at the start will have no effect, likewise '>' at the end. when an item is displayed pressing 'do' will select that entry and if it is in the top menu will take you to the title entry for the sub menu or if it is in a sub menu will execute some action dmo0 data 1,"OPTIONS ",0 '0 top level data 1,"Activities ",0 '1 data 1,"US behaviour",0 '2 data 1,"Programs ",0 '3 data 1,"Settings ",0 '4 data 0 dma0 data 1,"ACTIVITIES ",0 '0 Activity-sequences data 1,"A_chirp1 ",0 '1 data 1,"A_beep2 ",0 '2 data 1,"A_wiggle1 ",0 '3 data 1,"A_wiggle2 ",0 '4 data 1,"A_wiggle3 ",0 '5 data 1,"A_Qs4r170 ",0 '6 data 1,"A_Ts0r200 ",0 '7 data 1,"A_tround ",0 '8 data 1,"A_beg ",0 '9 data 1,"A_Rface ",0 '10 data 1,"A_Lface ",0 '11 data 1,"A_F5 ",0 '12 data 1,"A_R5 ",0 '13 data 1,"A_L5 ",0 '14 data 1,"A_BR ",0 '15 data 1,"A_BL ",0 '16 data 1,"A_L3 ",0 '17 data 1,"A_R3 ",0 '18 data 1,"A_L2 ",0 '19 data 1,"A_R2 ",0 '20 data 0 dmu0 data 1,"US BEHAVIOUR",0 '0 Ultrasonic behaviour rules data 1,"US_sitcorner",0 '1 data 1,"US_beg ",0 '2 data 1,"US_hello ",0 '3 data 1,"US_wander ",0 '4 data 0 dmp0 data 1,"PROGRAMS ",0 '0 various programs data 1,"Do LCD Keys ",0 '1 control of Hextor from the Pendant data 1,"Do IR Keys ",0 '2 control of Hextor from a remote-control data 1,"RUN BOScon ",0 '3 data 1,"RUN Prog4 ",0 '4 data 1,"RUN Prog5 ",0 '5 data 1,"RUN Prog6 ",0 '6 data 0 dms0 data 1,"SETTINGS ",0 '0 data 1,"BacklightON ",0 '1 data 1,"BacklightOFF",0 '2 data 1,"IR watch ON ",0 '3 data 1,"IR watch OFF",0 '4 data 0 Selecting an Activity results in program0 saving in common ram some information including the name of the Activity-sequence to be executed and then running program1. Program1 looks in common-ram to see what it should be doing and at the end looks in common-ram to see which program called it and then runs that program. Similarly selecting an Ultrasonic-behaviour will result in a jump to program2. An Activity-sequence may call an Ultrasonic-behaviour which involves a jump to program2. If this behaviour calls an activity then commonRam0, the return program, will get overwritten and similarly an Ultrasonic-behaviour may call an Activity-sequence which calls a behaviour overwriting the return program number. In other words you can bounce back and forth between sequences and behaviours at will but you can't nest calls. If you interupt the action by using the Pendant buttons or the IR remote then the interupted program will run program0 so you can use the menu again. This limitation will be removed in MultiProgSx1. 'Do LCD Keys' and 'Do IR Keys' both involve a jump to program7 and a jump to program0 on 'back' or IRpage3,1 Adding Menu items ----------------- If a new Activity-sequence is required then moves should be entered into DATA statements following its name, an entry made at the end of the DATA-pointers-table and an entry made at the end of the Name-table. The entry at the end of the Name-table should be copied to the relevant Name-table in Program0 and the LCD text added to the end of the ACTIVITIES menu, moving the DATA 0 right to the end. The 1 at the start of the text homes the cursor on the lcd. The 0 at the end of the text tells the lcd subroutine that it has got to the end of the text and the 0 at the end of the menu list indicates the end of the list, tested at lcd3:. A similar procedure is required for the addition of a new Ultrasonic-behaviour rule-set. If an additional top level entry is required then the address of the submenu will need to be added in the LOOKUP at lcdit:. David Buckley 27 October 2001