This page includes the JavaScript functions output by the PIC

The PIC outputs the data wrapped in JavaScript function calls, and this page includes the data and processes it.
...
f(",6E,7F,95,5D,:,0092,000146,:,0067,000103,,");
f(",BF,2A,94,5D,:,0030,000048,:,0067,000103,,");
f(",CD,21,95,5D,:,0026,000038,:,0067,000103,,");
f(",C7,2D,94,5D,:,0030,000048,:,0067,000103,,");
f(",3E,B3,95,5D,:,00C7,000199,:,0067,000103,,");
f(",3A,B3,95,5D,:,00CD,000205,:,0067,000103,,");
f(",24,CA,94,5D,:,00E5,000229,:,0067,000103,,");
...
This page prints a simple graph of the raw measurements of the resistors from the PIC chip. how to do it!


---8<--- start of graphics --------------
---8<--- end of graphics --------------
Using a Terminal program at 1200 baud, capture the output of the rpot002.asm into a textfile called capture.txt

Edit capture.txt to trim off half lines and ensure that all the lines look like:

f(",6E,7F,95,5D,:,0092,000146,:,0067,000103,,");
Save the file and rename the file to capture.js.

It is included in this page and you need to have a function f(), which pulls out the data.

There is one parameter for the JavaScript function. However, the PIC outputs its many parameters comma separated, so your javaScript function f() has to split the parameter.

Use:

  var pA=p.split(",")
Use parseInt(pA[ 1 ],16) to convert hex parameters to decimal values.

The example function f() below is called when you include the data. You need to modify this function to do what you want.

//0   1  2  3  4  5 6    7      8 9    10        
//f(",6E,7F,95,5D,:,0092,000146,:,0067,000103,,");


function f( p ){
  var pA=p.split(",")

  var p1 =parseInt( pA[1],16 )
  var p2 =parseInt( pA[2],16 )
  var p3 =parseInt( pA[3],16 )
  var p4 =parseInt( pA[4],16 )

  var p7 =parseInt( pA[7] )
  var p10=parseInt( pA[10] )

  // plot ot some blocks
  self.document.write("<tr><td>")
  bl("blk",1,5)
  bl("red",  p1,5)
  bl("wh",1,5)
  bl("blk",1,5)
  bl("wh",1,5)
  bl("yel",p2,5)
  bl("blk",1,5)
  self.document.write("</td><td>A "+pA[1]+","+pA[2]+"</td></tr>")

  self.document.write("<tr><td>")
  bl("blk",1,5)
  bl("blu",  p3,5)
  bl("wh",1,5)
  bl("blk",1,5)
  bl("wh",1,5)
  bl("green",p4,5)
  bl("blk",1,5)
  self.document.write("</td><td>B "+pA[3]+","+pA[4]+"</td></tr>")
  self.document.write("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>")

};
Use the code below to include the capture.js, It uses a table.
<script>

self.document.write("<table border = 0>")
axis()
</script>
<script src="capture.js" language="JavaScript"> </script>

<script>
axis()
self.document.write("</table>")
</script>
I have a function bl( "red",x,y ) which outputs a colour block:
function bl(g,x,y){
  var opStr="<IMG src="+g+".gif width="+(x*2)+" height="+(y*1)+" >"
  self.document.write( opStr )
}
I have gifs called red.gif, green.gif etc, which bl() uses for the colours.

I have a function br() that does a CRLF to start a new line.

I have a function axis() that plots a simple graduated line.

function axis(){
  self.document.write("<TR><TD>")
  bl("blk",1,5)
  for ( var cnt = 0; cnt<32; cnt++){
    // plot ot some blocks
    var h = (( cnt % 4 )& 5)*2 + 2
    bl("blk",7,1)
    bl("blk",1,h)
  }
  self.document.write("</TD><TD>256</TD></TR>")
}
This is a simple way to capture PIC debug output and process it to summarise it. You can output timings and bitmaps etc.

What is really needed as well is a program that captures the serial output and only starts appending after the first CRLF, and only appends whole lines.

It would capture to capture.js, so that the webpage can be refreshed periodically.