Maths in StampPlot

xstamp

Senior Member
Following a rather ‘trial and error’ process, I managed to use some of the maths features of StampPlot Pro. The example code below generates ramping data to which StampPlot applies maths before plotting, thus avoiding any PICAXE maths.

The maths used is for the following typical application. An accelerometer produces an output of 0 to 5V over the range -8G to 8G. Which corresponds to ADC(8-bit)readings of 0 at –8G and 255 at 8G (with zero G being about 128). In order to plot this raw data in engineering units StampPlot must therefore first subtract 128 and then divide by 16.

This single channel example could form the basis of many common analog offset and scaling tasks. However, does anyone have any ideas about how best to extend the technique to deal with multiple channels using common offset and scaling parameters?


'RAMP TO STAMPPLOT PRO WITH MATHS EXAMPLE

pause 2000

setfreq m8

serout 4, N1200,("!RSET",cr)

serout 4, N1200,("!SAMT 90",cr)
serout 4, N1200,("!TMAX 50",cr)

serout 4, N1200,("!SPAN -8,8",cr)

serout 4, N1200,("!SHFT ON",cr)

serout 4, N1200,("!FLSH ON",cr)

serout 4, N1200,("!PLOT ON",cr)

serout 4, N1200,("!RSET",cr)


start:
for b0 = 0 to 255

serout 4, N1200, ("[[", #b0, " - 128] / 16]",cr)

pause 200
next
goto start




 

jodicalhon

New Member
Sorry xstamp, I don't have any new ideas for you. But I would like to say thanks for putting me on to this software. I've been having great fun with it, and it is a powerful and useful tool. (Or, will be - once I get the hang of it!)

Your code examples on this and other recent threads have been a real help.
 

xstamp

Senior Member
acrylic.... I agree! StampPlot is a really powerfull application. I have found the binary mode option with check-sum feature very useful for a number of telemetry projects. Like model rocket and RC aircraft development,

The ability to apply scale and offset etc at the PC end of the serial link could save a lot of PICAXE software development time. There are lots of BASIC STAMP examples of how to use StampPlot Pro in the Parallax 'Stamps in Class' series (e.g. the Process Control text). Unfortunately I still find the maths commands difficult to get to grips with.

 
Top