Dc voltmeter 0-55v

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

Moderator: Benj

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote: 88.0.v and then changed to 56.5.v
To me that is either a floating issue. E.g the pin being used to measure battery voltage is not the one assigned within flowchart, or calulations are wrong.
Can you post schematic, as its easier than following an unlabelled PCB design.
I will then see if I can assist you as well.
The more helping the better.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

You know Martin i Respect you so much but I've given up on this particular project if you have a better charger that uses may be PWM or any other good methods please help with the flowchat then i will make another circuit for it but I've had enough stress with this particular project more so with the 7 segment. I've been using a 16x2 LCD and with the same ADC config with no trouble at-all but for this basic project i didn't want to waste my expensive LCD that is why i picked the boring 7 segment.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:but I've given up on this particular project if you have a better charger that uses may be PWM
Sorry, did not know you have given up and don't have any charger flowcharts.
Derrihj wrote:but I've had enough stress with this particular project more so with the 7 segment
I have produced flowcharts that drives 7seg displays just fine, so if you are not getting one to work or change your mind, I will sort the display out for you.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

"I have produced flowcharts that drives 7seg displays just fine, so if you are not getting one to work or chage your mind, In will sort the display out for you."

That will be so nice Martin, i really love to learn this 7 segment in flowcode but of all things am learning this has caused more trouble to me than the others yet it looks more simple than the others.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1145
Joined: Wed Dec 31, 2008 3:37 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Steve001 »

Hi Derrihj

What do you want to know about charging your batteries i maybe able to help.

!!!! Dont use PWM !!!!

What batteries are you using ?
Lead acid
Nicad

I can only assist with these two types of industrial batteries though

Steve
Success always occurs in private and failure in full view.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Steve001 i dont want to know about charging my battery what i need is a battery charger circuit code that is working for my deep cycle 17Ah battery or to fix my 7 seg circuit.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:i really love to learn this 7 segment in Flowcode but of all things am learning this has caused more trouble to me than the others yet it looks more simple than the others.
My advice would be, just get one thing working at a time.
Learn how flowchart works, then modify flowchart to do exactly what you want it to do.
Let's take the quad 7Seg as an example.
Matrix wiki has a really good page about 7seg displays.
The section of interest is Stop Watchdownload 7Segment Timer example.
Personally, I believe That is the best way to control quad 7seg's as:

1. Using timer interrupt to refresh the multiplex displays.
2. MOD function is used outside the interrupt rather than within.

Adapt the Flowchart to work with your hardware.
What is important is you don't have display functions outside the interrupt as well as within!
That will lead to all sorts of issues.
We can go over the flowchart together if you get stuck on how it works.
Once you have mastered it, we can change it to work with Reading ADC to display voltages.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Hi Martin thanks for your advise of the stop watch example,sorry for the delay reply coz i was abit disappointed with my 7seg so i didn't work on your example at first until this covid19 lock down that i gave it a second thought.When i was going thru the stop watch example it seemed very interesting so i studied it and transformed it into my design which came out exactly as i wanted it to in simulation and am about to load it into my hardware and see how it swims in.Thanks Martin i will let you know the results.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Your welcome.
It will be interesting to know about the hardware results.
Let me know if you required further help.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Ok the code was too big to fit in the 16F88 so i had to remove all the voltage calibration lines and the battery Volt cut lines to make it fit in my current chip.So the remaining code is for displaying voltage on the 7seg only.But when i loaded it in, it only displays zeros yet in simulation it works fine.please Martin check it for me and see were i go wrong.
Attachments
3Digit 7seg 0-55v voltmeter.fcfx
(29.44 KiB) Downloaded 18 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

My suggestion is to take Read ADC component and place it in Main.
See if that works better?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Looking in to the flowchart further, Its possibly not ADC within interrupt.
Check that the expected voltage on the ADC pin.
In your case the voltage should be between pin2 (An3) & gnd.
With 5V on it the reading should be at least 55.0
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Don't know if its a bag in flowcode v8. ok i did what you told me first to put the ADC read into main and this time this one worked really well with no display flicker at-all but sending to the hardware still doesn't work maybe you can try it for me on your hardware you used last time and see the outcome.
Attachments
Test.fcfx
(22.51 KiB) Downloaded 14 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

I will set up hardware.
Out of interest with 5V injected and measured across pin2 (AN3) & GND, what is the display showing?

Just looked at your latest flowchart and the timer 0 interrupt is completely wrong so the 7seg LED's should not even light!
You have got the clock source select as the default which is Transition on T0CKI pin
So the Timer0 interrupt will only work when it sees a pulse on the T0CKI pin.
You need to change the source to internal clock.
Also the interrupt frequency is way too low, so the display will flicker like crazy!
Try changing the prescaler rate to 1:4

OSCCON value is wrong.
Looking at the datasheet, 0x6F will make your hardware run at 4MHz, instead of 8MHz.
Have you done the 1 second flasher test to make sure hardware is running at the correct speed?
You can determine correct value from the datasheet, but its much easier now Flowcode has a built-in IntOsc Helper.
Just use the Search and enter intosc
Once added to panel (add to 2D panel as your scaling is wrong for 3D panel)
Right click and select properties.
Let me know what value you are going to be using.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Update.
Made suggested changes in my previous post, i.e Timer interrupt 0 (Can go as low as 1:16 = 488.3 Hz) and OSCCON value only.

