Dc voltmeter 0-55v

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

Moderator: Benj

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 also changed the PCB for this one alittle coz when i was coding i found out that when power goes off the prog would stay in the same loop that it was left in at the time power went off due to absence of auto reset yet I want it to start afresh when power comes back so the mistake was powering the PCB board from the same battery am charging so i changed the PCB so that it's powered from a different source may be the main transformer which I think when power goes off the PCB control board also goes off and wait for mains ac to return check the new lebeled PCB image below.
Attachments
18Ah Battery Charge Control (1).pdf
(331.55 KiB) Downloaded 192 times
Last edited by Derrihj on Sat May 02, 2020 5:24 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 »

Thanks,
I did not look back far enough.
There is a component for 7segment(74HC595), just use search (far left icon) and search for 595.
so you have three choices.
1) Request in feature requests that Common type can be changed to the 74HC595 like it was for quad 7seg here.
2) Design hardware around the 7segment(74HC595) component built into Flowcode
3) Have a go at learning how the 74HC595 works and drive the display with it.
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 now i think i will have a look at all that when am fully done with this one coz the best way to find out is to build the hardware.Now it's only the lockdown that is hindering me.Thanks Martin.
Last edited by Derrihj on Fri May 01, 2020 9:59 pm, edited 1 time 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 »

If i enable HS-PLL on 8MHz to give me 32 does the interrupt frequency also change to match 32MHz or it stays put as matched at 8MHz originally?

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 »

Everything will be on the new x4 frequency. so you must change the clock speed to match the new 32MHz.
Then the interrupts will be based on the new 32MHz automatically.
You will need to go in to the interrupts and change properties so they will run that the correct interrupt speed.
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 »

How do i change it do i need a C code to do this as 32MHz is not in the list and the reason i asked I didn't see the interrupt frequency change too when I enabled the PLL how do i change these coz i will need my interrupt frequency back to reflesh my 7 seg as I desire.

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 »

Oh I found out that it can be entered manually didnt know 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 »

You need to set internal osc like I explained in this post
If frequency is not listed within internal osc helper, then the chip probably will not run at the frequency you require.
That is the issues with the older devices.
If frequency is listed within internal osc helper but not listed within Flowcode, just slect the 20MHz, and change the 20 to say 32, so you got 32000000.
One of my favourite devices due to internal osc running at 64MHz and enough ROM and RAM to run most if not all gLCD's is PIC18F27K40.
When designing new hardware never use older devices.

Edit. Was typing when a new post was added.
Last edited by medelec35 on Fri May 01, 2020 11:06 pm, edited 1 time in total.
Reason: Added Was Typing when a new post was added
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 »

Yes Martin but this time am using external osc have you looked at the pcb it shows I've put the external osc for the case of mcu me i use what i find in my poor store as it's really hard down here in Uganda to get those chips unless you order them from abroad so i use what i come across from old circuit boards like old inverters, APCs things like that.Are you trying to say i can't use PLL on external osc?
Last edited by Derrihj on Sat May 02, 2020 5:34 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 »

Derrihj wrote:have you looked at the pcb
No not looked at the PCB.
Have done now.
Derrihj wrote:Are you trying to say i can't use PLL on external osc?
No, PLL works on internal and external oscillators.
With external oscillator and PLL enabled:
For your device, the crystal can be between 4 & 10 MHz, which will give you between 4 x 4 = 16MHz & 10 x 4 = 40MHz
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 »

Oh ok but thanks for the " PIC18F27K40" every thing counts and adds a brick to what am learning.

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 »

Another thing i would love to dim the 7seg may be dim in or out for some of the messages on the 7seg to make the proj look professional,when i look at all the used port bits for each number or message on the 7seg they add up to 253 not FF so my question is can i use the for loop like: for (7seg = 253; 7seg > 0; 7seg --) {some thing ;some thing;} or: for (7seg =253; 7seg < 253; 7seg ++) { command;}to dim out and vise versa to dim in my 7seg? Coz every message on the 7seg represent a lit bit number when added up for both ports being used so i can use that lit bit number in the for loop on a given message to dim it in or out? and how is the for loop used in flowcode can i use C code?

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 timer interrupt is increased, then you can vary the display on/off times which will have the desired effect.
You could a have a brightness variable where brightness = 10 to 100.
Which roughly corresponds from 10% brightness to full brightness.
Within interrupt:

