Flowcode V6 From Scratch

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
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:

Flowcode V6 From Scratch

Post by medelec35 »

K9ACT wrote:Here is an example of a brick wall for me.

The program in this thread uses an ADC. A component icon is pulled down but I have no idea how it became and ADC. I can't find a list of components anywhere.

This is the level I am at and need some help.

Thanks,
We can help you step by step that's what we are here for.

Have you seen this :
http://www.youtube.com/watch?v=Xh68YXcT ... T38LfzIy0Q
?

Here is my mini tutorial:
Part 1

First open up a new Flowchart by selecting New Project if just loaded Flowcode or
From File Menu, select New, then New Project.
You will need to select the target device your using.
Some common target device like 16F88,16F877A have the configuration settings already built in.
Other less common target devices do not.
Its vital that configuration atr always checked an d set correctly so they match your hardware.
For example you may not have any external crystal so your using the microcontrollers internal oscillator therefore the internal oscillator must be selected within the configuration menu.
Not all microcontrollers have an internal oscillator, the 16F877a for example.
For more information on Configuration settings you can follow the link on my signature.

The ADC (Analogue to Digital Conversion) component in Flowcode V6 (I assume that's what your using?) is an Input component since it relies on an input voltage.
So you will need to click on Inputs menu at the top of Flowcode then select which ADC component you require. All the ADC components act the same e.g, the difference is in the simulation looks only.
For example in the Inputs menu left click on: 'Potentiometer Colour cap' icon then select Add to dashboad panel (this panel is the 2D panel)
FC6 ADC1.png
(91.93 KiB) Downloaded 13349 times
Now you will need to add a variable so when the analogue input voltage is read it will be assigned to either an 8 bit variable: range is from 0 to 255
or be assigned to a 16 Bit variable (but since the ADC components most commonly is 10bits the range will be from 0 to 1023)

To assign ADC component to either 8 bit or 10bit variable:
First add a variable e.g 8bit variable called ReadADC. (note with naming of variables no spaces are allowed, but you can use an underscore_to separate words if more than one word is required).
In project explorer (Found within View Menu ) Select the triangle next to Variables as shown:
Add variable.png
(13.08 KiB) Downloaded 13349 times
Type in the variable name in the Name of new variable i/p box.
Then you will need to select the type. (since the default is byte you do no need to select anything).
Out of good practice just place a 0 in Initial value box, This is not always required but if not sure then add a 0 anyway.
Now you will need to on your flowchart:
1) Drag a continuous loop between the BEGIN and the END
2) Drag a component icon from the side of flowchart symbols on to the continuous loop
3) Double Click on the component macro, select the + to expand pot_color_cap1
4) Select GetByte
5) Click on the arrow on Right of Return Value box
6) With Globals selected at the top of new opened window, Double click ReadADC variable, then select OK.
F6 ADC2.png
(95.18 KiB) Downloaded 13349 times
If the properties window is not open, then right click on the pot that's on the dashboard panel and select Properties.
Click on the properties option (spanner icon), now select the channel that will be using for analogue input. EG is port A usually have analogue inputs so if you suing a 16F877a for example, you can use pins 2 to 5 (AN0 to AN3) or pins 7 to 10 (AN4 to AN7). Hint either look at the chip digram ( View, Chip) or look at the data sheet by going on this site:
http://www.microchip.com/
Jut concentrate on the Connection at this stage. Well will assume your Pot wiper is connected to pin 3 of 16F877a, in that case make sure Channel shows An 3.

If you can let me know what target device (microcontroller) your using,and what the clock source and frequency is e.g internal osc 8MHz etc

we can help you further.

Martin
Martin

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Flowcode V6 From Scratch

Post by K9ACT »

Thanks so much Martin.

I will check out the other links but I went right to your tutorial and it's exactly the sort of thing I need.

So now I have an ADC whose input is assigned but I am not sure where the output is or what I can do with it.

I assume the red pot is to simulate a variable input?

The only device I have with an ADC is 12F675. I also have 16f628's but there is no ADC.

Thanks,

Jack

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Flowcode V6 From Scratch

Post by K9ACT »

Have you seen this :
http://www.youtube.com/watch?v=Xh68YXcT ... T38LfzIy0Q
?