Hardware is working perfect for me using PIC16F1937.
So I don't see why your flowchart will not work with PIC16F88.
7seg LED's showing solid values.

With 0.5 x VDD at An3 the display is showing 27.4V
With VDD at An3 the display is showing 55.0V

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Thanks Martin for all the effort to help me out of this nightmare i think it's not flowcode problem there is something am not doing right first for 8mhz what should the OSCCON value be? Looking at the 1 second i got this have a look at the attachment.
Attachments
IMG_20200413_191907_705.jpg
IMG_20200413_191907_705.jpg (145.07 KiB) Viewed 1063 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

You're welcome.
You have to set the Oscillator Speed to match your Clock speed that's set within configuration settings i.e 8MHz = 8000000 not 31250Hz as that is a clock speed of 3.125MHz.
Hence the warning you can see 'Warning: Clock Speed In Project Options Does Not Match Internal Oscillator Speed'
The 1 second relates to the delay that you are using within a loop that you follow from this link
The idea of the 1 second flash is you get an LED to flash with a 1 second delay.
If the delay is timed at 2 seconds then the hardware is running at half the expected clock speed.
If LED changes state every 4 seconds then hardware at running at 1/4 of expected clock speed etc.
Give it another try to let me know what the correct OSCCON value is.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Ok let me do that now but you talked about my 3D scaling that it's not right how do i correct it?

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Am i supposed to build the 1 one second flasher led on a real board or even doing it within flowcode is ok?

chipfryer27
Posts: 221
Joined: Fri Jun 06, 2014 3:53 pm
Contact:

Re: Dc voltmeter 0-55v

Post by chipfryer27 »

Hi
Derrihj wrote:Ok let me do that now but you talked about my 3D scaling that it's not right how do i correct it?
On the 3D panel you will see at the top a selection of icons. As you hover over with your mouse it will tell you what the icon is for. The fourth from left allows you to scale. Simple select your object then click this icon. You will now, by using your mouse be able to adjust the size to suit.
Derrihj wrote:Am i supposed to build the 1 one second flasher led on a real board or even doing it within flowcode is ok?
You need to build this to run on hardware. It needn't be anything fancy, an led and resistor connected between pin and ground will do. Any free port is suitable. It has to be on hardware to ensure the chip is running at the correct speed, simulation can't do that.

Hope this helps
Regards

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Derrihj wrote:3D scaling that it's not right how do i correct it?
First add any component to your 3D display e.g intosc, but don't resize it.
If you open a new flowchart, then add the same 7seg display to the 3D panel, you can see what the
default values are.
To do that, right click on the component (on the panel), select properties.
Within properties select Position
Change the World size to match the one on the new flowchart.
Do that for all the components.
For example, the Quad 7seg.
Left is the default and right is on your panel:
Component Size.png
(109.75 KiB) Downloaded 838 times
You can change the 1700.00000mm to 50.4mm etc
It's a bit easier that way as your components are way to large to shrink to normal size by selecting scale icon and dragging component to resize it.
When you have completed all the components, you will need to zoom in to normal level.
To do that Click on the Arrow next to 3D and then zoom in with mouse wheel.
Derrihj wrote:Am i supposed to build the 1 one second flasher led on a real board
Yes, The first thing I always do first when building any hardware is the 1 sec flash.
You already have LEDs in the form of 7seg displays, so why do you make use of them?
1Sec Flasher.png
(11.42 KiB) Downloaded 838 times
Edit:
Started post before you a had a reply , but had to sort something else out prior to posting.
Sorry if duplicated any information.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

chipfryer27
Posts: 221
Joined: Fri Jun 06, 2014 3:53 pm
Contact:

Re: Dc voltmeter 0-55v

Post by chipfryer27 »

"You already have LEDs in the form of 7seg displays, so why do you make use of them?"

Good idea to use the existing 7-Segments, no need to make up anything :)

Regards

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

Wawo! thanks Martin i can see you are trying had to make me understand as any very good teacher who loves his job would do and i believe this information you provide is helping other people in the windows of this chat ,to some extent now am beginning to like things that fail to work out in the first place sorry to say that but i get to learn allot out of it.But also on a second thought i might be having a chip issue coz i got this pic16F88 from China at a very cheap price.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8886
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Dc voltmeter 0-55v

Post by medelec35 »

Hi Derrihj,
Derrihj wrote:i can see you are trying had to make me understand as any very good teacher who loves his job would do and i believe this information you provide is helping other people in the windows of this chat
Thank you, That's why I have been getting you to sort out correct OSCCON value rather than me doing it for you.
Derrihj wrote:i might be having a chip issue coz i got this pic16F88 from China at a very cheap price.
Possibly but we can do tests e.g measurement and flowchart mods to determine if that is the case or not.
Did you measure the voltage across An3 and GND?
You could have shorted zener or cap for example?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Derrihj
Posts: 218
Joined: Mon Jul 09, 2018 12:43 pm
Contact:

Re: Dc voltmeter 0-55v

Post by Derrihj »

An3, yes i did and there was 1 volt with that one volt was supposed to give me around 12v output on the 7seg but it shows clear flicker zeros and changes to some numbers like like 549 with decimal points on seg2 and seg3 in all the code i never activated decimal point on seg3 right now am going to test the one sec.

Post Reply