User Tools

Site Tools


uphp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp [2018/09/01 09:13]
jeff Improved purpose as intro to uPHP
uphp [2021/09/13 05:57] (current)
Line 1: Line 1:
 ======uPHP====== ======uPHP======
  
-This section contains details on how to use the Wattmon built in scripting language to customize it for any application. This page is an introduction to Programming the Wattmon and is of general interest to all users of the Wattmon, as it explains the architecture and design of the user interface software on the Wattmons.+The [[hardware:wattmons|Wattmon]] is built on a scripting language that is syntactically identical to PHP((PHP is a server-side scripting language designed primarily for web development but also used as a general-purpose programming languagePHP stands for "PHP: Hypertext Preprocessor." This confuses many people because the first word of the acronym is the acronym (this type of acronym is called a recursive acronym.) )) - we call it uPHP for Micro-PHP.  It has a small but powerful subset of the functions and features found in the PHP language.
  
-=====Programming the Wattmon=====+This section contains an introduction and detailed guide for using the built in scripting language to customize the [[hardware:wattmons|Wattmon]] for any application:
  
-"Programmingand "scripting" are used interchangeably throughout this documentation.+  * [[uphp:uphp_intro|Programming the Wattmon]] - An introduction of general interest to all users, as it explains the architecture and design of the OS
  
-The Wattmon is built on a scripting language that is syntactically identical to PHP((PHP is a server-side scripting language designed primarily for web development but also used as a general-purpose programming language. PHP stands for "PHPHypertext Preprocessor." This confuses many people because the first word of the acronym is the acronym (this type of acronym is called a recursive acronym.) )) - we call it uPHP for Micro-PHP.  It has a small but powerful subset of the functions and features found in the PHP language.+  * [[uphp:uPHP Language Basics]] Basic syntax and tips to get started
  
-=====Why uPHP?===== +  * [[uphp:functions|uPHP Function Reference]] - The entire function list (advanced) 
- +      * [[uphp:modbus_functions|uPHP Serial and Modbus Functions]] - Serial and Modbus Functions 
-First perhaps it would be good to explain a bit about how and why we chose PHP.  The goal of the Wattmon is to provide a highly flexible platform that can be customized for pretty much any application imaginable, keeping in mind very low memory availability.  It became clear that a scripting language would be required to implement this, since having custom firmwares for various applications would be very tedious.  The question then became: what would be the *best* scripting language that is well known today and can be deployed on a microcontroller with such limited resource?  The choices are actually very small.  Most modern scripting languages require quite a bit of RAM.  So, we decided to roll our own scripting language from scratch and base it off a well known language. +  [[uphp:library_functions:library_functions|uPHP Library Function Reference]] - WattmonOS additional function libraries 
- +   
-The Wattmon interface is primarily browser based, and generates HTML pages on the fly from uPHP scripts.  The methodology of HTML-PHP integration is well understood by most programmers and hence it allows you to become more productive quickly. +  [[uphp:uPHP Special Variables]] - Special arrays that are populated automatically before a script is run 
- +   
-====Challenges==== +  [[uphp:Blockly Programming the Wattmon]] - An introduction to using the visual blockly language to create scripts on Wattmon
- +
-The biggest challenge with the scripting language is its memory limitation.  The [[hardware:wattmons:WattmonPRO]] and [[hardware:wattmons:WattmonMINI]] processors have a total of 128KB (yes, Kilobytes!) of RAM available to run a multitasking OS with a TCP/IP and USB stack, modbus polling engine, scheduler and more.  For these platforms during normal operation scripts have a maximum of about 30 KB of memory for variables, which means that as a programmer you need to be very conscious of memory allocation.  We have introduced some special non-PHP compatible variable types to help with this.  The [[uphp:functions:indexed_array()]] function lets you create arrays of a very specific type (int, byte, etcwhich will reduce the amount of resources compared to hash arrays created with the [[uphp:functions:array()]] function. +
- +
-The [[hardware:wattmons:WattmonMEGA]] processor has a total of 512KB of RAM (4 times as much as for the PRO and the MINI). Memory limitations are much less of a challenge when scripting for the MEGA. +
- +
-====Benefits==== +
- +
-Having a scripting language that lets you modify and edit your program remotely is a very powerful thing.  It lets you provide remote support to your clients and fix issues without needing to visit the site, and also makes your applications future-proof as you can at any time update the code base and integrate new features or protocols. +
- +
-=====Further Information on uPHP===== +
- +
-Of interest to those who want to dig deeper and advance into making tweaks and changes to the system: +
- +
-[[uphp:uPHP Language Basics]] +
- +
-[[uphp:functions|uPHP Function Reference]]+
  
uphp.1535793189.txt.gz · Last modified: 2021/09/13 05:56 (external edit)