bill Posted July 20, 2006 Report Posted July 20, 2006 do not exist ;)Well, i'm very interested in this function, but as i have allready wrote, i not a asm person.I've located the MIOS_AIN_Pin7bitGet function in src/mios_ain.inc;; -------------------------------------------------------------------------- ;; FUNCTION: MIOS_AIN_Pin7bitGet ;; C_DECLARATION: unsigned char MIOS_AIN_Pin7bitGet(unsigned char pin) ;; DESCRIPTION: returns 7-bit value of AIN input .... ;; -------------------------------------------------------------------------- MIOS_AIN_Pin7bitGet andlw 0x3f lfsr FSR1, MIOS_AIN_RESULT_L_00 addwf FSR1L, F movff INDF1, MIOS_PARAMETER1 bsf FSR1L, 6 movff INDF1, MIOS_PARAMETER2 ;; note: a multiplication would work faster, but would overwrite PRODL/PRODH rrf MIOS_PARAMETER2, F rrf MIOS_PARAMETER1, F rrf MIOS_PARAMETER2, F rrf MIOS_PARAMETER1, F rrf MIOS_PARAMETER1, W andlw 0x7f movwf MIOS_PARAMETER1 returnBut i'm dont know how to understand it :-\Can a clever person tell me what to change ? (i suppose it must be pretty simple)Thanks !!! Quote
TK. Posted July 20, 2006 Report Posted July 20, 2006 Just remove the two first (!) rrf's + the "andlw 0x7f"Best Regards, Thorsten. Quote
bill Posted July 20, 2006 Author Report Posted July 20, 2006 Wow, so fast ! Thanks :)So, is it a good idea to add it into mios_ain.inc or should i use the function as 'standalone'If i want to add it to MIOS, what changes should i do to the mios_vectors.inc ???Thanks Quote
TK. Posted July 20, 2006 Report Posted July 20, 2006 Never add such custom functions into MIOS, it makes your application incompatible.Just write the function into a seperate .c or .asm or .inc file, this can be distributed very easily.On the other hand: in my own applications, I don't call functions for such special conversions at all. I mostly do the conversion directly, which is faster.In C you only need to write "value >> 2" to get the same effect, so why creating a function?Best Regards, Thorsten. Quote
TK. Posted July 20, 2006 Report Posted July 20, 2006 P.S.: see map.h of the "analog_toolbox" application Quote
bill Posted July 20, 2006 Author Report Posted July 20, 2006 In C you only need to write "value >> 2" to get the same effect, so why creating a function?I did not think about it ! ( i'm still new to ">>" ;) )i did not think about the compatibily too, but hey, you are definitely right !I guess it's a newbe behavior : no to see the obvious.Thanks a lot !!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.