Dc voltmeter 0-55v

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Test5b also displays a decimal point on seg3 which it shouldn't be but anyways I can go with Test5a but my question is coz I have to make another pcb with a bigger chip like the 16F886 for all my code to fit in there question is will have to do the same in 16F886 or there is something to change?
Attachments
IMG_20200415_123341_925.jpg
IMG_20200415_123341_925.jpg (95.23 KiB) Viewed 13602 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

And I very much want to learn the tricks you used don't understand the numbers in TmrMultiplex switch what they actually mean and another thing there is no seg3 in TmrMultiplex macro yet the code works even for seg3 how did u do this?

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

I think I will have to go with Test5a coz Test5b looks complicated tho I want to learn this is completely off the map I've lost track need to learn this.

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: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:Test5b also displays a decimal point on seg3 which it shouldn't be
The decimal point is a nice easy fix.
In the same interrupt macro, you place an output 0>B7 (Clear single bit B7) in the top switch branch (2) for

Code: Select all

MPXState
:
Fix decimal point.png
(11.64 KiB) Downloaded 649 times
Derrihj wrote:coz I have to make another pcb with a bigger chip like the 16F886
Why don't you used a 16F1847?
Should be a direct replacement to the 16F88 and it has the same amount of memory as 16F886.
Saves making another PCB!
Derrihj wrote: another thing there is no seg3 in TmrMultiplex macro yet the code works even for seg3 how did u do this?
Yes there is, it's in the same branch as the image.
All 5b is doing is setting the output pins on the ports to be high or low, to make each LED of segments light up at the correct time.
This was only created in case the 7seg components did not work.
Prior to you testing, was all just theory in my head.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Am going to go with Test5a tho Test5B works best it has no half lit LEDs and the decimaal on leg3 is now gone after your changes to clear B7 but it's complicated LEDs are lit very well but for Test5a if you look at seg1 and seg2 for example when it is displaying 12.2v there some LEDs that are slightly lit not so much but doesn't make the display look cool for a low sight person and even the dicimal point on seg3 is half way lit which shouldn't at-all all seg3 LEDs are lit very well with no half way lit LEDs that shouldn't be lit at that time only it's decimal is half way lit.when you display 1 on seg1 only LEDs C and B should be lit but you find that LEDs A , D , E and G are half way lit too which is the same case for seg2 when displaying nunber2 only LEDs A , B , D , E and G should be lit but also led C is half way lit.Am talking about Test5a.and should I do for the decimal on seg3 this time for the Test5a case.Thank you
Last edited by Derrihj on Wed Apr 15, 2020 11:44 am, edited 1 time in total.

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: Dc voltmeter 0-55v

Post by medelec35 »

If the decimal point is lit in seg 3, then place the 0>B7 in the same place as you need to if it was 5b
as for the dim LED's could be 2 reasons.
1 reflection of light from other LED's
2 still looks alight due to persistence of vision.

Have a play with the timer 0 interrupt time and see if that improves things?

I will see if I can improve on 5a, so it might even work in simulation as well.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

This conversation is not over yet Martin don't even think for a second that it's over there is allot to learn from you the numbers in Test5b are troubling my head need to know what they mean but even i don't know how to thank you coz you have delivered me from the worst nightmare

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: Dc voltmeter 0-55v

Post by medelec35 »

Two more to try.
I made a mistake with original 5a.
Hopefully, one of these will work better?
Attachments
Test only 5a.fcfx
(28.72 KiB) Downloaded 189 times
Test only 5a1.fcfx
(27.84 KiB) Downloaded 194 times
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

This is so cool i think it's time for me to learn about the numbers in TmrMultiplex macro of Test5b if you have some more time Mr Martin.

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: Dc voltmeter 0-55v

Post by medelec35 »

If we take any random number, for example 3, then we need to have 0V on the cathode of the display that needs to show the 3, the other two displays then need to be off, have the cathodes at +5V
The Anode segments that need to be on for the number 3 is a, b, c , d & g
So for seg a to be lit RA = 1 , for seg b to be lit RB4 = 1, for seg c to be lit RB6 = 1, for seg d to be lit RA6 = 1 & finally for seg g to be lit RB5 = 1

They are the individual bits.
It will be a pain just to have individual bits for each number 0 to 9, so the whole port is used.
We work out what the the port has to be by 2 to the power (^) of each bit, then add then up to get a total.
For each bit with say port A:
RA1 = 2^1 = 2
RA6 = 2^6 = 64
64 + 2 = 66

Port B:
RB4 = 2^4 = 16
RB6 = 2^6 = 64
RB5 = 2^5 = 32
16 + 64 + 32 = 112

Now you know how the port values are calculated.
Note when using the output for the whole port, it's vital to select Use Masking and only tick the bits you are using for the outputs.
E.g for portA with your hardware:
Port Masking.png
(25.62 KiB) Downloaded 635 times
Did either of the latest 5a's work better and is 5b fully working with decimals in the correct place etc?
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

I have used only 5a so far but I've changed it a little and it's working fine i removed Timer0 and it's count and transferred TmrMultiplex macro to be called into Timer2 interrupt and i set the interrupt frequency to 200 Hz and it's working well. With fairly reduced half lit LEDs am going to study 5b first Little by little till i get it right in my little head thanks Martin this is a big day for me am really happy.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

