Home

iProtoXi Firmware User Guide

image

Contents

1. unsigned words rd rd rs addsb 87 rd b amp an immediate signed byte value paddsw 7 rmiw an immediate signed word value subb 068 rdb amp Substct an immediate unsigned byte value sub w 28 Substract an immediate unsigned word value sub b rs Substract unsigned bytes rd rd rs sub w 68 48 Substract unsigned words rd rd rs sub sb 88 rd b Substract an immediate signed byte value sub sw 8 rd w Substract an immediate signed word value subsb C8 rs Substract signed bytes rd rd rs subsw LES 0 rs Substract signed words rd rd rs send n rs Nb Df Send Nb bytes from rs to output channels as a D message using format specified by Df sous 0 Synchronize to microseconds time interval 1 smoms Synchronize to milliseconds time interval 1 js Synchronize to microseconds time interval 1 smoms to milliseconds time interval 1 syncmi us 8C wit Synchronize to microseconds time interval register memory change or sensor interrupt 1 2 syncmi ms AC Wit Synchronize to milliseconds time interval register memory change or sensor interrupt 1 2 syncmi us rs Synchronize to microseconds time interval register memory change or sensor interrupt 1 2 Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 23 SC change or sensor interrupt 1 2 jmpb jb fSignedonc b
2. 2 This instruction can be used to save battery but still enable immediate reaction to important events Detecting which condition triggered the syncmi instruction 15 as follows Timeout Condition bits are set to zero use e g jmpeq instruction to branch Sensor interrupt Condition bits are set to positive use e g jmpg instruction to branch Register memory changed Condition bits are set to negative use e g jmpl instruction to branch Register memory change happens when a write message arrives lt gt that changes one or more of the VM program s registers Floating Point Format Aistin Virtual Machine s floating point format is not quite the 754 but as follows MMMMMMMM MMMMMMMM SMMMMMMM SEEEEEEE Where S s are sign bits E s are exponent bits and M s mantissa bits both coded using two s complement The last byte is 8 bit signed exponent whereas the preceding three bytes are the mantissa in big endian order thus sign bit appears in the last byte The only support for floating point is in printout when requesting a data message in floating point format You cannot directly compute with the floating points Note also that currently only negative exponents are supported in printout and mantissa must be positive Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 25 SOME EXAMPLE PROGRAMS The following codes can be uploaded as such into the iProtoXi Micro CPU board from a terminal program
3. This register set is used to control the virtual processor In practice the needed operations are normally stopping and re starting execution of a loaded program See next section for information how to load a program for the virtual machine Add R W Values purpose ress 00h byte R deviceAddress 8Dh identifies this device Virtual Machine 01h byte R regsVersion 82h identifies this register set version 02h word R regsize 0031h total size of this register set 05h byte RW deviceControl Write to control VM 01h reset 02h stop 03h continue 04h re start program 10h start programming 12h set autostart off 13h set autostart on 06h byte RW debugLevel Level of debug messages 00h no debug messages 01h show debug messages 07h byte vmControl VM program autostart bits 01h auto start after reset 00h do not auto start 08h word R dii s re Size of available program memory for a VM program OAh word word R ramSize Size of available RAM memory for a VM program RW outputChannels Channels where VM sends messages see Master Register Set for more information ODh byte outputOptions 00h output plain data 01h output real time clock on VM start and stop OEh byte condition VM condition code register 0Fh byte NN Reserved for future use even byte alignment Eak Program Counter address of the instruction in progress E Addre
4. addresses not impl 24h long datetime Real time clock value is in seconds when read as hexadecimal binary For text format date and time read zero bytes instead For setting send a ELM ES ES byte Eg di string as YYYY MM DD HH MM SS 28h 2bytes reserved Reserved for different type of real time clock messageBeginChar gt message begin character not implemented byte RW positiveAck Protocol control 00h do not send positive acknowledgment 01h always send acknowledgment 30h byte RW messageFields Protocol control 00h do not include optional fields 01h include location field 02h include senderID field 03h include both Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 12 1 N N D 31h byte RW includeTimestamp Protocol control 00h do not include timestamp 01h include timestamp before data 81h include timestamp after data 32h byte RW dataEncoding Protocol control 00h encode data as hex no spaces other values are not currently supported 33h byte RW commChannels Which channels are used for messaging 00h no messaging 02h serial channel 0 USB 04h serial channel 1 e g Bluetooth 06h serial channels 0 and 1 byte outputChannels Where to output data messages see commChannels for accepted values 35h byte RW forwardChannels Where to forward messages see commChannels for accepted values This
5. hexadecimal without spaces 01h binary data all bytes are sent out as is with no coding not supported 02h text data data is sent assuming it is printable text and ends with null byte 03h hexadecimal 8 bit no separators currently equals to 00 formatting code 04h hexadecimal 8 bit with separator character in between the bytes not supported 05h hexadecimal 16 bit with separator character in between the values not supported 06h hexadecimal 32 bit with separator character in between the values not supported 07h reserved for future use 08h decimal 8 bit unsigned not supported 09h decimal 8 bit signed two s complement not supported OAh decimal 16 bit unsigned OBh decimal 16 bit signed OCh decimal 32 bit unsigned not supported decimal 32 bit signed not supported 12h decimal 32 bit Virtual Machine s floating point format see Virtual Machine section In addition three uppermost data encoding bits can be or ed into above codes as follows 20h data is be handled as little endian instead of big endian not supported 40h comma is used instead of space as a separator 80h message frame is left away off Also if message frame is set off new line is added after the data only if comma separated mode is selected As an example the following command reads and prints out analog input channels one and two in decimal format without message frame and separated by comma ten times pe
6. its unique device address that is used to address the corresponding register set In addition each register set has a version number to distinguish between possible different versions of register sets The version number and total size of the related register set can be read from the first four bytes of each register set These four bytes have always fixed version independent order making possible to deal with different versions If register set version byte has its most significant byte set i e the value is equal to or greater than 80h it means that the register set has additional four control bytes in the beginning These bytes are used to control software devices that are continuously run by the CPU REGISTER TYPES There are the following possible register types byte word long string Null terminating character array byteg Hidden byte array reading ff bytes returns all available data One or more ofthe following operations are possible R Read W Write Rs Readable also as a formatted string using Nb 00 Ws Writable also as a formatted string using instead of colon Arbitrary number of bytes available be read using Nb ff or maximum amount that is needed Reading and writing of several registers with a single command is possible only for the basic register types byte word and long Even in these cases it might be that all data is not updated so the safest way is always to access a single regist
7. set This is maximum size of VM application including this header 04h byte RW programUID 0 AOh EFh device number that the VM application is implementing will be copied to VM RAM 05h byte RW programUID 1 Register set version that the VM application is implementing will be copied to VM RAM 06h word RW programUID 2 3 Register set size that the VM application is implementing will be copied to VM RAM RW 08h The actual VM application s program code FFh To send a program you can use address 08h for each instruction line the system automatically keeps track where the next program instruction must be located In most cases that eliminates the need to calculate addresses by hand EXAMPLE USE CASES START UPLOADING A NEW PROGRAM gt w 8d05 10 Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 19 UPLOAD AN EMPTY PROGRAM THAT HAS DEVICE ADDRESS ABH gt w 8d05 10 re program VM gt w 8e00 90040001 type ID V04 with 0x0100 bytes of room gt w 8e04 ab010000 program UID dev addr version reg set size gt w 8e08 00 actual program code 00 no program Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 20 VIRTUAL MACHINE RAM REGISTER SET Software Device 8Fh unprogrammed 91h anonymous application 92h 9Fh iProtoXi application AOh EFh user application Version 00h FFh set by application VM RAM register set is used to store your
8. start the program 2013 iProtoXi www iprotoxi fi 27
9. to write the desired device address into program area s register 04h This is shown below gt w 8d05 10 begin programming gt w 8e04 ab set device address we want to provide to ABh Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 21 VIRTUAL MACHINE PROGRAM INSTRUCTION SET For the Device 8Eh version 04h Virtual machine is based on assembly alike instructions laid out as byte stream with operation codes and corresponding arguments The operation code byte opcode is divided into following bits Purpose Op Operand Operand Operation code modifier type size Operation code bits define the operation in case for example addition or multiplication In most cases Operand size is set zero for byte sized operations and one for word sized The Operand type bit is mostly set zero if one of the operands is included as an immediate value and one if that operand should be taken from a RAM register instead Operation modifier is mostly used to select between unsigned and signed oprations The table below lists all available instructions Note that arithmetic instructions are currectly always producing saturated results in case of under overflow The supported instructions are described in the table below Following abreviations are used rd Byte value destination ram address rs Byte value source ram address Da Byte value destination device address Ra Byte value destination device register address N
10. at will be send into the device Da and written into the register Ra All numbers are in two character hexadecimal format in other words a value between 00 FF Thus a leading zero is required if the number is less than hex 10 Spaces are not allowed If the value of Nb is not zero but does not match to the given data an error is returned negative acknowledge If Nb is zero then any number of data bytes is allowed Leaving Nb away first form equals to setting it to zero Note that in case of 16 bit register address Nb must always be given Alternative formats for text type of data are as follows gt W DaRaSmy text 8 bit register address Nb is zero gt W DaRaNbSmy text 8 bit register address Nb given gt W DaRaraNbSmy text 16 bit register address Nb is always needed In this case the data to be written is given as a string and the number of bytes Nb is set to either zero or to match the length of the string In case of zero end of string is indicated with linefeed If protocol specific characters linefeed and single quote 7 are included into the string Nb must be set to indicate the total length of the string Read R Read message gets one of the following forms gt R DaRa 8 bit register address Nb is zero gt R DaRaNb 8 bit register address Nb given gt R DaRaraNb 16 bit register address Nb is always needed Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 7 Again Da Ra
11. b Byte value used as a number of bytes Df Byte value message data formatting code see Read command for a list of accepted values b Byte value read as immediate value from code flow wt Word value two bytes read as immediate value from code flow jb Relative one byte jump address with special values 00h first TAG ffh previous TAG jw Absolute two byte jump address with special values 0000h first TAG ffffh previous TAG Mnemonic Code _ Operands Description au readdev8 b T uis a single byte from current device using 8 bit register address readdev8 w rd Ra Read a word 2 bytes from current device using 8 bit register address Ra Nb Read Nb bytes from current device using 8 bit register address writedev8 b 03 Ra b Write an immediate byte to current device using 8 bit register address writedev8 w 23 wit Write an immediate word to current device using 8 bit register address writedev8 b a single byte to current device using 8 bit register address Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi writedev8 w 163 Ra rs Write word to current device using 8 bit register address wrtedev amp n 04 Write Nb bytes to current device using 8 bit register address copy b 45 dis a byte from rs to rd jaddb 07 an immediate unsigned byte value add w 27 wit Add an immediate unsigned word value 7 rd rs Add unsigned bytes rd rd rs 67
12. based on ASCII characters only One of its main principles is to be both human and machine readable so it can be used with just a simple terminal program such as Windows Hyper Terminal However the protocol has a clear fixed format to enable other software applications on top of it Another important aspect is a small memory footprint thus instead of having large set of different command words there are only few one letter commands The needed command divergence is achieved by using numerical codes called addresses This thinking is derived from the world of hardware bus and people familiar with such kind of things will feel the system very pleasing Third thing provided by the protocol is node addressing It is possible to address an individual iProtoXi controller board in a network even though the board itself doesn t implement a TCP IP stack DATA FIELDS AND CHARACTER ALLOCATION The protocol is based on data fields that are preceded by a single special character The characters are allocated as follows gt X LF CR DaRa DaRaNb DaRaraNb amp Df DOD1D2 string time senderID receiverID Beginning of a message and a message code X when it is the first character in a line after a carriage return and or a linefeed Line feed ascii code 10 end of a message Carriage return ascii code 13 alternative end of a message Target identifier targetID device address Da 8 bit register addres
13. board It is designed to support easy use of add on boards such as accelerometer sensor and gyro as well as temperature and humidity sensors or the RGB LED board To achieve this firmware has ability to communicate with outer world using a specifically designed human readable protocol called Aistin Protocol In more complicated configurations there may be several boards connected to a server Aistin Server which in turn may be connected to some clients such as specific Web pages Furthermore there might be several servers connected together to enable variety of networking configurations This makes possible to network sensors even over the internet Below is an example picture of a possible complex networked system configuration Sensors Sensors Actuator 62 l C bus LC bus init PC bus m Controller Aisin Aistin Controller Controller Aistin Server 2 Bluetooth Aistin m Sensors Actuators ller us ou Client 2 4 2 l C bus 7 Client 1 Web Page Aistin Aistin protocol makes it possible to access all the networked sensors and actuators from the clients with a single unified way In current implementation Il C types of devices are supported but other common buses may be implemented later on Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 4 2 AISTIN PROTOCOL The Aistin protocol is designed to work using any 7 or 8 bit ascii bearer and is
14. can be used to monitor message traffic from another channel 36h byte RW nonipxChannels Where to forward off message characters see commChannels for accepted values This can be used to communicate with e g a Bluetooth module 37h byte RW debugChannels Where to send debug printing not currently supported 38h Re scanForDevices Read to get list of available device addresses both real C devices and software devices will be listed 39h Reserved even byte alignment s Bmw 42h byte RW powerSaveMode Operating mode 00h no power save 01h basic power saving 02h advanced power saving preliminary 43h byte RW powerControl 00h sensors and radio OFF 01h sensors ON radio OFF 02h sensors OFF radio ON 03h sensors and radio ON default 45h byte detectedConnections Detected connections 00h no connections 02h USB connection detected Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 13 EXAMPLE USE CASES READING REAL TIME CLOCK gt 8802400 SETTING REAL TIME CLOCK gt w 8024 2013 07 17 11 20 00 INCLUDE TIME STAMP TO DATA MESSAGES gt w 803101 01 Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 14 ANALOG INPUTS REGISTER SET Software Device 81h Version 01h This register set is used to read the microcontroller s analog input channels The index numbers refer to
15. device and register addresses whereas Nb is the number of bytes that we want to read If Nb is not given or is zero it indicates that we want to get the Ra in readable format Thus the result will be returned as a text instead of hexadecimal byte values In case of e g 16 bit register the string may be a decimal integer whereas in case of date time it is a string containing year month day and time The actual number of bytes that will be read from the register Ra is register dependent and may or may not be shown in the responded data message within the field as Nb value Read message can be put to repeat itself by giving a time field with a value that sets the period between reads For example the following code reads a register 24h from a device 80h once a second Reading stops whenever a new message is send or started gt 88024 1000000 Characters s can be used to indicate milliseconds and seconds correspondingly This avoids using long microsecond numbers The previous command can thus be replaced with either of the following forms gt R 8024 1000m gt 8024 15 Read command accepts also data formatting code that is given with amp character This makes possible to select suitable format to enable easy importing of data into other applications such as Microsoft Excel The following codes are used Note that many of the formats are not currently supported 00h default formatting currently always produces
16. e several other devices within the same node each having their unique address Furher each device has one or more registers which are accessed using unique register address In case of real devices connected to the main board they be accessed transparently as specified in their data sheets This is a very useful feature In outcoming messages receiverlD field is a copy of latest incoming message s senderID field This makes possible to track where an outcoming received message should be forwarded in case of multi client configuration However these fields are both optional and may or may not exist Existence of senderID in outcoming messages can be configured via Master Register Set MESSAGE STRUCTURE All messages have the following logical structure the corresponding characters as described in the previous chapter are shown AII fields may or may not be present Also the time field 96 may be configured to appear before the data begin code message code sender receiver location data format data time end code gt X 2 amp 5 LF CR Where X is one of the following message codes R Read 7 Write D Data S Scan Acknowledge Some examples of valid messages could be gt W 343603 5B23AF gt A 343603 gt R 1D2901 gt D 1D2901 8D PROTOCOL CONFIGURATION OPTIONS Protocol has three configuration bytes that are available through system registers see Master Re
17. er at a time Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 11 MASTER REGISTER SET Software Device 80h Version 81h Master Register Set is used to control basic features of the iProtoXi Aistin firmware Most important things are board s ID protocol options and access to on board real time clock Detailed descriptions are listed in the table below Add Type R W Values purpose ress 00h deviceAddress 80h identifies this device iProtoXi Master Oih byte 81h identifies this register set version fe 02h word jregsSize 00 0046h total size of this register set byte devicestate State of this device 0 stopped 1 running byte RW deviceControl Write to control this device 01h reset to defaults 02h stop 03h run debugLevel Debug messages 00h no 01h show all reserved Reserved for future purposes purp word softwareVersion Version of iProtoXi Aistin firmware in hexadecimal e g 0080h equals to 0 8 0 word arduinoVersion Version of used Arduino build environment in hexadecimal e g 0104h equals to 1 0 4 word hardwareVersion Version of iProtoXi Micro board we are running on in hexadecimal e g 0120h means 1 2 0 OEh 6bytes RW boardUID Six byte unique board identifier e m 14h 13 bytes Null terminated board node identifier string 22h i2cBaseAddress 00h offset for addresses not implemented 23h virtuall2cBaseAddr 80h offset for virtual IC
18. gister Set Configuration options affect also to virtual machine output Shortly they are as follows Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 6 positiveAck option controls whether or not acknowledge message is sent as a reply to all received messages except the acknowledge message itself indeed If it is set ON value is one then positive acknowledge is sent always The default value is OFF zero Note negative acknowledge i e error is sent always independent of this option messageFields option is for performance reasons to control if outcoming messages will have optional targetID field and or senderID field dataTimestamp option is also for performance reasons to control whether or not outcoming data messages will have timestamp field or not 96 Default value zero is OFF whereas 01h corresponds to ON and the field is positioned before the data Value 81h is ON and the field is positioned after the data The timestamp precision is fixed to 10 digits in microseconds MESSAGE TYPES Write W Write message takes one of the following forms when writing binary data in hexadecimal format gt W DaRa DOD1D2 8 bit register address gt W DaRaNb DOD1D2 8 bit register address Nb given gt W DaRaraNb DOD1D2 16 bit register address Nb is always needed Where Da is the device address Ra is the register address Nb is the number of bytes and DO D1 D2 are data bytes th
19. iProtoX Aistin Firmware User Guide Version 0 9 8 2014 03 13 TABLE OF CONTENTS 1 INTRODUCTION 2 AISTIN PROTOCOL DATA FIELDS AND CHARACTER ALLOCATION MESSAGE STRUCTURE PROTOCOL CONFIGURATION OPTIONS MESSAGE TYPES COMMENT CHARACTER 3 SOFTWARE DEVICES REGISTER TYPES MASTER REGISTER SET EXAMPLE USE CASES READING REAL TIME CLOCK SETTING REAL TIME CLOCK INCLUDE TIME STAMP TO DATA MESSAGES ANALOG INPUTS REGISTER SET EXAMPLE USE CASES READING BATTERY VOLTAGE CHANNEL ONCE PER SECOND READING ANALOG INPUT CHANNELS 0 AND 1 TEN Times PER SECOND VIRTUAL MACHINE REGISTER SET EXAMPLE USE CASES START TO RUN USER S VM PROGRAM STOP RUNNING THE PROGRAM START UPLOADING A NEW PROGRAM FOR THE VM VIRTUAL MACHINE PROGRAM REGISTER SET EXAMPLE USE CASES START UPLOADING A NEW PROGRAM UPLOAD AN EMPTY PROGRAM THAT HAS DEVICE ADDRESS ABH Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 10 14 14 14 14 16 16 16 18 18 18 18 19 19 20 VIRTUAL MACHINE RAM REGISTER SET EXAMPLE USE CASES WRITE A STRING INTO RAM AREA CHANGE RAM AREA S DEVICE ADDRESS VIRTUAL MACHINE PROGRAM INSTRUCTION SET Some EXAMPLE PROGRAMS HELLOWORLD AIS TRAFFICLIGHTS AIS Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 21 21 21 25 25 25 1 INTRODUCTION iProtoXi Aistin firmware is the software provided with the iProtoXi Micro controller
20. otoXi originally created 2013 04 19 JNi gt w 8d05 10 command re program VM gt w 8e00 90040001 VM 04 program ID gt w 8e04 91000600 provided device address version reg set size Code begins gt w 8e08 1e34 select LEDs device gt w 8e08 030040 CE ECES gt w 8e08 03365b gt w 8e08 1d loop begins gt w 8e08 6c04 male 10 Set red light gt w 8e08 031c00 0 gt w 8e08 031600 LEDO G gt w 8e08 031700 0 gt w 8e08 031d00 BRAND SR gt w 8e08 031800 PEED SC gt w 8e08 031900 LEDI B Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 26 gt w 8e08 031e10 gt w 8e08 031a00 gt w 8e08 031b00 gt w 8e08 6c04 Add yellow light gt w 8e08 031d10 gt w 8e08 031810 gt w 8e08 6c04 Change to green gt w 8e08 031610 gt w 8e08 031d00 gt w 8e08 031800 gt w 8e08 031e00 gt w 8e08 6c04 Change to yellow gt w 8e08 031600 gt w 8e08 031d10 gt w 8e08 031810 wQ8e08 0dff gt w 9104 0004 gt w 8d05 04 Aistin Firmware 0 8 0 User Guide ED2 R ED2 G 2 sync at r04 ms ED1 R ED1 G sync at r04 ms EDO G 1 ADITZE ED2 R sync at r04 ms 0 ED1 R ED1 G loop to beginning program s register set data default speed 0400h ms 1024 ms command
21. own application s data as you wish However first four bytes should always be laid out as described below They will be directly copied from the program register set from the bytes 4 7 The rest of RAM area can be used as needed It is also possible to store static data such as constants and strings into this area and they will resist over power down since data is stored to EEPROM and re loaded on boot up byte deviceAddress 8Fh 91h 9Fh AOh EFh identifies your device that the VM application is implementing The values below AOh and over EFh are reserved for other purposes At the beginning of programming address is set to 8Fh When program is started default value 91h is used if the program does not specify any other value anonymous application 00h FFh identifies your register set version Enr i 00h 80h total size of your register set meaning the bytes you are providing as an interface to be read and written by the Aistin protocol 04h byte RW RAM and static data area for free use by your VM 7Fh application Note that bytes 00h 03h are read only To change them you must provide the values via the Program register set using register programUID bytes 4 7 EXAMPLE USE CASES WRITE A STRING INTO RAM AREA gt w 8d05 10 begin programming gt w 8f04SMy string CHANGE RAM AREA S DEVICE ADDRESS The correct and only way to change ram area s device address is to begin programming and then
22. r second RG810604 amp CA 100m Data D Data message appears normally as a response to a read message as follows Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi gt D DaRaNb DODID2 or gt D DaRaraNb DODID2 or gt D DaRaNbSstring or gt D DaRaraNbSstring The target ID field may or may not be included depending on the related configuration option In the first case Nb corresponds to the number of bytes whereas in the latter case it will be either zero or the length of the string Further if timestamp was requested then there will be more information as follows gt D DaRaNb timestamp DODID2 or gt D DaRaraNbstimestamp DODID2 or gt D DaRaNbstimestampSstring or gt D DaRaraNb StimestampSstring Now the additional character indicates that the following number is a timestamp for the data when it was read The value is always in microseconds Scan S This message is an alias to reading scan register from the device 80h So the following two messages do the same thing RG8038ff or 29 The 38h is the address of scan register see register tables at end of this document Note that ff is used to indicate we want to read as many bytes as there is available After a scan command a sequence of hexadecimal numbers corresponding to the available device addresses is returned as a data message e g as follows gt D 803808 1D203480818D9091 Ackno
23. s Ra Target identifier device address Da 8 bit register address Ra number of bytes Nb Target identifier device address Da 16 bit register address Rara number of bytes Data formatting code Data bytes in hexadecimal format no spaces between bytes Human readable data a text string or e g a signed 16 bit integer Time value in decimal most often in microseconds Identifier string nodelD of the sender of a message maximum length is 12 characters Identifier string nodeID of the receiver of a message maximum length is 12 characters Comment In case of 16 bit register address the byte order is lo hi low order byte comes before the high order byte so called big endian Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 5 The protocol aims to be stateless two way symmetric This means that both sides can send message at any time and they must be prepared to receive a message at any time Because of symmetricy both sides can behave as a client and as a server all message types are available for both sides There are a few configurable protocol parameters described later The overall system is based on idea of writing and reading data to and from a connected iProtoXi system There is also a concept of device address that is used to route messages into the correct place within the system The iProtoXi Master Device has a fixed device address namely hex 80 but there can b
24. ss of previous TAG in the program 16h long R vmStartDatetime Real time when VM started to run program long R vmstatTime Microseconds time when VM started to run program Dew C meme 7 Ehe mem jew 7 Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 2Ah byte RW ownerNodelD 13 Node s ID that currently controls VM null 37h terminating string This is set automatically when writing to deviceControl byte EXAMPLE USE CASES START TO RUN USER S VM PROGRAM gt w 8d05 04 STOP RUNNING THE PROGRAM gt w 8d05 02 START UPLOADING A NEW PROGRAM FOR THE VM gt w 8d05 10 Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 18 VIRTUAL MACHINE PROGRAM REGISTER SET Software Device 8Eh unprogrammed 90h programmed Version 04h Program register set is used to store virtual machine s application program All programs must have specific eight bytes at the beginning as documented below Programming is controlled using virtual machine register set see Device 8Dh Add R W Values purpose ress 00h byte deviceAddress 8Eh when programming or 90h when already programmed Identifies this device Virtual Machine Program 01 byte regsVersion 04h identifies this register set version This is also used to check program s compatibility with VM 02h word regsSize 0100h total size of this register
25. the ADC pin numbers shown Atmega32u4 specification Note that channels 2 and 3 do not really exist and most other channels are configured for other purposes in default iProtoXi Micro configuration Only channels 0 and 1 are free for user purposes Channel 5 corresponds to USB voltage level channel 6 to battery voltage level and channel 7 measures current consumed by add on sensor boards R W p Values purpose Add ress 00h byte 81h identifies this device Analog Inputs 01h numAdcChannels 14 number of analog input channels in this register set Note channels are not supported by the hardware i byte N a wor byte gt D 05h byte 06h 08h OAh OCh OEh 10h 12h 14h 16h 18h 1Ah 1Ch word e wor wor wor wor wor wor wor wor wor wor wor ELM LM Lug ed pou LL EST tri a wor N a wor Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 15 EXAMPLE USE CASES READING BATTERY VOLTAGE CHANNEL ONCE PER SECOND gt 811202515 READING ANALOG INPUT CHANNELS 0 AND 1 TEN TIMES SECOND gt r 810602 100m Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 16 VIRTUAL MACHINE REGISTER SET Software Device 8Dh Version 82h Virtual machine VM is a special device that can be used to run user s own program
26. using either copy paste or alternatively save example in a file and then upload that file It is convenient to use file extension ais in those files to recognize them later on After successful uploading start the virtual machine with a command gt w 8d05 04 restart VM To stop use command gt w 8d05 02 stop VM If you want to auto start the program after uploading just add the start command as a last line into the file before uploading However whether your program starts again automatically after power down depends on a setting on device 8Dh Master register set To set auto start command gt w 8d05 13 auto start To turn it off command gt w 8d05 12 set auto start OFF HELLOWORLD AIS HELLOWORLD iProtoXi Aistin virtual machine program for VM V04 gt w 8d05 10 command re program VM gt w 8e00 90040001 V04 program ID gt w 8e04 91001000 provided device address version reg set size actual code gt we8e08 1d loop begins gt we8e08 2ce803 sync at 1000 ms 3e8h ms gt w 8e08 0b040c02 send Hello world D message 12 chars gt wW 8e08 0dff jump to beginning loop program s register set data gt w 9104SHello world gt w 8d05 04 command start the program TRAFFICLIGHTS AIS TRAFFICLIGHTS iProtoXi Aistin virtual machine program for VM V04 This example needs you to have the iProtoXi LED controller board installed iPr
27. wledge A If configuration option positiveAcknowledges is ON then the positive acknowledge message takes a form gt A DaRaNb or gt A DaRaraNb Where DaRaNb has the same contents that was used in the message that caused the Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 9 acknowledgment This field may or may not be present depending on the includeAddress configuration option Negative acknowledge is sent always and takes a form gt A DaRaNb ER or gt A DaRaraNb ER Where ER is a non zero hexadecimal error code Note that Nb will be the value that was used in the message that caused this negative acknowledge It does not tell the number of data bytes in this message which is always one the error code Version V or an empty message A V message or an empty message can be used to see some system information i e by giving only gt character and hitting enter on terminal Version information is then shown and will be something like the following gt D 80140CSipxdevice 01 Node ID gt D 800805 0 8 0 Software version 2 DXISO C0 ed 250 Hardware version D8800E0C 27EB142B0000 Board UID gt pP 802413 2013704 05 15 27 48 Real time clock gt D 803806 5D80818D9092 Scan result available devices COMMENT CHARACTER Linefeed or carriage return character ascii 10 or 13 is always used to detect end of message line Because messages ma
28. y be taken from a script file system also accepts human readable comment string after the actual message Comment is separated from the message with a single quote ending quote is not needed For example gt R 802400 read real time clock as a text There is a special exception related to this a comment character can be used to start a message that contains only a comment as follows This is a comment only That kind of message is just ignored by the Aistin system The lines that do not begin with or single quote will be handled as off message data and forwarded to a possible connected raw device such as a Bluetooth module Note Because copy pasting of single quote from different kind of documents sometimes produces varying ascii code the system interprets all character codes equal to or higher than 80h similar way as the single quote character Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi 10 SOFTWARE DEVICES In addition to the real C devices the system has a few software devices used to access software features Those devices have their own register sets described in the following sections Register set is a set of parameters that can be read or written by the protocol There are different types of parameters such as bytes words and strings It must be noted that words two bytes and longs four bytes are in big endian format i e low order byte becomes always first Each device has
29. yterelativejump one byte relative jump pee mma LS LL LINE INN NNNM LL NR NN Wm Ww p o jenes 70 wes Hp gp ees 77 7 mm m a on mul w rs Multiply with immediate unsigned word CRE 2 with immediate signed byte mul sw F7 Multiply with immediate signed word divb fed b with immediate unsigned byte div w 88 with immediate unsigned word divsb fdb with immediate signed byte divsw 8 fd w Divide with immediate signed word divb 568 rides Divide with immediate unsigned byte Aistin Firmware 0 8 0 User Guide 2013 iProtoXi www iprotoxi fi divw dis Divide with immediate unsigned word divsb with immediate signed byte divsw 8 Fir with immediate signed word Tg IDF Mak a loop TAG for a program to loop later on JE p Bet current device address Da Set target nodelD to a null terminating string stored at rs Following special values can also be used 00h loopback local reads writes default 01h allnodes reads writes to all nodes 02h allclients reads writes to all clients 03h vmowner reads writes to current VM owner This opcode may be replaced with other function in the future use only if absolutely necessary 1 The value is interpreted as a signed word maximum being 32767 Negative numbers are reserved for future use seconds and minutes

Download Pdf Manuals

image

Related Search

Related Contents

Qualcomm Computer Accessories 4.3 User's Manual  Betriebsanleitung - Idec Elektrotechnik  Respect user: - Electric Wheels  A-141  PDF Manual de instrucciones SMD57  La littérature et le programme d`études sociales  16.21MB - Kyosho    Manuel CCSMAF  Targus Wallet Stand Case iPhone 6+ Black  

Copyright © All rights reserved.
Failed to retrieve file