this is no good... how do I properly import FORMATTED code ?? ??
tommy
Posts: 84
testing the import of code...
·this is not satisfactory - I had to manually space the remarks - tabs are not accepted, (neither is indentation with spaces...)·· and if I want to color the remarks I have to color each line individually...· and every time I try to make it more clear with a space, a line appears where I have hit the·ENTER key.
·there MUST be·a better way ? ?
tommy
Post Edited (tommy) : 3/7/2007 3:45:31 AM GMT
·this is not satisfactory - I had to manually space the remarks - tabs are not accepted, (neither is indentation with spaces...)·· and if I want to color the remarks I have to color each line individually...· and every time I try to make it more clear with a space, a line appears where I have hit the·ENTER key.
·there MUST be·a better way ? ?
tommy
PROCESS_THE_16_READINGS ;--- ; absolute zero - 1000 1101 0010 0111 - 8D27 Hex - [noparse][[/noparse]-459.4 x 64] (two's compliment) ; starting addition - 0111 0000 1000 0000 - 7080 Hex - [noparse][[/noparse] 450 degrees x 64] - half the total scale. ; ; this is binary-fahrenheit from a centigrade device with a scale of 5 volts.
-459.4 = 0 volts, +440.6 = 5 volts - no further conversion necessary. Upper and lower limits would destroy the machine, so they are used only as a starting point for the math... ; during calculation, all numbers multiplied by 64 (because we had handy, unused zeros on the left and now can use only two bytes (including the fraction))... we will divide by 64 a little later. ; MOV FSR,#84 MOV IND,#$70 [color=green];msb 450 degrees (x 64)[/color] [color=green];fsr 83 - value to add each loop - lsb [/color] DEC FSR [color=green];fsr 84 - value to add each loop - msb [/color] MOV IND,#$80 ;lsb 450 degrees (x 64) ;--- MOV FSR,#86 ;final answer - starts now at -456.4 ;fsr 85 - final answer lsb MOV IND,#$8D ;fsr 86 - final answer msb DEC FSR MOV IND,#$27 ;ready for twelve additions ;--- MOV FSR,#82 ;msb of 16 samples MOV MSB,IND ; in lower, convenient memory DEC FSR ;lsb of 16 samples MOV LSB,IND ; in lower, convenient memory MOV CX,#12 ;
MOV CX,#12 ADDITION_LOOP ;1st loop - add 450 if nec. 2nd loop - add 225 if nec, ; ;3rd.loop - add 112.5 / 56.25 / 28.125 / 14.0625, ;7.031 / 3.516 / 1.758 / .879 / .439 / .220 CLC RL LSB RL MSB ;1st pass - a 450 degree bit... rotated into the carry ; SC JMP PREPARE_4_NEXT_LOOP ;- MOV FSR,#83 ;lsb of the ever-halving 450 degree value... MOV W,IND INC FSR ;to 84 INC FSR ;to 85 ADD IND,W ;** - add it to lsb of final answer ; MOV FSR,#84 MOV W,IND INC FSR INC FSR ;to 86 SNC INC IND ;carry from ** above ADD IND,W ;-- PREPARE_4_NEXT_LOOP ; MOV FSR,#84 ;2nd pass temp = 225 degrees, then 112.5, then 56.25 CLC RR IND ;simply by shifting bits... DEC FSR ;fsr 83 - value to add each loop - lsb RR IND ;fsr 84 - value to add each loop - msb
DJNZ CX,ADDITION_LOOP ;----
Post Edited (tommy) : 3/7/2007 3:45:31 AM GMT
Comments
If you're using the evil Internet Explorer, the forum data entry screen permits a lot more formatting options than I get with Opera, for example. And you might be able to accomplish what you're trying to do by copying and pasting, possibly making a detour through Word to get it right.
-Phil
Update: In the SX forum I've posted a thread on this subject and included the address of a public formatter that will convert SX code into something that can be posted.
Post Edited (Phil Pilgrim (PhiPi)) : 3/7/2007 5:25:59 AM GMT
. thanks Phil...·· I finished my "indoor/outdoor" thermometer for the almost blind --- (actually it's for me - I can no longer see the 3/4" 7-seggies on my clock across the room) --- and the completed projects post says to post code if it's interesting...·· well, I used a centigrade LM134, but never had to convert from centigrade (because the LTC1298 had already converted it to "4096ths of 5-Volts" - so why go back), and maybe that's interesting, and maybe not...
. you hint that it may be·tricky to post readable code --- yes indeedy, I'll read where you've pointed.
. on my main computer (well, there's not as much to do with MS-DOS anymore) I'm still using EDLIN. -- my sister named her dog, "EDLIN" because she thought the name was cute - but everyone else (who's old enough) just laughs...·· Hint for you young kids - it was written in the 70's, before computers had color...
. thanks, Phil - I'll find your thread in the SX column --- I had looked, but here, in the "how-to" column...