Hi CagDask,
Thanks for the post.
I ended up using a combination of PBC and assembler.
I put bit multipliers into eeprom and read them based on a bit test for each of the 15 bits. All values greater than 999 go into W2 and all above that into W3. I'm reading the serial data in at 57.6K also with an assembly routine and 20Mhz crystal.
Here is one of the routines.( W2 collecting Mhz & Khz ) from byte 3. (the one that is has 65536 as its multiplier). I played around with simple division, but I kept loosing remainder values and with them resolution, so this seemed pretty easy. Its basic double precision addition in assembly, with each bit multiplier value being read from eeprom. W3 >= 1000 carrys into W2 and I'm getting really good resolution.
Code:B0 = 0 'start of eeprom B15 = B12 'take copy of byte 3 into B15 W2_B12: B1 = B0 + 1 Read B0,B2 Read B1,B3 IF B2 = 0 AND B3 = 0 Then exit_W2_b12 asm btfss 47,7 ;ram 47 = B15 ;if the bit is high add its multiplier GoTo NO_W2_B12 movf 34,w ;ram 34 = B2 which now has LSB from eeprom addwf 36,f ;add this value to ram 36 = W2.LSB btfsc 3,0 ;check status register carry bit incf 37,f ;if carry occured, increment ram 37 which is W2.MSB movf 35,w ;ram 35 = B3 which now has MSB from eeprom addwf 37,f ;add MSB to W2 NO_W2_B12 rlf 47,f ;rotate B15 left one bit ENDASM B0 = B0 + 2 GoTo W2_B12 exit_W2_b12:




Bookmarks