Code: Select all

Count = count +1 

Code: Select all

if(count = 100) 
count = 0 
Display digits routine enabled

Code: Select all

If (count = Brightness value)
Display digits routine disabled 
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 »

If you can explain more on this i will be good to go.

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 »

It will be easier for me if you post your latest flowchart, and I will modify it for you.
Then you can work out how it's done.
What a can do is start the brightness at 1%, then increment by 1 every second, until full brightness 99 seconds later.
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! gat u loud and clear sir.

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 Martin Here is my flowchat for this project it may not be perfect as of now as you know the final edits are done when the real hardware is present and i wrote this very first so may contian some errors but i really welcome where you see that i need correction in the code.The prog starts with checking the battery status to find out if the battery is 10v and above fit for charging and the message bCh (Battery Check) is displayed what i want is to dim in this first message bCh as it comes on and also dim it out as it goes off.With that first example i will be ready to deal with the rest as i desire.Thanks Martin am ready to learn.
Attachments
Full BAT charger 18F442.fcfx
(137.6 KiB) Downloaded 140 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: Dc voltmeter 0-55v

Post by medelec35 »

Just as a demonstration, the brightness will start at 1% and increment by 1 every second.
When reached 100% will drop back to 1 and repeat cycle.
Brightness control variable is within Temp_AmpsMult macro call.
Most of the alterations to control brightness is within TmrMultiplex macro call.

To make sure you understand how it all works you could modify the flowchart that runs your current hardware (16F88).
The timer interrupt that displays digits, will need to be increased to eliminate flickering.
Attachments
Full BAT charger with Brightness control V1 18F442.fcfx
(142.04 KiB) Downloaded 143 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 »

Thanks Martin i will go through it when our ac mains is turned back on down here coz right now am using my china phone.

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 it does dim in and out but the dimming is too fast in that it appears as tho it's just blinking it's not smooth dimming in and out i would like it to dim in and out slowly and smooth like "a tender air blowing arround" : :D just like you dim your room lights slowly and they fed out don't know if this is possible.

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 »

Is that with 16F88 hardware & you have modified flowchart yourself?
If so can you post it.
Can you change it so brightness is fixed at 2 and let me know if flickers?
If the interrupt is fast enough and display is disabled within No branch of If( DisplayEnable) then should not flicker.
Or do you have new hardware for 18F442 and using flowchart I posted without modifying it?
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 »

Yes it is with the 16f88 but i found out that on my hardware if i raise timer2 intfQ to 1000 and above the display does not look nice as the half lit LEDs show up allot it gives a nice display when i put the intfQ @ between 200 and 400Hz

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 »

Here is how i edited it for the 16F88 coz I want to dim CHA
Attachments
Full BAT Test 5bb.fcfx
(41.37 KiB) Downloaded 112 times
Last edited by Derrihj on Sun May 03, 2020 1:19 pm, edited 1 time 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 »

I fixed Brightness and it still flickers.
Attachments
15885079164098013810665580281870.jpg
15885079164098013810665580281870.jpg (143.17 KiB) Viewed 10354 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: Dc voltmeter 0-55v

Post by medelec35 »

The problem is with 16F88, it's an old microcontroller, so maximum internal clock speed may not be fast enough.
The higher the internal clock speed, the higher the timer interrupt can go without hogging all the resources.
As a very rough guide.
If timer interrupt is set as 4KHz, you will get severe flickering.
At 8KHz you will get slight shimmering .
At 13KHz+ you should be ok.
That's not an issue with internal clock at 32MHz.
I have set the attached flowchart at 13.3KHz for you to try.
Attachments
Full BAT Test 6bb.fcfx
(41.06 KiB) Downloaded 143 times
Martin

Post Reply