LCD READOUT

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

LCD READOUT

Post by siliconchip »

hi all,
ive made the beginnings of a resistance meter i would like to display when below 1K with the reading and the ohm sign which ive done and if the reading goes over 1K the the "K" shows a digit before the ohm sign which ive sort of done trouble is on power up with no reading taken the display shows 0.000K ohm where id like the K at this point to disappear until over 1K, it may be an easy fix but im struggling to find it thanks in advance

bob
Attachments
MVB ACCURACY.fcfx
(13.76 KiB) Downloaded 203 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

Hi Bob,
What I would do is remove both

Code: Select all

Cursor 13,0
components.
Then I would move the

Code: Select all

PritntAscii(0)
to the no branch of if R>1000
One thing is if you look at the datasheet for the Hitachi LCD, you can see that the ohms symbol is built in.
Therefore you can use

Code: Select all

 PrintAscii(244)
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

Hi martin
thanks for the reply, thats handy to know about the lcd character, it seems i tried everything other than what you suggested guess i spent too long chasing my tail, ive now made the changes but when going to the K readings i lose the ohm character, i tried to remedy this by adding another AScii below the K in the yes branch of R>1000 but when i go back to the low readings i lose the K and gain another ohm character, :oops: :oops:

bob

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

Hi Bob,
siliconchip wrote: i tried to remedy this by adding another AScii below the K in the yes branch of R>1000 but when i go back to the low readings i lose the K and gain another ohm character,
Just below the ohms symbol in no branch, just add a printString " "
So you are just printing one space.
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

hi martin,
the changes have had the desired effect although there are a couple of lcd quirks, first off in simulation the program works as intended but on hardware if no resistance is being measured the display shows 0.0000kohm if a resistor below 1K is measured the K disappears if over 1K it returns, in simulation the K only appears when measuring 1K or over, secondly i got a bit more adventurous and added a please insert caption if no resistance was being measured once inserted the resistance is read again in simulation works great but on hardware the please insert caption does not appear,ive tried changing the decision box from if R<=0 then used variable read in the same fashion but no difference is there some sort of discrepancy between simulation of the lcd to hardware thanks in advance

bob
Attachments
MVB ACCURACY MK2.fcfx
(14.24 KiB) Downloaded 198 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

Hi Bob,
Where Float is concerned you don't want

Code: Select all

 If R <=0 
That is because the float value after calculation could be 0.0000002
As that is greater than zero, result will always be false.
You won't see the 2 at the end in your display as it does not show that many decimal places on LCD.
Its easy to fix. Just use something like

Code: Select all

If R <=0.01
instead.
The reason works with simulation is the calculated result is probably 0.00000
Not sure how many decimal places it uses, Matrix staff would no more on that.
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

hi martin,
i adjusted R<=0.01 but no joy even went back as far to 0.000000000000001 but again no joy ??

bob

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

Hi martin,
Just a thought but with my displaying showing 0.000kohms when notvmeasuring is this like an infinite resistance as the display shows the K sign which makes me think the code is going on the yes branch of R >than 1000 bit like a multimeter on resistance not connected to anything ie displaying O/L or O/C ???

Bob

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

Something not right as if the 0.000 is showing then K should not be accessed.
I have modified for testing purposes.
With no resistance present, can you let me know what the bottom line displays?
Attachments
MVB ACCURACY MK2a.fcfx
(14.37 KiB) Downloaded 174 times
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

hi martin,
top line shows value = 0.0000kohm

second line shows 0.000000

bob

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

Do you have a full schematic?
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

Hi martin
Have got proteus by labcenter

Bob

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

I have that as well, v8.7 sp3.
Unable to afford any updates since then.
If you want to keep it private you can PM it to me?
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

hi martin,
here it is i had to send as a pdf as it said proteus was an invalid file

bob
Attachments
READ RESISTOR..pdf
(20.75 KiB) Downloaded 137 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

Its needs to be within a zip file.
Looked at the schematic, can you try the updated version please.
Attachments
MVB ACCURACY MK2b.fcfx
(13.59 KiB) Downloaded 146 times
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

hi martin
this is a lot better thanks,from power up please insert shows, if a 470 ohm resistor for example is tested "PLEASE INSERT" disappears and value = 471.218963 ohm appears, however if the resistor is removed please insert comes back up followed by the last 3 digits of the previous read ie 63 ohm, if a 4.7k resistor is used the digits go off the end of the display, i tried adding print string " " on the yes decision of R >99000 which seems to work and clear this however its showing to many digits and losing the ohm sign when reading above 1K. so from here i added AScii 244 on the yes branch of R>1000, then to cut the number of digits i edited string variable resistance from 16 to 6 if i go to 5 then the T from insert always shows with a measurement, it seems to work well now in hardware,but could you explain the R>99000 decision as i dont understand this, also is the macro "RESULT" redundant

bob

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

siliconchip wrote: please insert comes back up followed by the last 3 digits of the previous read
After PrintString "Please Insert" add a few spaces after last letter.
E.g "Please Insert "
Glad its working better.

Regarding the >99000 as you was right about the over-range.
The Float would be so high it looks like causing an issue with float to string.
Therefore it looks like its zero, but in reality its far greater.
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: LCD READOUT

Post by siliconchip »

hi martin,
thanks for you time and patience on this to say it was doing my head in was an under statement, and as always you pointed me in the right direction, this is only a small part of a project im working on which is to test 3 lines on a multi vehicle bus line, i appreciate all your help because without it i would find writing code difficult to carry on, i hope matrix recognise your dedication helping people like myself, pity i cant buy you a pint, once again many many thanks, :D :D :D

bob

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LCD READOUT

Post by medelec35 »

Hi Bob,
You're welcome.
It just takes me a bit long if not got the hardware to test it on.
Hopefully your hardware will work as expected. :)
siliconchip wrote:i hope matrix recognise your dedication helping people like myself
Yes they do, as they have been very good to me in the past.

To you and everyone reading this, stay safe.
Martin

Post Reply