I have looked at these videos on 4 different computers and they are all so out of focus that they are useless.

Must be something I am doing wrong if they look good to others.

Any ideas?

js

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:

Flowcode V6 From Scratch

Post by medelec35 »

Part 2 for 12F675
K9ACT wrote:I assume the red pot is to simulate a variable input?
The pot is required for both simulation and for adding (enabling )an ADC component, so your 12F675 digital i/p can be changed to analogue input.
the type of pot e.g dial, red cap, slide etc. is for simulation only.
You go with the one you like the look of.

Keeping it simple, as an example we can just one anlogue input 0 to 5V, and one digital output.
Digital output only has two states. either logic 0 = 0V or logic 1 = +5V
For this example we can make a simple over voltage warning detector.
I'm going think of a random voltage e.g 3V so if voltage in from wiper of pot going to An1 (GP1) is <2.8V (< is Less then ) then LED (LED must have a current limiting resistor connected in series otherwise damage will occur to LED see note at the end) connected to GP0 will be off
If voltage rises to 3V or above then LED will be on.
No change between 2.81V and 2.99V to allow for a bit of hysteresis (references about hysteresis can be found on the internet.)
The resolution of ADC (for simplistic terms we can say resolution is minimum voltage change that will cause byte to change up or down by 1) is 5/255 = 19.6mV
So for every increase of 19.6mV a byte will be incremented by one.
What we need the byte value that will case the LED to go on i.e >=3V. (Greater or equal to 3V)
This is calculated from 255/5*Vin = 51*3
= 153
Now for LED to go off i.e <=2.8
= 51 * 2.8 =
142.8
PIC (12F675 is a PIC chip) maths is not the same a ordinary maths since with pic mats you dont reound up, instead you round down
=142
So now we have both upper and lower values we need our flowchart to:
Start:
ReadADC (which is converted automatically into Bytes)
Check if its value is greater then 153: If yes then output connected to LED = 1 = +5V
If no then is value is less then 142: If yes then out put connected to LED = 0 = 0V
Small delay
Goto start
This is what the flowchart will look like:
Over voltage Detector1.png
(174.06 KiB) Downloaded 13329 times
When running simulation its handy to be able to view variables so you can follow what's going on.
You must fist add the variables to the Simulation debugger.
What I do is press F8 Key to single step then Select variable/s by clicking on to the arrow when you hover to the left of word Expression :
watch var1.png
(29.38 KiB) Downloaded 13329 times
Then to watch the variables change as you adjust the pot, set the simulation speed to 50 or lower.
To do this just select stop (if still in single step mode)
Select Build menu, project options then set simulation speed.
The other way to view the value of pot is select View, Analog inputs, then change from Raw to Byte

Finally you will need to transfer to your hardware.
Have you got a programmer and do you know about ICSP In Circuit serial programming?
Then we can take it from there.

Martin
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:

Flowcode V6 From Scratch

Post by medelec35 »

K9ACT wrote:Have you seen this :
http://www.youtube.com/watch?v=Xh68YXcT ... T38LfzIy0Q
?

I have looked at these videos on 4 different computers and they are all so out of focus that they are useless.

Must be something I am doing wrong if they look good to others.

Any ideas?

js
Your link is not working.
Martin

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Flowcode V6 From Scratch

Post by K9ACT »

medelec35 wrote:
K9ACT wrote:Have you seen this :
http://www.youtube.com/watch?v=Xh68YXcT ... T38LfzIy0Q
?

I have looked at these videos on 4 different computers and they are all so out of focus that they are useless.

Must be something I am doing wrong if they look good to others.

Any ideas?

js
Your link is not working.
Don't know what you mean by my link but only the screen shots are out of focus. The intro and everything else on Youtube is just fine.
'
js

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Flowcode V6 From Scratch

Post by K9ACT »

Very good stuff Martin. I really appreciate this.

Technically, I got as far as the LED's but I have no idea what to use for the output from the 675 to drive them.
Also, I seem to have many more than two of them so I keep getting no connection warnings when I try run it.

From a practical standpoint, the Dash Board is driving me nuts. Either the components are specs that I can hardly see, which is probably why there are so many LED's or something goes bonkers and the pot gets as big as a bed sheet and I can not decipher the secret to resizing parts as you can see in the attached. I just gave up trying and ask for help.

