__PARAMCNT or __PARAMn value corrupted on user defined function
I am trying to use my micromega fpu. My hardware is setup and I have established communication with the fpu. Unfortunately, I have a problem using either a subroutine or a function to write to the fpu inside of my main loop. It seems that either my __PARAMn values or __PARAMCNT gets corrupted somehow because my sx fpu function leaves out the ARG and only passes an OPCODE to the FPU. Has anyone had experience with user defined functions going haywire like this.
Post Edited (slcott) : 12/30/2009 1:44:59 AM GMT
Post Edited (slcott) : 12/30/2009 1:44:59 AM GMT

Comments
It looks like you ARE copying them to other variables, so it should work.
If you could post the whole program we could help more.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropBASIC home page www.propbasic.com
·
FUNC Fpu_Write tmp1 = __PARAM1 if __PARAMCNT = 1 then Fpu_SPI_Write tmp1 else tmpCnt = __PARAMCNT tmp2 = __PARAM2 tmp3 = __PARAM3 tmp4 = __PARAM4 Fpu_SPI_Write tmp1 Fpu_SPI_Write tmp2 if tmpcnt < 3 then Fpu_Write2 Fpu_SPI_Write tmp3 if tmpcnt < 4 then Fpu_Write2 Fpu_SPI_Write tmp4 endif Fpu_Write2 return ENDFUNC FUNC Fpu_Write2 return ENDFUNCIn the above, the line "if tmpcnt < 3 then FPU_Write2" will NOT call the function, it will GOTO the function, then return, without executing following code. You may want to break some of your code into very small testable piece and make sure each piece is OK before working the pieces into a larger program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php