Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I checked it but I didn't find something releated to converting numbers
This tutorial reads a single channel of the A2D converter and displays it on the LCD. First the program sets up the registers explained above, then the rest of the program runs in an endless loop. It reads the analogue input, which gives a value from 0-$3FF (in hexadecimal), then calls a routine which converts that to decimal, giving 0-1023 (representing 0-10.23V). Lastly this decimal value is displayed on the LCD, followed by a space, and the same value in hexadecimal. The program then wait for 100mS and jumps back to the start of the loop and runs again, this gives roughly 10 readings a second.
MOVF ANSWER,W
CALL LUTABLE
.
.
.
(FAR FAR AWAY IN MY CALL ROUTINE SECTION)
LUTABLE
ADDWF PC,f
CALL NUM0
RETURN
CALL NUM1
RETURN
CALL NUM2
RETURN
CALL NUM3
RETURN
...
..
..
..
CALL NUM9
RETURN
I'd bet it's a safe assumption that Nigel's method will be better than mine, but here's what I do with an 8 bit number -- I'm sure you can adapt it to a 16 bit number easily.
????
Tutorial 11.1:
The code is in the ZIP file at the top of the page.