This looks neat, but I'm not really sure I understand it. > The program outputs a file containing the important parts of > code to convert reading to six decimal digits. Three digits > to left of decimal point and three to right of decimal point. > Each bit of a/d is tested and if set then the code for that > bit is executed. So there are a series of bit test and jmps somewhere that call the code in the generated listing? Don't there need to be labels? E.g. bit9: > Afterwards each byte (low order byte > first) is tested for less than 10. If 10 or greater then 10 > is subtracted from it and the next higher order digit (byte) > is incremented. This is done to each byte until it is less > than 10. Then the ASCII digits could be compared with the a/d values. Could you post a sample of that code? > The qbasic program can output conversion for most values by > changing one variable 'ref' from 200 to the wanted value. > The qbasic program could be modified to convert one hex a/d > value to another hex value. As in converting the example > from the a/d Celsius reading to the hex value for Fahrenheit. > > Also the concept of having a pc program generate asm data > code for a nonlinear function is useful. Code generators are my favorite thing in the world. http://www.massmind.org --- James Newton: PICList webmaster/Admin mailto:jamesnewton@piclist.com 1-619-652-0593 phone http://www.piclist.com/member/JMN-EFP-786 PIC/PICList FAQ: http://www.piclist.com > Bill > > Included the output file with code as it seems the mail > program lost the tabs. > > ******* code generated by program follows ********* > > ; for bit 9 100 > > movlw D'1' > addwf CVD0,F > > > ; for bit 8 50 > > movlw D'5' > addwf CVD1,F > > > ; for bit 7 25 > > movlw D'2' > addwf CVD1,F > movlw D'5' > addwf CVD2,F > > > ; for bit 6 12.5 > > movlw D'1' > addwf CVD1,F > movlw D'2' > addwf CVD2,F > movlw D'5' > addwf CVD3,F > > > ; for bit 5 6.25 > > movlw D'6' > addwf CVD2,F > movlw D'2' > addwf CVD3,F > movlw D'5' > addwf CVD4,F > > > ; for bit 4 3.125 > > movlw D'3' > addwf CVD2,F > movlw D'1' > addwf CVD3,F > movlw D'2' > addwf CVD4,F > movlw D'5' > addwf CVD5,F > > > ; for bit 3 1.5625 > > movlw D'1' > addwf CVD2,F > movlw D'5' > addwf CVD3,F > movlw D'6' > addwf CVD4,F > movlw D'3' > addwf CVD5,F > > > ; for bit 2 .78125 > > movlw D'7' > addwf CVD3,F > movlw D'8' > addwf CVD4,F > movlw D'1' > addwf CVD5,F > > > ; for bit 1 .390625 > > movlw D'3' > addwf CVD3,F > movlw D'9' > addwf CVD4,F > movlw D'1' > addwf CVD5,F > > > ; for bit 0 .1953125 > > movlw D'1' > addwf CVD3,F > movlw D'9' > addwf CVD4,F > movlw D'5' > addwf CVD5,F > > > ; max value a/d is 199.805 > > ******** end of code ********** > '. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist