values?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

at this point i can only point out issues, thats probably driving you guys nuts
I am also a bit confused, but with injection time. If i remember well, we talk here for FUEL injectors. Take a look again Brandon at your first post. From those i know from petrol engines, the minimum injection time (in iddle) varies between 2 - 2.5 msec and the maximum (full throtle) between 15 - 20 msec
yes your right on port injected systems you'll see 2.3-18m/s on batch 2.3-12.5 and tbi 1.5 to 8m/s roughly, i have a couple different flowbench controllers i,ve created with chips that i do injector runs on, the reason for 1m/s is some injectors start clicking at 500u/s and some at 1.5m/s what i do with this setting is a visual spray pattern check to compare the begining of injection rate, its a quick indicator of how gummed up they maybe if its a matched set and they start opening at different times, the 5/10/20second flows are full volume tests, the common one i use is 20 seconds,with my current setup i flow injector 100hz 99% dutycycle @2000 pulses, what this does is fully turns the injector with out pulseing it for 20 seconds giveing you a pounds per hour rateing (mL in 20 sec times 3 divided by 10.5= pounds per hour at weigh of 6.33lbs per gallon at the rated press of test) thats how they rate them at the manufacture, generally i do a flow in this order--> spray pattern, leak down, flowrate, hot idle pulse with, 8m/s 17m/s compairing them by pulse counts and by the volumes collected in the 100mL graduated cylinders for each one of the settings above(seemed like you were curious) as looking at the thread i dont see the difference in using a pot compared to a encoder, wouldnt it be the same feel with the same rotation degree results? the push button deal with the display just seems like good match,

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

Benj wrote:Hello Fotios,
where i select: "RB.4 Off / RB.5 Off" and "RB.6 Off / RB.7 Off". I had the sence that using this configuration, IOC is configured to triggered ONLY during the falling edge
This is disabling the interrupt from these pins and not making the interrupt only work for falling edge situations.

To do this you would have to use a stored version of the port to check to see if a bit has been cleared or set. If the bit has been cleared then you have a falling edge and you can continue with your interrupt.
Ah, my good friend Ben :)
Why you don't told me this so far?
Therefore the C-code command e.g. "iocb = 0x70;" to solely enable the IOC on inputs RB.4 - RB.5 - RB.6 on P16F690 is useless, as the same can be done thru the PORT interrupt "Properties" window.
Ah, Ben :mrgreen:
Best Regards FOTIS ANAGNOSTOU

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

Glad you found my Flowcode useful enough to work from.
i was under the assumption from a guy i know that the pic can break down a voltage input from 0-5v into 255 bits, the calculation (50 times voltage divided by 255) only breaks it down to 50 increments in tenths of volts.... can you explain how you came up with that? would (100 times voltage divided by 255) break everything down in to .05 of a volt in the range of 0-5volts...... i didnt understand the code which allows me to get more than 45 variables on the flowbench, does that apply to my chip and why would it ignore everything above 45

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: values?

Post by medelec35 »

brandonb wrote: i was under the assumption from a guy i know that the pic can break down a voltage input from 0-5v into 255 bits
That is correct.
You can also break down a voltage input from 0-5v into 1023 bits using ReadAsInt.
brandonb wrote: the calculation (50 times voltage divided by 255) only breaks it down to 50 increments in tenths of volts.... can you explain how you came up with that? would (100 times voltage divided by 255) break everything down in to .05 of a volt in the range of 0-5volts...... i didnt understand the code which allows me to get more than 45 variables on the flowbench, does that apply to my chip and why would it ignore everything above 45
Reason Voltage = (50*Voltage)/255 is used because the actual formula is V_Supply*ADC_Bytes/255
So if ADC_Bytes = 127 then voltage on the i/p pin = 5*127/255= 2.4
The Flowcode user wanted to use decimal point e.g 2.4 to be displayed.
Since numbers after decimal are ignored, the results have x 10 so you have 24.
Then you can use a method to separate the 2 from the 4 and ahh a decimal point in the middle.
That is what the 50 does. It makes the voltage result 10 times bigger.
Therefore 24= 2.4V etc.
There is a way to make it a bit more accurate.
Take result, Times 10 then add 5, finally divide by 10


As for the not working above 45.
That is only because you have not got a decision for above 45, otherwise it will work.
I did correct that by If Voltage >=45
As I explained when I posted the Flowchart.
You could even do:
If Voltage =46 then……

If Voltage =47 then……

Up to 50 which is = 5V on the i/p pin if you wish

Martin
Last edited by medelec35 on Wed Sep 07, 2011 7:10 am, edited 1 time in total.
Martin

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