So if you can steer me through this it will be great. I have never been able to use the ADC before.

One other question for now, what do the red stars mean that I see on the flow chart?

In answer to your question, I have a Pickit 1 with updated firmware. I have been trying to learn asm and Microc but I think I am too old and too impatient to learn that level of programming. I have built quite a few projects but only ones that someone else wrote the programs for including the green house fan control and two temp controls, counters for my sock machine and a tachometer.

You also asked about in circuit programming which I don't think I have any need for. I have a zero insertion socket mounted on the breakaway part of the Pickit wired for 16F628 and the test socket on the Pickit for the 675. These are the only pics I have used. I got into this when a friend talked me into building VFO but he did all the programming.

BTW, we probably should change the subject line of this thread to something more appropriate like Tutorial for Geezers.

Thanks again,

Jack
Attachments
martinadc.fcfx
Big re-sizing problem
(8.95 KiB) Downloaded 561 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: Flowcode V6 From Scratch

Post by medelec35 »

K9ACT wrote:Very good stuff Martin. I really appreciate this.
No problem.
I know it can be frustrating learning on any new product from scratch so hopefully this could help anyone in the same boat as yourself.
K9ACT wrote:One other question for now, what do the red stars mean that I see on the flow chart?
That star appears above any flowchart macro that it has been changed (e.g component, calculation etc.) and flowchart has not been saved.
you will also see a star next to the name of the flowchart, which is also showing that there have been changes made since flowchart has last been saved.
When you save the Flowchart, all the stars will disappear.
K9ACT wrote: BTW, we probably should change the subject line of this thread to something more appropriate like Tutorial for Geezers.
I was thinking on similar lines.
It was unfair that the original thread of LM34 Temp sensor was in effect being hijacked!
So I have renamed all the LM34 Temp sensor posts that involve Flowcode V6 tutorial to Flowcode V6 From Scratch and separated them and moved to where we are now. ie. Programming Tips & Tricks

Part 3

We can tidy up your flowchart, and add correct LEDS.
Also since if you double click on a component, it's added to the system panel by default.
We will use system panel from now on.
That's the reason for component unconnected warnings, components have been added to system panel as well, and left unconnected.

We will add a better LED to the system panel, I never add the base component.
Then delete all the components that are not required

The choice of LED;s are all attached to the base choose one of the following:
LEDchoice.png
(54.34 KiB) Downloaded 13268 times
Choose one (We can select LED 5mm Panel for this tutorial) then get in the habit of single clicking on the arrow that icon transforms into, then selected where you want component to be added to.
As stated earlier we will add components to the system panel.
Once its added to the panel, also get in the habit of moving it to a more desired position.
This is required since when a component is added, its always added to the same panel coordinates.

Now reassign the LED on and and LED off components to the new LED 5mm Panel
To do this double click on component icons, then re-select correct component and action:
Change LED.png
(74.08 KiB) Downloaded 13268 times
Note you had the component connected to

Code: Select all

If read_adc <= 142
as LED TurnOn
It should be LED TurnOff, since that's the action we need to take if no over voltage is detected.

Resizing and moving components & zooming in and out of system panel
What I do to zoom in and out (there is more than 1 way) is just click on the panel, Hold control down and scroll the mouse wheel.
Take a look at this:
http://www.matrixmultimedia.com/mmforum ... 22&#p52622
There are two ways I use to change component size.
First is:
Zoom in if necessary then click on the component to select it, then release button.
Hover over in one of the corners, then when a cross appears, left click mouse button and resize component:
Resizing components.png
(27.21 KiB) Downloaded 13268 times
Note I have requested a keep aspect ratio option, but it has not been implemented.
So you need to be careful that component does not go out of shape when resizing.

The other way of resizing is just select and change the values of Hight, width and Depth in proportion.
To move the component its just a matter of select and dragged to the required position.

