Address instead of contents
Tapperman
Posts: 319
3_Phase_Motor_v3c.spinSin Table Generator for Motor Table.xls
I get the address of the long in COG Ram (I think) instead of the contents of the table location.
Any ideas what I could be messing up on?
... Tim
_Set3Phase rdlong temp2, ARG_0 ' get X position in table mov temp, #Mtr_Table ' get address of Mtr_Table add temp, temp2 ' point at x entry mov T_On__Ch + 10, temp ' set OnTime from Table <-- Bug wrlong temp, ARG_0 ' debug line mov temp1, Max_Duty ' get max duty sub temp1, temp ' get difference mov T_Off_Ch + 10, temp1 ' write the off time wrlong temp1, ARG_1 ' debug line
I get the address of the long in COG Ram (I think) instead of the contents of the table location.
Any ideas what I could be messing up on?
... Tim
Comments
BTW, there always needs to be at least one instruction between a statement that modifies another instruction and the instruction that it modifies.
-Phil
Thanks ... that did the trick!
[video=youtube_share;F5uWjCAjpfQ]
... Tim
... Tim
The wealth of experience around here really paves the way for others to quickly use the Propeller. Thanks Phil for the help, too.
Ken Gracey
-Phil
Thanks for responding so quick! If you don't mind ...I have a follow-up question:
Ok, I have to adjust the destination add in the RDLONG instruction. But, why do you add 512 to the code pointer, and not add 1 to the DST address?
-Phil
So the MOVD modifies the field bids 17..9 of any long (in COG ram). In this case it happens to be an instruction code.
So you were actually combining two steps into one. And that’s what I did not see. Thank you for clearing that up for me.
Had I coded it my way, I would have added one to the destination address, followed by another MOVD op-code.
So by adding 512 to the op-code, do you also have the pipelining issue that exists for the MOVD op-code?