Hi to all
Here the fresh stuff.
I solved the problem of the double trigger of PortB IOC interrupt. Now the interrupt occurs once, you have to release and press again the switch for the next PortB interrupt and unwanted jumps from e.g. 1.5 to 15ms have been eliminated. I haven't P16F690, so i tried fcf on actual hardware using P16F887 (does no matters, simillar micros) and it works just fine without errors. In the new fcf i have connected LCD display in left side pins of micro (RC5,RC4,RC3,RC6,RC7,RB7) by leaving free pin RA.3 which is also the MCLR input of P16F690. In Expert configuration table, i have configured MCLR as Internal, you can change it (during experiments a MCLR external switch is usefull) in external, and when you will complete the correct injection times you can change it again in internal. Switches again are active LOW, no need for external pull-up resistors, you simply have to connect one of their terminal in GND. Run the project in simulator to try it, it runs just fine. Reset switch i think is usefull, you can zero the counter at any time to turn back in 0.0ms time.
Good luck
Fotis
Attachments
flowbench controller 1ms to 24ms V5.fcf
(67.63 KiB) Downloaded 275 times
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

Hi Brandon
In the attached fcf you can see in Macro "SWstate" a different option of how we can use the "Switch" icon instead "Decision"; the result obtained is the same.
I hope will be usefull to you.
Thanks for your attention.
Fotis
Attachments
flowbench controller 1ms to 24ms V6.fcf
(68.15 KiB) Downloaded 276 times
Last edited by fotios on Tue Sep 06, 2011 10:16 pm, edited 1 time in total.
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

Here is the circuit diagram of project. I hope that will be usefull to you, especially in connections of LCD display.
Thanks for your attention
Fotis
Attachments
Brandon Injector1.jpg
Brandon Injector1.jpg (204.29 KiB) Viewed 11724 times
Best Regards FOTIS ANAGNOSTOU

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

wow thats alot of work, its gonna take me a while to understand everything, i havent progressed to the point of displays yet other than the one you seen of the counter pcb which doesnt count because it logic and 7 segment, its something new and is gonna be fun, how do i make the injection counter part work with the display counter, is that two chips? now this may sound funny but im a newbie--> this is a theoretical question, if there is 18 pins on the chip and you could break that down to 9 inputs and 9 outputs by setting pins up that way, so there would be 9 different programs running at the same time,is that possible? if so i have no clue how it could be done if the flowcode is only written in a vertical line from top to bottom that goes from step 1 to step 2 to step so on, i dont think it can be because there is only one W register, it would have to run everything in a line like written in flowcode, so it would have to do the programs interwieved together as one(yea im confusing myself here since i dont know what im talking about yet) a go to box cant run two pins programs at the same time can it? go to boxes are just ends of desisions where one desion can go to if the situation arises, like a way to make everything neat and small, is the correct

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

As for the not working above 24.
That is only because you have not got a decision for above 24
sorry about that i misunderstood, i though you were saying that there was a limitation above 45 that it will only output high if above that number.... i understand what you mean now it was my bad, i accidently skipped one number in the beginning and for that location it didnt create and output, then it dawned on me quickly what the problem was
Reason Voltage = (50*Voltage)/255 is used because the actual formula is V_Supply*ADC_Bytes/255
So if ADC_Bytes = 127 then voltage on the i/p pin = 5*127/255= 2.4
cool thanks for the explaination, i will definitly use both forumulas a bunch in future- eventualy i want to as a hobby make a engine controller with pic chip with inputs tps,map,coolant temp, one pulse cam sensor or dividing it with flipflops or counters to make one pulse controlling open loop fuel injectors that are batch fired, i did in past a simple version of it with a 555 timer and a map sensor, negaitve triggering on the cam signal, car ran amazingly smooth but rich, but lacked the quick tps change enrichement, and temp compensation, i think the new layout that fotios has done has clues in it for me to use on this project later in the way he used the switch inputs

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: values?

Post by medelec35 »

medelec35 wrote: As for the not working above 24.
That is only because you have not got a decision for above 24, otherwise it will work.
Oops
I meant
'As for the not working above 45.
That is only because you have not got a decision for above 45, otherwise it will work.'
Sorry got 24 on the brain.
I have corrected my post.

brandonb wrote: if the flowcode is only written in a vertical line from top to bottom that goes from step 1 to step 2 to step so on, i dont think it can be because there is only one W register, it would have to run everything in a line like written in flowcode, so it would have to do the programs interwieved together as one(yea im confusing myself here since i dont know what im talking about yet) a go to box cant run two pins programs at the same time can it? go to boxes are just ends of desisions where one desion can go to if the situation arises, like a way to make everything neat and small, is the correct
Yes you are correct, only one operation is carried out at the time, but its the speed it does it and the use of interrupts, which makes it look like it's multitasking.
For instance if you have a delay of 500ms, and the program has halted there waiting for time to elapse, in the background an interrupt could have fired, either pin based or timer based, making an output go high, during this 500ms pause.
Normally your code will be running at osc/4 speed. so at 8MHz for example code is carried out every 1/(8x10E6/4) = 500nS = 0.5uS


