What high level language for user defined maths in controller device? - Page 1
Forum section: electronics / general

author: JayDee
author_rank: Contributor
timestamp: September 27, 2013, 07:24:52 pm
content: Hi Guys, I'm after general thoughts on the following...Looking at developing an embedded controller device (so micro controller based, not desktop or rack mount pc) , usual stuff, Analog inputs, digital inputs, switched power outputs. The intention is to have several built in features. The main control I expect to be written directly in C.However, I would also like to provide a user defined 'maths' section, such that the user has access to quite a few of the variables and do there own maths on these, outputting a result and being able to link this other parts of the system, i.e. turning an output On/Off. An extension of this idea, would be to go beyond basic math operators / logic and allow the user to write more complex control sequences of their own. If/else, Wait, advanced maths like Diff, Int etc..Is anyone aware of a good high level language that would be suitable?A scripted language would be OK,rather optimistically a graphic interface would be much friendlier for many of the users, as they will not have code writing experience but are capable engineers.I've looked at lots ofthe big boys like MatLab, LabView...and the small guys like eLua, Squirrel, TCL...with every thing inbetween like Python.So..open question...if you had to design an embedded device that allowed the end user to add there own maths/control...what would you use?Thanks for input!J.

author: Unknown
author_rank: Unknown
timestamp: September 27, 2013, 07:31:12 pm
content: It would of course depend on the customer, but I would probably use a small scripting language like Lua. You can always add a GUI on the PC side to generate it. It also depends on the type of micro-controller: are we talking 8-bit PIC or Beagle board?

author: JayDee
author_rank: Contributor
timestamp: September 27, 2013, 07:43:01 pm
content: Due to some other other functions we are going to include..we'll be probably using something 32bit,Lua or eLua has cropped up before...will be looking at it again.

author: Rick Law
author_rank: Super Contributor
timestamp: September 28, 2013, 12:55:40 am
content: Quote from: JayDee on September 27, 2013, 07:24:52 pmIf space/resource is a premium, how about simple RPN?

author: nctnico
author_rank: Super Contributor
timestamp: September 28, 2013, 07:36:00 pm
content: IMHO eLUA (embedded LUA) definitely fits the bill.

author: Electro Fan
author_rank: Super Contributor
timestamp: September 28, 2013, 10:04:38 pm
content: Quote from: JayDee on September 27, 2013, 07:24:52 pmOff topic but your math idea stimulated another idea - although probably simpler than the advanced math functions you have in mind.Not sure exactly where you are headed with your projects but I think it would be handy to find a relatively easy way to write (or just use/configure) programs that could instruct an embedded device to manage non-programmable power supplies.If someone had code - maybe that could be used either with a command line and/or a GUI that would interface to something (an Arduino or raw Atmega) that could be programmed to turn on and off voltage to specified levels and specified intervals, etc. and the device could be interfaced to a RS232, TTL, or USB interface on a power supply there might be a community of users for such a capability.Or maybe the embedded device might not even need to be in the loop? Maybe the code could run from a PC? Might depend on the particular power supply?

author: dannyf
author_rank: Super Contributor
timestamp: September 28, 2013, 11:41:51 pm
content: QuoteThe same high level language that you would use on a Cray super computer to control your toaster.

author: JayDee
author_rank: Contributor
timestamp: September 29, 2013, 04:54:57 pm
content: Thanks guys, always worth asking and the consensus does seem to be leaning towards eLua.The project is aimed at a fairly niche market, in very simple term its power control/distribution and current monitoring. There is no need for Voltage control but some outputs might be PWM'd. Existing units are good and provide most of the basic math previously discussed, however at the top end of the market there is demand for writing more involved control loops. Might seem overkill to some but special markets call for specialist solutions, happy days!