Deleting unused components.
You can view panel properties by either right click on any open space of the system panel or
'View' menu, 'Panel properties'
Other steps are covered in this attachment:
Deleting components.png
(28.17 KiB) Downloaded 13268 times
Connecting components.
Component connections.png
(15.92 KiB) Downloaded 13268 times
After 3) Ie when Click on unconnected, then a Chip diagram will appear.
You can either select the unconnected drop down arrow then select the port, then then select pin from the other drop down arrow.
Or
Just select a pin from the chip itself:
Component connections2.png
(16.4 KiB) Downloaded 13268 times
Connecting LED to your hardware.
As stated earlier you must have a current limiting resistor connected in series with LED. This is required to limit current though both LED and micro controller thereby preventing damage to both.
What we can do is limit the current to say 10mA.
To do this you will need to know the forward voltage drop of LED. Typical is about 1.8 for a red LED so we will use that figure.
So we know the high output from microcontroller is 5V which is the same as the supply.
Since resistance = voltage divided by current : R = V/I
The voltage we are intrest in the how much voltage the resistor has to drop = 5 - 1.8 = 3.2V
I = 10mA = 0.010A therefore resistor = 3.2/0.010 = 320R or 320 Ohms
You can go up in value e.g 390R -= prefered value. You can increase the resistance even more , but as you do so current will be limited more, so the brightness will start to get dimmer. If you look at the datasheet for 12F675, then take a look at what the overall maximum current it can handle and the maximum current each pin can handle.

Martin
Martin

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: Flowcode V6 From Scratch

Post by K9ACT »

Just a quick question before you go to bed. I will work through your new stuff in the meantime.

It is not obvious to me what the difference between the dashboard and system panel is and why you changed for this project.

Nor do I understand why or how the program knows or cares about the current limiting resistor in the led.

Other than that, thanks again and say hi to the Queen if you bump into her today,

Jack

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: Flowcode V6 From Scratch

Post by K9ACT »

Attached is my latest. As you can see, I still have a re-sizing problem with the analog input.

I still do not understand how I determine which pins to connect the leds to. The input is obvious but the output is not.

The sim runs but I have no control over the pot.

js
Attachments
martinadc.fcfx
(6.55 KiB) Downloaded 443 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: Flowcode V6 From Scratch

Post by medelec35 »

K9ACT wrote: It is not obvious to me what the difference between the dashboard and system panel is and why you changed for this project.
I changed from dashboard and system panel because you had a few components on the system panel since if you double click on a component that's what they are added too
At least then all the components are then kept in one singe place and there is less confusion and component not connected warnings.
Difference between the two panels is:
Dashboard = 2D
System panel is 3D
K9ACT wrote:Nor do I understand why or how the program knows or cares about the current limiting resistor in the led.
I did state:
medelec35 wrote:Connecting LED to your hardware.
Flowcode will not know the difference.
Everything that was to do with calculating resistance was for connecting a Real LED to your hardware only.
It would be a shame to get a working flowchart, then transfer hex to your hardware, then power Hardware to find that it damages LED because resistor is left out.
K9ACT wrote: As you can see, I still have a re-sizing problem with the analog input.
Since the component is far too small to click on it and drag it larger, just do the second resizing option of my previous post.
Namely on the properties window click the down arrow, choose Pot:
Resize2.png
(13.72 KiB) Downloaded 13243 times
Then enter a sensible value in Hight and width:
Resize3.png
(18.89 KiB) Downloaded 13243 times
So you should see this:
Resize4.png
(22.79 KiB) Downloaded 13243 times
Now for your output.
If one LED is either on or off, then you only drag one LED onto your panel, not two like you have done.
So just delete one of your LEDs
You will need to assign only LED Clip 1
The Branch of

Code: Select all

If read_adc <= 142 has 
has led_5mm_cllip1::TurnOff()
The Branch of

Code: Select all

read_adc >= 153 has 
has led_5mm_cllip1::TurnOn()
When you have only assigned ed_5mm_cllip1 then you can delete ed_5mm_cllip2 for the panel.
You won't be able to delete a component for any panel that is used on the flowchart part.

Finally assign to the output (in this case LED) to pin of a port.
Now you have only one led, I have described how to do that in my previous post.
Follow that then let me now how you get on. The flowchart should look like this:
Finished flowchart.png
(89.4 KiB) Downloaded 13243 times
Don't forget to vary the pot in simulation ,you can either left click on the pot and hold the mouse key while rotating knob.
Or
Select View Analog inputs, and move the slider that's connected to the correct input, in this case its An 0


