mov truncation problem using sx/b asm function
I am using the sx28 to generate a pulsetrain. I need it to run faster than 500 Hz, so I created my own delay routine using assembly and the asm command in the sxb compiler. My problem is that the assembly mov command truncates my word size variable to a byte. I can have two word sized variables and have the source be larger than 256, but then when I check the value of the destination it is 256. I get no errors or anything. I have to force a literal mov, with the source greater than 256 to get a truncation warning.
This is perplexing to me, because from what I remember and have read, the assembly mov command should have no problems handling a word size variable. I am wanting to generate a variable frequency pulsetrain and having a word size variable would be of great benefit. I was wondering if there is a patch or some fix to this problem. Like I said, I would like to fix this problem, but I can work with the bytes if necessary.
Thank.
BC Baker
This is perplexing to me, because from what I remember and have read, the assembly mov command should have no problems handling a word size variable. I am wanting to generate a variable frequency pulsetrain and having a word size variable would be of great benefit. I was wondering if there is a patch or some fix to this problem. Like I said, I would like to fix this problem, but I can work with the bytes if necessary.
Thank.
BC Baker
Comments
In assembly you will have to work with two separate bytes. You must be remebering incorrectly; there is no concept of a WORD with the MOV instructions. Everything works through the W register, and that is 8 bits.
Cheers,
Peter (pjv)