Console control - StampPlot Pro: count problem..

strella

New Member
StampPlot Pro (www.selmaware.com) offers great features for Picaxe X1 console control through the programming cable. Sadly the count instruction appears to interfere with serial transmission as in the example below where everything else is functional when the count instruction is disabled. pin 0 is connected to a QRB114 optosensor and processed as a tachometer. The serrxd instruction reads the value of a slide control with the object of controlling motor power. With the count instruction enabled unwanted data appears to be sent through the serial port, periodically resetting StampPlot Pro. Any ideas for workarounds (surrounding <count> with <disconnect> and <reconnect> doesn't improve matters).

getRPMAndPlot: ' main program
for counter = 1 to 50
sertxd("!BSND(pControl)",CR)
serrxd duty
pause 1000
pwmout 1, 49, duty
gosub readTach
next counter
reconnect
stop

readTach:
count 0, 500, countval
rpm = countval * 60
sertxd(#rpm,cr)
sertxd("!O Update",cr)
return
 

hippy

Technical Support
Staff member
Which PICAXE are you using - 28X1/40X1 ?

I cannot see why COUNT should interfere with SERTXD but that perhaps require further investigation. Could it be a problem with data sent to StampPlot because of particular values in 'countval' or 'rpm' ?

Have you tried looking at what is being sent using the Programming Editor Terminal rather than connecting StampPlot ? Try that with and without COUNT and see if the data coming out is as StampPlot expects.
 

strella

New Member
Thanks for your reply

I am using a 28X1. I followed your suggestion and examined the Picaxe output in the editor terminal window rather than the StampPlot log. This was revelatory - with the count instruction enabled the Picaxe resets itself. The following terminal dumps clearly illustrate this. Look immediately after the first data request !BSND. With count disabled the program responds as expected. With count enabled, the program resets itself and runs from the beginning. From my superficial knowledge of the Picaxe I may well be wrong but there does appear to be a "side-effect" here. Comments, criticisms and work-arounds gratefully received :)

'count instruction disabled

!O clear
!PPER 80,100
!NEWP
!TITL Tachometer: Motor Speed (RPM)
!YLBL RPM
!SPAN 0,8000
!TMAX 400
!O oBack=4
!O oMeter.tachometer=80.,88.,20.,20.,0,8000,0,5700
!O tachometer.U=(AINVAL0)
!O tachometer.C=~PWAV factwhistle
!POBJ oVSlider.pControl=90.,60.,3.,15.,90,195,90
!POBJ oLabel.plabel=86.5,44.,10.,3.,Power,,0,8,0
!POBJ plabel.F=Arial,8,0,0
!BSND(pControl)
6000
!O Update
!BSND(pControl)


'count instruction enabled


!O clear
!PPER 80,100
!NEWP
!TITL Tachometer: Motor Speed (RPM)
!YLBL RPM
!SPAN 0,8000
!TMAX 400
!O oBack=4
!O oMeter.tachometer=80.,88.,20.,20.,0,8000,0,5700
!O tachometer.U=(AINVAL0)
!O tachometer.C=~PWAV factwhistle
!POBJ oVSlider.pControl=90.,60.,3.,15.,90,195,90
!POBJ oLabel.plabel=86.5,44.,10.,3.,Power,,0,8,0
!POBJ plabel.F=Arial,8,0,0
!BSND(pControl)

!O clear
!PPER 80,100
!NEWP
!TITL Tachometer: Motor Speed (RPM)
!YLBL RPM
!SPAN 0,8000
!TMAX 400
!O oBack=4
!O oMeter.tachometer=80.,88.,20.,20.,0,8000,0,5700
!O tachometer.U=(AINVAL0)
!O tachometer.C=~PWAV factwhistle
!POBJ oVSlider.pControl=90.,60.,3.,15.,90,195,90
!POBJ oLabel.plabel=86.5,44.,10.,3.,Power,,0,8,0
!POBJ plabel.F=Arial,8,0,0
!BSND(pControl)
 

strella

New Member
Problem solved - with a little help from StampPlot

Thank you for the prompt technical support. As it happens I was using version A.1 of the 28X1 chip. The reconnect instruction following serrxd solved the Picaxe reset problem but in turn it interfered with StampPlot. This remaining problem was solved by running a StampPlot macro under Picaxe control: the macro turned off StampPlot's serial communication for 1 second and then turned it on again. Fortunately StampPlot empties its serial buffers at reconnection.

Once again, many thanks for the help => Terry
 
Top