Martin
Martin

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

martian- is there any documentation in specific that i can refer to to understand what an interupt is and how it works

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: values?

Post by medelec35 »

brandonb wrote:martian- is there any documentation in specific that i can refer to to understand what an interupt is and how it works
This would be a good place to start:
http://www.matrixmultimedia.com/mmforum ... =36&t=6390
Then just have a play with timer and port interrupts. If you get stuck, just post your flowchart ,and ask away.
See if you can create a simple clock and understand how it works using timer interrupt as a challenge to get to started.
That way it reinforces your understanding of interrupts.

Martin
Martin

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

i wanted to use interupt on this to be able to "speaking in electronics" edge trigger the switch so the switch can turn the output on for 10m/s then waits for switch to have another positive edge again edge .... you may think im learning the stuff backwards but im trying to with the pic chips recreate the concepts of what i can do with simple 555 timer chips and logic gates http://dl.dropbox.com/u/10367218/trying ... terupt.fcf

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

brandonb wrote:i wanted to use interupt on this to be able to "speaking in electronics" edge trigger the switch so the switch can turn the output on for 10m/s then waits for switch to have another positive edge again edge .... you may think im learning the stuff backwards but im trying to with the pic chips recreate the concepts of what i can do with simple 555 timer chips and logic gates http://dl.dropbox.com/u/10367218/trying ... terupt.fcf
Hi Brand
I modified your fcf for a demonstration of what exactly means "Interrupt". We have a program that runs 3 red Leds continuously in this sequence: RB4-->RB5-->RB6-->RB4-->... and so on. If we press switch RB7 which is modified to trigger the Interrupt, then the current flow of program stops and is called the related ISR (Interrupt Service Routine) "RB7_INT" which turns on the green Led for 1sec (see delay) and then off. After the pass of 1sec time, the ISR is finished and the program returns in its normal flow. That is the interrupt logic in its simplest form. I hope gave you an idea.
Cheers
Fotis
Attachments
trying to use interupt_mod.fcf
(10 KiB) Downloaded 192 times
Best Regards FOTIS ANAGNOSTOU

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

alright, so it works backwards from the way i though.... is it possible for me to make it loop once everytime a positive edge comes in on a pin only.... like a 555 timer chip in monostable mode, what im trying to do here is reproduce a fuel injection controller that runs a car that i made with a timer chip and other chips that runs on a map sensor to control pulsewidth but it only fires the injector loop once everytime the one pulse cam sensor positive edge is seen

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

brandonb wrote:alright, so it works backwards from the way i though.... is it possible for me to make it loop once everytime a positive edge comes in on a pin only.... like a 555 timer chip in monostable mode, what im trying to do here is reproduce a fuel injection controller that runs a car that i made with a timer chip and other chips that runs on a map sensor to control pulsewidth but it only fires the injector loop once everytime the one pulse cam sensor positive edge is seen
Hmmm... Let me think for a while. If i remember well, the MAP sensor measures the pressure (or better the vacuum) inside the manifold and if is less than 1bar (i think 0.8?) that means the throtle is closed and if is equal to 1bar (or equal to atmosphere pressure) means that throtle is open. From those i remember from the engine of my retired BMW 318i managed by a Bosch LE-Jetronic ECU, the system uses an air-flow meter to calculate the engine load by measuring the speed of incoming air. Yes, it should do the same function like MAP. Please correct me if i am wrong. So MAP is for control the injection time (pulse width). The other sensor, the CAM is mounted on the camshaft and produces signals according to the rotation angle (or phase of engine rotation) to activate the corresponding injector. That is, the two main parameters of a working engine, timing and mixture mass. Am i correct so far? If yes, give me some time to think a Flowchart.
Cheers
Fotis

P.S. I have to remember you that you don't take into account the air temperature, it is of big importance for the correct calculation of the air-fuel mixture.
Best Regards FOTIS ANAGNOSTOU

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

i have a plan with this, if i edge filter using gates with r/c time for the switch input then it would all work out fine,http://dl.dropbox.com/u/10367218/LOGIC% ... TRICKS.asc as long as my input is not longer than the minimum pulsewidth and not smaller than how long it takes to run loop with switch off= 1 micro second per icon(clock divided by four per icon) the plan at this stage of developement is to get car to run when hot through all slow throttle transistion ranges using 1x cam signal and map sensor as inputs for timing and load, i could use crank and cam if i wanted sequel by using d flipflop to synchronize the two and counters to divide the injection signal out, then im gonna add intake air compensation to the mix to adjust for different times of the season, i live in the arizona desert so its always 100 degrees :lol: then add tps for quick throttle changes(extra squirt) and later a cold start program, .... its all open loop control

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

