Log in

View Full Version : MASM error 202 argument out of range



retepsnikrep
- 28th October 2011, 08:26
I'm working with pbpro 3.01 and a pretty big program ~ 7000 words using the 16F886 and I get the below error x 2.

"error 202 argument out of range, Least significant bits used."

Do I need to worry? The program compilies correctly :?

Dave
- 28th October 2011, 11:41
If I were you I would look at the .lst file for the compiled program and find the instance "argument out of range". This will tell you what variable is the incorrect size you are trying to pass. Yes it could make for some unintended operation....

retepsnikrep
- 28th October 2011, 17:59
Trying to pass. Yes it could make for some unintended operation....

Trying to pass?

I don't have any assembler routines in my basic code.

retepsnikrep
- 28th October 2011, 18:18
The error seems to relate to this code.



HChkSum = $E4 + $06 + $02 + ImaMem + RL 'Calculate Read Chksum
HChkSum = $100 - HChkSum 'Calculate two's complement


HChkSum is a byte variable and I assume must be overflowing as the additions take place or when we try to subtract 100H from it.

rsocor01
- 28th October 2011, 20:37
Try using decimal 255 in your formula instead of $100. The hex number $100 is equal to decimal 0001 0000 000. This might be a problem with your byte variable.

Robert

rsocor01
- 28th October 2011, 21:38
Try using decimal 255 in your formula instead of $100. The hex number $100 is equal to decimal 0001 0000 000. This might be a problem with your byte variable.

Robert

I meant $100 equal to decimal 0001 0000 0000. Missed a zero.

retepsnikrep
- 29th October 2011, 08:06
100H = 256 though not 255 so won't that give the wrong checksum?

It's two's complement asfaik. Not that means a great deal to me anyway Doh!

retepsnikrep
- 29th October 2011, 09:11
Here is an example checksum with correct result. $04,$06,$04,$FF,$00,($F3 = CS)

rsocor01
- 29th October 2011, 09:14
Oh, I see what you mean. Anyways, I'm almost sure (I haven't tested it though) that combining your 9 bit number ($100) with your byte variable is what is causing the overflow problem. You might need to find a workaround.

Good luck.