![]() |
Forum Index : Microcontroller and PC projects : Format text for display on LCD
Author | Message | ||||
Glen0 Regular Member ![]() Joined: 12/10/2014 Location: New ZealandPosts: 95 |
I have been trying to display the temperature from an MCP9700 to an SPI LCD as seen in the attached photo. The code below shows what steps and variations I have been trying. 'Temperature from MCP9700 and ADC test SetPin 34, Ain Do A = Pin(34)-0.535 A1 = A*100 A2 = val (Str$ (A1, 2 ,1)) 'A3 = VAL (A2) 'print A3 'Print str$ (A1, 2, 1) 'Z = Val(STR$(A,2,2))*100 TEXT 100, 70, str$(A2), CM, 6, 1, RGB(CYAN), DBlue Pause 600 Loop All is well until the displayed temp reaches exactly 20, for example, it then leaves "artifacts", (for lack of a better term,) of the previous temperature. I can get it to work fine if I don't display any decimal but as soon as I try to display 1 decimal point I have this problem. What am i doing wrong in my code. Can someone please give me a snippet of code showing how to take an ADC reading and display it to 1 decimal point. I am trying to avoid using CLS as much as possible, because the flashing is annoying. MCP9700 test.zip Cheers |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Try A2$ = Str$ (A1, 2 ,1) TEXT 100, 70, a2$, CM, 6, 1, RGB(CYAN), DBlue VK7JH MMedit |
||||
Glen0 Regular Member ![]() Joined: 12/10/2014 Location: New ZealandPosts: 95 |
Thanks Jim, perfect. It's all about where you put your mighty $ :-)) I need to get used to strings, values, integers etc. Turnaround on this forum is marvellous. Cheers Edited 2022-07-14 07:34 by Glen0 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |