`DIG` Command + Serial out Commands

retepsnikrep

Senior Member
I've seen this mythical `DIG` command mentioned in few threads for the x1 parts but can find no referrence to it in the Basic Manual :confused:

Does it exist?

What does it do?


Also

I have a line of code for

serout LcdVideo,N2400,(254,1) ;Clear Lcd Display

Pretty straightforward, but can I replace the 2400 with a variable?

i.e.
w0 = 2400
serout LcdVideo,Nw0,(254,1) ;Clear Lcd Display

I want to use the serout command in a subroutine and pass the speed to the routine as I'm talking to different devices which need different speeds.

I don't want loads of lines of serout commands if possible.

Thanks
 

eclectic

Moderator
retep

DIG Man 2. p.21

DIG
The DIG (digit) command returns the decimal value of a specified digit (0-4,
right to left) of a 16 bit number. Therefore digit 0 of ‘67890’ is 0 and digit 3 is ‘7’.
To return the ascii value of the digit simply add ascii “0” to the digit value e.g.
let b1 = b2 DIG 0 + “0”
See also the BINTOASCII and BCDTOASCII commands.
 
Top