REM ******************************** REM Key user settings file (.basinc) REM ******************************** REM REM This settings file contains most of the definitions that are common to both master and slave nodes software. REM It is importamt to carefully study its contents and adapt according to your local setup. REM REM This file is imported automatically when checking & downloading the master or slave node software to the picaxe chips. REM Therefore this settings file should reside in the same folder as your master & slave node programs. REM REM Some of the defintions in this file are user-selectable: REM - The hardware network type used (two-wire or three-wire) REM - The clock speed of the picaxes of all nodes (yes, these are adapted automatically when the network powers up) REM These user-selectable options have been enclosed in the +++++ sections. REM REM !!! TWO IMPORTANT aspects !!!: REM --------------------------- REM 1. The master and slave code files contain some obligatory user programmable areas as well, REM related to the pin numbers used in your actual circuit. Additionally, the available REM (i.e. non-reserved) registers to the user are presented there. REM 2. When making changes in this settings file: REM a. You must again download BOTH the master node file and all slave node files to the picaxe chip! REM Therefore it is important to edity/change this settings file first. REM b. You should ALWAYS dowmload the slave node programs FIRST REM before downloading the master program! REM Electrical network type: Simple diode-mixing (3 wires) or true 2-wire data & power REM ================================================================================== REM Specify here if a simple diode-mixing network is used (separate power (GND, Vcc) + serial data line), REM otherwise the 2-wire data+power netwrk type is presumed. REM IMPORTANT !!!: It is very important to choose the right option here, otherwise the FET REM at the slave node output gets destroyed! REM Defualt: true two-wire network REM Uncomment the following line if a diode-mixing (3 wires) network is used instead: REM +++++++++++++++++++++++++ REM #define simpleDiodeMixing REM +++++++++++++++++++++++++ REM Network Status & Frequency definitions and specification REM ========================== SYMBOL NETWORK_NOT_READY = %00000000 REM Meaning: Roaming for sending processes not yet completed SYMBOL NETWORK_READY = %00000001 REM Network Frequency definitions SYMBOL FREQ_UNDEFINED = %00000000 REM Meaning: Network node frequencies not yet defined SYMBOL FREQ_BASE = %00000001 REM Corressponds to 4MHz (M2) or 8 MHz (X2) but same base timing SYMBOL FREQ_BASEx2 = %00000010 REM 8MHz (M2) OR 16MHz (X2) SYMBOL FREQ_BASEx4 = %00000011 REM 16MHz (M2) OR 32MHz (X2) SYMBOL FREQ_BASEx8 = %00000100 REM 32MHz (M2) OR 64MHz (X2) REM Freqs lower than Base (d# = divide Base by #): SYMBOL FREQ_BASEd2 = %00001000 REM 2MHz (M2) OR 4MHz (X2) SYMBOL FREQ_BASEd4 = %00001001 REM 1MHz (M2) OR 2MHz (X2) SYMBOL FREQ_BASEd8 = %00001010 REM 512KHz (M2) OR 1MHz (X2) SYMBOL FREQ_BASEd16 = %00001011 REM 256KHz (M2) OR 512KHz (X2) SYMBOL FREQ_BASEd32 = %00001100 REM 256KHz on X2, not supported on M2 series since 128 KHz not available REM REM Specify here which frequency from the above list to use in the application REM BASE implies 4MHZ for M2 parts amd 8MHZ for X2 parts so that pause commands etc. have the same duration REM and therefore M2 and X2 parts can be freely mixed in one system. REM Higher freqs mean more perfomance but also more susceptibility REM towards external noise and large capacitances due to larger networks, both breaking operation, REM so one should test this appriopriately. REM Example of highest frequency (all M2-nodes in network switch to 32MHz, X2-based nodes to 64MHz: REM SYMBOL SelectedFreq = FREQ_BASEx8 REM +++++++++++++++++++++++++++ SYMBOL SelectedFreq = FREQ_BASE REM +++++++++++++++++++++++++++ REM Time intervals for network timing (DO NOT CHANGE!) REM ================================================== REM Must be identical for master and slave nodes REM - in milliseconds REM - assuming network BASE frequency: REM - 1 bit takes 1/2400 = 0.42 ms REM - 1 byte takes 8/2400 = 1/300 sec = 3.3 ms = approx. 4 ms REM - 1 message takes 4 bytes -> 4 * 4 ms = 16 ms REM Note that these defs should be the same as those for the master node! SYMBOL t_startUp = 1000 SYMBOL t_startUp_masterNode = 2*t_startUp SYMBOL t_byte = 4 SYMBOL t_INTmaster = 2*t_byte SYMBOL t_INTslave = t_INTmaster SYMBOL t_dataFrame = 16 SYMBOL t_respondDelay = 3*t_byte SYMBOL t_testTimeSlot = 3*t_byte SYMBOL t_calc1 = t_respondDelay + t_INTslave SYMBOL t_slaveTimeSlot = t_calc1 + t_dataFrame SYMBOL t_masterTimeSlot = t_INTmaster + t_dataFrame SYMBOL t_comms = t_masterTimeSlot + t_slaveTimeSlot REM Time duration between network communication time slots REM ====================================================== REM Guarantee a certain time with active power provision between timeslots REM Note: shorter period implies higher network bandwitdh but also more interruptions of slaves! REM Do not take a shorter period than t_comms REM ++++++++++++++++++++++++++++++++++++ SYMBOL t_pauseBetweenTimeSlots = t_comms REM ++++++++++++++++++++++++++++++++++++ REM Highest user-selectable slave process ID REM ======================================== REM Highest User-selectable process ID number (min = 10, max = 254 as id=255 is reserved) REM A larger number accomiodates more (sending) processes but also requires more process-id roaming REM after network powerup ... REM +++++++++++++++++++++++++ SYMBOL lastUserProcessID = 50 REM +++++++++++++++++++++++++ REM Macro definitions for active power provision by Master node REM =========================================================== REM Specify here if (for the true two-wire solution) the Active Power Provision (APP) REM needs to be enabled. REM Uncomment the following line if this functionality needed: REM +++++++++++++++++++++++++ #define APP REM +++++++++++++++++++++++++ REM REM Time duration (in ms at BASE freq) of active power provision period: REM ++++++++++++++++++++++ SYMBOL t_masterAPPdelay = 4 REM ++++++++++++++++++++++ REM SYMBOL t_slaveAPPdelay = t_masterAPPdelay + 1 REM Macro definitions for active power provision by Master node #MACRO ActiveHigh_Master HIGH M_netSerialOUT PAUSE t_masterAPPdelay INPUT M_netSerialOUT #ENDMACRO REM Macro definition for active power provision by Master node #MACRO ActiveHigh_Slave PAUSE t_slaveAPPdelay #ENDMACRO REM plugNlay usage REM ============== REM Define here whether plugNplay option is used REM Uncomment the following line if this functionality needed: REM +++++++++++++++++++++ REM #define plugNplay REM +++++++++++++++++++++ REM Definition of IDs (DO NOT CHANGE!) REM ================================== REM Process Identifiers of network stack related processes: SYMBOL IDallProcesses = 255 SYMBOL IDnoProcess = 0 SYMBOL IDroamSendingProcess = 1 'Slave process SYMBOL IDregisterSendingProcess = 2 SYMBOL IDunRegisterSendingProcess = 3 SYMBOL IDavailableTimeSlot = 4 'Slave process SYMBOL IDsendStringSERTXD_Master = 5 'Process for sending a text string to the PC via SERTXD on the master node (for testing purposes only, as it delays the creation of a new timeslot) SYMBOL IDsendStringSERTXD_Slaves = 6 'Process for sending a text string to the PC via SERTXD on all slave nodes SYMBOL IDflashLEDmasterNode = 7 SYMBOL IDnetworkConfigProcess = 8 'Allows to configure slaves at start-up (clock speed etc.) SYMBOL IDroamPlugNplayNode = 9 'Slave process (plugNplay node) REM IMPORTANT: IDs 10 - 19 are reserved for future system processes REM REM Data on allowed user-defined process IDs REM (used for roaming sending slave processes) REM Note that ID=255 is reserved (IDallProcesses) and should NOT be used as a user process! SYMBOL firstUserProcessID = 20 'First user-available process ID (max 254) REM ASCII control codes (DO NOT CHANGE!) REM ==================================== SYMBOL NUL = 0 REM Null character SYMBOL ETX = 3 REM End Of Text