Martin
Martin

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Flowcode V6 From Scratch

Post by dazz »

Hi Jack

The queen i think if martin bumped into the queen, you wouldn't hear from him for a long while as he'd either be locked in the tower or locked in an assylum ( :lol: )


(edited as martin posted at the same time )
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: Flowcode V6 From Scratch

Post by K9ACT »

I fixed a bunch of problems while you were typing I guess.

The one question I am not making clear is on the LED connection to the 675. I know how to change it but I do not understand what determines which pin I am supposed to use. I use AN0 for input, vcc and ground but which is of the ones left can I use for the output? Any of them?

I have it running in sim now but I do not understand the logic. Are we not looking for a flag if the voltage is outside of 142 to 153? So why are you turning off the led if the voltage is less than 142?

If I set them this way the LED stays on no matter where I put the pot. If I change the low limit to off, the led goes on and off as I rotate the pot but not knowing the voltage, I have no idea what it really means.

Getting closer. You may go to bed now and I will build it up in hardware.

Thanks much,

js

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: Flowcode V6 From Scratch

Post by medelec35 »

K9ACT wrote:The one question I am not making clear is on the LED connection to the 675. I know how to change it but I do not understand what determines which pin I am supposed to use. I use AN0 for input, vcc and ground but which is of the ones left can I use for the output? Any of them?
Oh , your taking about hardware rather than simulator.

Yes you can use any pin for output as most pins can be set as input/output with exceptions. e.g MCLR is usualyeither MCLR or i/p only

Take a look at the data sheet to check which pins are input ad output or both.
Also each pin can have other functions e.g RS232, PWM CAN I2C etc..

