Download PB PICBASIC user's manual
Transcript
PICBASIC DATABOOK DEC () DEC (value, position, parameter) Convert into Decimal string Value is a Byte/Integer/Long constant/variable. Position is the maximum length of position. (Up to 10. Default is 5. Constant only) Parameter is a constant (0 or 1 only) indicating to display “0” in front of a converted string or not. (0=shown, 1=not shown. Default is 1.) EXPLANATION This instruction converts constants/variables into decimal string. PB series can use this instruction only for in PRINT instruction. PBM series can store the result of DEC() instruction in a String variable. EXAMPLE The following table shows the result of instructions including DEC when variable A has 12345. (b is space) Instruction Result PRINT DEC(A) 12345 PRINT DEC(A,10) bbbbb12345 PRINT DEC(A,10,0) 0000012345 PRINT DEC(A,3) 345 PBM series can store the result of DEC() instruction in a String variable as follow. DIM ST AS STRING * 16 DIM I AS INTEGER I = 1234 ST = DEC(I) + “5678” COMFILE Technology ‘Declare 16 the maximum length of string ‘Conjunct strings ‘The result, 12345678, is stored at ST 69