But to study this well i need to get to the bottom side of it and know why all the other way that i had planned it before you came in didn't workout what was really the problem coz for you to see this you first tricked it with a 123 in one sec then u realized the problem what was it is a good question for to learn this faster.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Thanks for the chip 16F1847 i need to find it but will have to order it from China can't get it here in Uganda .

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: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:Thanks for the chip 16F1847
Your welcome.
I don't think its worth changing size of micro just for more memory.
They are normally changed when more IO's are required.
So do you now fully understand what is required from software to make the hardware function normally?
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

No i will have more questions just because I've been busy with house work haven't really got to look into the code but i put up a question for you check above before your recent reply other questions will come in after I go through Test5b.Thanks for the good heart to teach Martin.

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: Dc voltmeter 0-55v

Post by medelec35 »

Good news.
Ben has updated the quad and single displays so it should now work on your hardware.
I suggested it here as its common looking on the internet, to connected common cathodes the way you have.
After loading attached flowchart, just make sure you select help, check for updates.
Personally I like to change files in use to full database.
Attachments
Test 6.fcfx
(23.08 KiB) Downloaded 142 times
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Ok cool as i was going through your replies I found out that you had already answered my question as to why it didn't work out in the first place, thanks to Benj if he corrected that hope it will help many people out there who will need to use the 7seg display and not to go through the hardships we have gone through.Thanks to all of you guys for the hard work.Stay safe through this covid19 lock down till everything stabilises back to normal.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Was the common anode 7seg safe as all the output is low to activate the common? Just asking as this question won't be useful after Benj's update

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Was going thru your Test5b but haha calculating each number from 0-9 to choose from based on the switch MPXstate number was a very nice interesting trick Martin what i still don't understand was the red Dot and what it does but theoretically I've got what the numbers mean very Bright trick there.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

You said you can make the simulation possible too Martin before i do the update i would love to see this too as i can learn something from it never know coz finally Tes5b turned out to be interesting though i had to remove the switch with the red Dot and replaced it with a new one and also removed the Is sim and it worked very well too but pliz before this conversation ends would love to see it simulation work if you don't mind Martin..

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: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:but theoretically I've got what the numbers mean very Bright trick there.
Thank you
I created an excel sheet (attached) to automatically calculate the output values required,
depending if you set a to g on each segment on the sheet to 1 or 0.
Did that to minimise mistakes as you see the 5B with number 2:
Results for digit 2.png
(6.19 KiB) Downloaded 556 times
That is automatically generated on entering the 0's and 1 for each number.
I then referenced the 5B against the values shown an a diagram:
Hex values.png
(22.71 KiB) Downloaded 556 times
I won't show all, as image could be copyrighted, but it can be found here.
Derrihj wrote:what i still don't understand was the red Dot and what it does
During simulation the Flowchart will stop at the red dot every time as its a breakpoint.
Right click and select toggle breakpoint to clear or set it.

I mentioned the schematic in a earlier post and you said you just created a PCB.
Without a schematic that is very impressive.
For future projects I would recommend a free Schematic design package called Kicad.
I use it for all my projects.
Attachments
7seg Conversion for forums.xls
(21.5 KiB) Downloaded 118 times
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Just finding the numbers needed to display like 0,1,2 upto 9 and Boom just look at the resultant number generated for a used port so that someone does not need to calculate anything just look for the number u need to display and you are good to go,Martin this is so good you have simplified the 7seg that proved to be big headed in the first place wawo i will be using Test5b for my 7seg soon as i get the 16F1847 the only thing am still trying to figure out is the CHECK column if you can explain that a little.

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: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:the only thing am still trying to figure out is the CHECK column if you can explain that a little.
Best way to see how it works is enter own binary values and follow what happens.
For example, following the link on the above post, lets look at the table for producing the letter E instead of a number as the display could be used to indicate E for voltage error:
Hex for E.png
(10.2 KiB) Downloaded 528 times
Looking on the right for the hex value it's 79. Ignore seg h that is the decimal point.
Where the spreadsheet is at top is showing 0 for Dec num req>, just fill in the binary underneath of Enter 0 or 1i.e new values for E here:
Binary for numer 0.png
(7.04 KiB) Downloaded 528 times
for each segment a to e. so you should have:
Results for displaying E.png
(5.09 KiB) Downloaded 528 times
The 79 shown on the sheet matches the 79 on the table for E.
As that is correct you can then use the two values for PortA & B = 192 & 32 respectively
Give one a try yourself, what are the correct values for port A & B for the Letter F?
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Thanks allot Martin for all the info for which I've been able to come up with some words on the 7seg that am going to use in my simple 17Ah battery charger,these words will be flashed on and off together with the current battery voltage in an interval of 5 seconds for each that is (word and voltage) words like CHA ( to stand in for BULK charge), Abt ( to stand in for Absorption) , FLt ( to stand in for Float charge) and word like OFF on the 7seg take a look at the attachment below.Test5b is somehow complex but very interesting thanks again Martin am really really happy keep up the good work i like flowcode,Thanks everyone on the team.
Attachments
IMG_20200417_182136_236~2.jpg
IMG_20200417_182136_236~2.jpg (60.48 KiB) Viewed 13472 times
IMG_20200417_183645_625~2.jpg
IMG_20200417_183645_625~2.jpg (85.38 KiB) Viewed 13472 times
IMG_20200417_152220_419~2.jpg
IMG_20200417_152220_419~2.jpg (55.53 KiB) Viewed 13472 times
Last edited by Derrihj on Fri Apr 17, 2020 5:30 pm, edited 4 times in total.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

CHA
Attachments
IMG_20200417_185259_409~2.jpg
IMG_20200417_185259_409~2.jpg (62.3 KiB) Viewed 13472 times

Post Reply