Finally before you can compile to hex, you must make sure that configuration settings and Clock speed are set up correctly.
These do not affect simulation, but will have an effect on your hardware.
So much so your hardware may not even work unless settings are correct.
1) Determine what your going to use as a clock source.
E.g external Crystal, internal oscillator running at 4MHz
See datasheet:
http://ww1.microchip.com/downloads/en/D ... 41190G.pdf
If running internal osc at 4MHz (which means you do not require any external crystal, resonator or capacitors to drive clock) then you will need to set configuration settings (Build, Project options as follows:
Config1.png
(70.76 KiB) Downloaded 13239 times
and
Config2.png
(48.7 KiB) Downloaded 13239 times
Looking at your flowchart you have got this spot on.
But I have posted for the benefit of other beginners.
K9ACT wrote:I have it running in sim now but I do not understand the logic. Are we not looking for a flag if the voltage is outside of 142 to 153? So why are you turning off the led if the voltage is less than 142?

If I set them this way the LED stays on no matter where I put the pot. If I change the low limit to off, the led goes on and off as I rotate the pot but not knowing the voltage, I have no idea what it really means.
This is what should happen as stated in a previous post:
medelec35 wrote:What we need the byte value that will case the LED to go on i.e >=3V. (Greater or equal to 3V)
This is calculated from 255/5*Vin = 51*3
= 153
Now for LED to go off i.e <=2.8
= 51 * 2.8 =
142.8
PIC (12F675 is a PIC chip) maths is not the same a ordinary maths since with pic mats you dont reound up, instead you round down
=142
If the value is between 143 and 152 then there will be no change.
So to test set your simulation speed to 50 (See Config2 screen shot)
Then select View Analog inputs with settings on Bytes.
Then when simulator is running , move the sliding value to above 153 and below 142 to check the LED lights and goes off at the correct settings.
If following a flowchart carefully to see how it works, then you can just keep pressing the F8 (Single step ) function key on your keyboard.
If it does not work for you then post your flowchart, then I will edit it then post it back.
K9ACT wrote:Just a quick question before you go to bed. I will work through your new stuff in the meantime.
When you wrote that it was 4.44PM in the UK which is where I'm from, so not going to bed that early :lol:
dazz wrote:i think if martin bumped into the queen, you wouldn't hear from him for a long while as he'd either be locked in the tower or locked in an assylum ( :lol: )
Thanks Dazz love you too xxx
But on the bright side, at least I would have you for company :lol:
Martin

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: Flowcode V6 From Scratch

Post by K9ACT »

I guess I misunderstood the objective. I was thinking this was a hi/lo limit that would turn on the LED when above or below the limits. Now that I understand that, I don't understand why setting the low to go on instead of off does not make it a hi/lo limit.

Aside from that, it is running properly in hardware now but I changed the limit to turn on a fan in the greenhouse at 140mV (140C) and 120mV for the hysteresis low. I really want 130C but the 20mV per byte is the show stopper here. I suspect that if I am not interested in anything above say 200 mV I could use this instead of the 5v but I am not sure this is right. I don't think I really need to worry about hysteresis here because the temp just keeps going up all day once it starts. The fan just reduces the peak.

I really like that View Analog Input. It's just like adding a pot to a breadboard.

For the next step, assuming another device with enough pins for a 7seg display, is there any sort of serial output coming from the 675 that could be used by a 16F628A. It would no doubt be simpler with a larger device but I have these and like to do what I can with them. I suspect the answer is in the 675 data sheet so I will have another look but it pretty much overwhelms me.

js
Attachments
martinadc2.fcfx
(5.98 KiB) Downloaded 340 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: Flowcode V6 From Scratch

Post by medelec35 »

K9ACT wrote:I really want 130C but the 20mV per byte is the show stopper here.
You can use GetInt instead of GetByte
Resolution of GetInt is:
5/1023 = 4.89mV
If you do then you will need to change Read_Adc variable from Byte (0to 255) to Int (0 to 1023)

When you get more advance you can use the Vref function with 10bit A to D conversion.
I can explain how to use this when your ready.
But basically with using Vref function, Resolution will be:
2.5/1023 = 2.44mV

So there is not really a 20mV show stopper as you thought there was.
K9ACT wrote:I guess I misunderstood the objective. I was thinking this was a hi/lo limit that would turn on the LED when above or below the limits.

No I did state it was a over voltage detector.
This was a first project and was the easiest thing I could think of to demonstrate the analogue function.
once you get that working we can go on to doing what you actually require.
K9ACT wrote:For the next step, assuming another device with enough pins for a 7seg display, is there any sort of serial output coming from the 675 that could be used by a 16F628A.
16F675 does not have any dedicated RS232, but that does not need to stop you as you can use any output pin in RS232 software mode.
Note RS232 can only be used during 30day trial period. one 30days is up, then flowcode reverts to free version, then RS232 and other communication functions will no longer be available until a professional licence is purchased.
Martin

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: Flowcode V6 From Scratch

Post by K9ACT »

medelec35 wrote:
K9ACT wrote:I really want 130C but the 20mV per byte is the show stopper here.
You can use GetInt instead of GetByte
Resolution of GetInt is:
5/1023 = 4.89mV
If you do then you will need to change Read_Adc variable from Byte (0to 255) to Int (0 to 1023)
Great! works fine in sim but seems to be backwards in hardware. LED goes on BELOW 130mV in hardware.
Attached is program.

>When you get more advance you can use the Vref function with 10bit A to D conversion.
I can explain how to use this when your ready.

Let's come back to that later.

>Note RS232 can only be used during 30day trial period. one 30days is up, then flowcode reverts to free version, then RS232 and other communication functions will no longer be available until a professional licence is purchased.

This needs to be clarified. I have emailed sales twice and have yet to hear from them.

Are you saying that even if I purchase the PIC package, I can not do RS232 without purchasing the pro version?

I would like to move on to a different project while I have someone in the mood to help. We probably should start a new subject but I will leave that up to you.

I have built a number of event counters but as they are in asm I do not understand how they work so I would like to do one in Flow Code.

I started a Counter project, using a 16F628A and connected the PIC to the 4x7 segment display, added a switch but have no idea how to make it count. The input (switch) is either IR sensor or magnetic switch.

Thanks for your help,

Jack
Attachments
martinadc3.fcfx
(6.18 KiB) Downloaded 361 times
Last edited by K9ACT on Mon Oct 28, 2013 4:59 pm, edited 1 time in total.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Flowcode V6 From Scratch

Post by Benj »

Followed on with second project here: http://www.matrixmultimedia.com/mmforum ... 26&t=13098

Post Reply