DIG command causes a syntax error

mikepanchaud

New Member
Hi,

The code below runs OK when the Picaxe type in the emulator is set to 20X2 or higher
BUT, returns a syntax error if the Picaxe type is set to 08M2 !?

I'm running the latest emulator version 6.0.8.0.

What am I doing wrong?

Thanks in advance.

Mike.


Code:
LET b0=247

LET b1 = b0 DIG 0		' returns units digit
LET b2 = b0 DIG 1		' returns tens digit
LET b3 = b0 DIG 2		' returns hundreds digit

' DIG returns a BCD digit
' b1 = 7
' b2 = 4
' b3 = 2

' This code runs OK when the picaxe type in the emulator is set to 20X2
'BUT
' returns a syntax error if the Picaxe type is set to 08M2  !?
 

srnet

Senior Member
Hi,

The code below runs OK when the Picaxe type in the emulator is set to 20X2 or higher
BUT, returns a syntax error if the Picaxe type is set to 08M2 !?

I'm running the latest emulator version 6.0.8.0.

What am I doing wrong?

Thanks in advance.

Mike.


Code:
LET b0=247

LET b1 = b0 DIG 0		' returns units digit
LET b2 = b0 DIG 1		' returns tens digit
LET b3 = b0 DIG 2		' returns hundreds digit

' DIG returns a BCD digit
' b1 = 7
' b2 = 4
' b3 = 2

' This code runs OK when the picaxe type in the emulator is set to 20X2
'BUT
' returns a syntax error if the Picaxe type is set to 08M2  !?
The manual says on page 22;


The X1 and X2 parts also support
<< ; shift left
>> ; shift right
*/ ; multiply (returns middle word of result)
DIG ; return the digit value
REV ; reverse a number of bits
 

mikepanchaud

New Member
Hi,

Thanks for that info.

Here's my solution for the 08M2


Code:
LET b0=247

LET b1 = b0//10		'b1= units

LEt b2 = b0/10
LET b2 = B2//10 		'b2 = tens

LET b3 = b0/100		'b3 = hudreds
LET b3 = b3//10
'  // = modulus divide
 
Top