Presuming you entered the number highest first 1,2,3,4 for the number 1234, you array will hold the numbers 1,2,3,4 with 1 being at element 0 of the array.
The following code will convert the array to a Binary number.
For it to work the pointer has to be pointing to the last element of the array that holds a number. This is often the case on exiting the routine that loaded the array.
Example Code
Code:
Dim Multiplier as Dword Dim Result as Dword Dim Pointer as Byte Multiplier = 10 ' The starting multiplier value Result = Array[Pointer] ' Load in the lowest digit Repeat ' Loop Dec Pointer ' Move to next element Result = Result + (Array[Pointer] * Multiplier) Multiplier = Multiplier * 10 ' Increase the multiplier Until Pointer = 0


Menu
Recent Articles


Using PDS with SPI GLCD based on ST7565R Controller
Graphic LCDs based on the ST7565 are cheaper then GLCDs with other controllers. SPI requires only four pins. If the circuit