Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] stuck programming delays

Status
Not open for further replies.

MODCHIP

Junior Member level 3
Junior Member level 3
Joined
Feb 13, 2008
Messages
29
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Visit site
Activity points
1,495
hello evrybody help please

i have to make a commande in 15 valves

im using pic 18f452 at 20mhz

the fact is the way of opning this valves (i mean in programmation not pratique )

the problem is

each valve have a variable opning time from 0 to 9 like this

0= 0.00s
1=0.10s
2=0.14s
3=0.20s
4=0.28s
5=0.39s
6=0.54s
7=0.76s
8=1.10s
9=1.50s

s mean second this is the time that the valve must be keep open
other thing that all the valve have another parameter wich is

how many opening time in one minute

this parameter can be between 00 and 64

Exemple for one valve that have the parametre :
3 = 0.20s and have 15 times opened in minute

so it will be have a square wave that have 15 on 1 logic and 15 off 0 logic

this square wave for the "1" logic 0.20s and the "0" logic is 3.8s

i have this equation (60/opning times ) - the opning time

so i m stuck how to programm this by generate all 15 valves with each one have a particular opening time


excuse me for my bad english

please help
 

This is how I would do it:

1. Use a timer to generate an interrupt every 0.01 seconds (10mS).
2. At each interrupt, subtract 1 from an 8-bit variable for each valve until the variable reaches zero.
3. If the variable holds >0, turn the valve on, if it is zero turn it off.

This will give you a counter for each valve that can hold 0 - 255 (0s to 2.55 seconds) that automatically counts down to zero then stops. When the value is above zero the valve turns on, when it reaches zero it turns off. By loading the appropriate timer with a value it will turn the valve on for that value * 10mS then turn it off again. Each valve will be individually controllable in 10mS steps and can run independantly of the others.

What language are you writing the program in?

Brian.
 

thank s freind
i m working with ccs compiler 4.110

"This will give you a counter for each valve that can hold 0 - 255 (0s to 2.55 seconds) that automatically counts down to zero then stops. When the value is above zero the valve turns on, when it reaches zero it turns off. By loading the appropriate timer with a value it will turn the valve on for that value * 10mS then turn it off again. Each valve will be individually controllable in 10mS steps and can run independantly of the others."

but really i do not undrestand

if you can please more simple for me i will post tow exemple of what i want

- - - Updated - - -

Sans titre.png

this is an exemple for tow parametre the nbre impulsion is commun for all valves and the opening time is variable betwen a valve and another
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top