brandonb wrote:i live in the arizona desert so its always 100 degrees :lol:
Woah! :( Man, you are lucky. I live in north Greece where the winter is very hard, i need arround 2,500 lt diesel fuel per season to warm my home. Past winter diesel price was 0.82 Euro (1.15 USD) / lt X 2,500 = 2,050 Euro (2870 USD). Due to Greek economic crisis, government increases taxes on everything, so we expect a price of 1.2 Euro (1.68 USD) / lt X 2,500 lt = 3,000 Euro (4200 USD! :cry: ).
OK, lets back to the project. I will try in weekend, stay tuned.
Fotis
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

Hi Arizona
Brandon, lets take things from the beginning:
1) MAP (Manifold Air Pressure) sensor produces a voltage output which is proportional to the air pressure in manifold intake. Accordingly, this voltage is translated by the ECU (or ECM) in pulses which of width is proportional to voltage. Actual measurements of MAP show that in iddle (closed throtle) pressure drops down to 0.8bar = 80KPA as much. In WOT state, manifold pressure increased at 1bar = 100KPA.
2) CAM sensor (Camshaft position) provides the correct timing in ECU to activate injectors.
I modified the last fcf so you can simulate this function on workbench: a) Switches B4 and B5 do the same function, simply i renamed them in MAP+ (map goes increased--> pulse width increased) and MAP- (map goes decreased--> pulse width decreased) b) Switch B6 renamed to CAM and simulates the function of cam sensor.
The FlowChart is also changed: while MAP+ and MAP- are allways active (you can adjust the pulse width continuously in the desirable value) the Output C2 is activated each time CAM switch is pressed.

From a second view, you can connect the output of an actual MAP to an analog input of micro and the output of an actual CAM in B6 input of micro. Simply, you have to callibrate the reading of ADC input to be in correspondence with actual injection pulses. You can also use 4 outputs of micro (insted one) to manage 4 injectors. Thus you could have a ECU unit in its simplest form :mrgreen:
Cheers
Fotis
Attachments
flowbench controller 1ms to 24ms V6.fcf
(67.63 KiB) Downloaded 189 times
Last edited by fotios on Sun Sep 11, 2011 7:12 am, edited 1 time in total.
Best Regards FOTIS ANAGNOSTOU

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

hey fotis what if we switch places for a couple days, i could use a two day deep freeze, diesel over here is abit pricy around $4.80 gallon, dont mean to make you jeleous on this but in 10 years that i've lived in az i've never turned my house heater on :lol: i know this can get confusing but you have to remember what im trying to do is learn a few concepts that i will be using often, nice drawing, you get more complex with the progressing drawings.... in the post there are 2 things i am doing a injector flowbench and a pcm, alot of the future project have the same kind of details with adc or switches

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

Hey brand, how is going over there from rattlesnakes ? :lol:
Lets back to topic. I think that you will find the last fcf more flexible. Try it in simulator. The main difference is that: now you can adjust pulse width without activating injector. Once the desirable pulse width has been adjusted, you can press CAM switch as many times as you want and the injection time will always be same. In this way, you can check again and again an injector for a specific time.
Happy weekend plenty of beers :mrgreen:
Fotis
Best Regards FOTIS ANAGNOSTOU

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

hey fotis- i rigged it up on my car and it does weird things, i'll have to throw the picoscope on it later, but what i suspect is that it needs extra filtering, when i ran my car off the timer chip i had the same issues with double triggering on noise when i used the map sensor and cam sensor in the same fashion... i'll get back on the flowbench for now, its one of those things i dont want to ruin my cat converter dialing in.... im working on the display deal now trying to reverse engineer what you did

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

fotus- the way you did the lcd display was confusing, your the man so i know you did it that way for a reason....i hacked it up a bunch and came up with this? can i do it this way? it seems to have no screen flicker, but does have this weird deal where i get extra letters when i make a full rotation?
Attachments
can i do it like this.fcf
(10.5 KiB) Downloaded 178 times

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: values?

Post by fotios »

Hi Brandon
You should know that the LCD printing is a seperate task. You should not mess up it with the pulse output task. Otherwise LCD might shows wrong indications. The attached fcf is the corrected version.
Fotis
Attachments
You can do it like this.fcf
(17 KiB) Downloaded 181 times
Best Regards FOTIS ANAGNOSTOU

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: values?

Post by brandonb »

alright its starting to make sense except a couple points... i dont understand the voltage change decision (if voltage above or below OLDvoltage)? next- how can the decision variables be the same (voltage= ) for the pulse section and display section....... next- what is the OLDvoltage calculation, is that there because you cannot have to variables with the same name so you named it old but is referencing the original voltage pid making all the voltage= decisions work off the same voltage=2*voltage/255 calculation?........ and why is the old voltage calculating box after the display that has already run? ..... thank you for putting up with my non sense

Post Reply