Pic concurrent processes????

Thread Starter

raidermanz

Joined Aug 14, 2007
32
Hello,

I am in need of assistance with a project I am working on which I am using a pic 16F877A. I need a dynamic action to occur when triggered by a sensor while still being able to use the user interface to change variables which control the timing of this action. Basically, I am opening a solenoid through a transistor when a proximity sensor detects an object, with the duration of the opening being controlled by the user input variables. Should I use a 555 type timer to operate the valve and send the timing variables to the 555 so that the operation of the valve continues and changes only when the user actually sends the updated variable? I hope this makes sense, if anyone can offer assistance, it will be appreciated. I am very new to the electronics world, and I am forced to shortcut some of the learning curve. I am working in the C compiler from CCS, so some of the assembler language and hex files are above me.

Thanks
 

beenthere

Joined Apr 20, 2004
15,819
If the valve pops open on proximity detection and then closes based on user input of some sort, the PIC can handle this. If you can use one input to get the signal to operate the solenoid, then another (or several others) can look for the closing conditions.

As a hint, make up a flow chart to diagram how the valve should operate. The code in the PIC implements the conditions stated in the flow chart.
 

Thread Starter

raidermanz

Joined Aug 14, 2007
32
If the pic is causing the valve to go "on" based on a variable delay after the prox sensor detects, and is causing the valve to stay on for a variable period of time before shutting "off", which may happen many times per second, and once an hour (for example), the user wishes to access these variables to either view or change without interrupting the function of the valve, I am not sure exactly how to make this happen. If the user accesses these variables, in my limited code writing ability, my valve process stops until the user is done manipulating variables. If it takes the user 10 minutes to decide on the variables he would like, I would like the valve to continue to run for those 10 minutes and the variable change would only be implemented upon the user exiting the menu. Can the pic still handle this with some basic code, or would it be easier from a programming standpoint to use an external device to operate the timing circuit and write the variables to that location when the user exits??

Thanks for any help you might be able to provide. It is appreciated.
 

Thread Starter

raidermanz

Joined Aug 14, 2007
32
but the repeated actuation of the valve is necessary as the user will only be changing timing intervals periodically, while the valve open/close process is working rapidly constantly. I think I can set a timer interrupt to work off of the variables which the user will be changing.

Thank you for your help.
 

RiJoRI

Joined Aug 15, 2007
536
First, what is the user interface to be? If it is switches, then the problem is a lot easier (just read the switch for the value). Asynchronous serial communication is probably the most difficult, with synchronous serial comms (e.g., I2C) being a little easier. In either case, use hardware flow control for the serial comms.

You will probably need to look into using interrupts: at least one external input for the sensor. If there is an internal timer, it can be used for task swapping. If the timer does NOT generate an interrupt, you'll need to look into "co-operative multitasking."

If this seems a little vague, it's because the last time I looked at a PIC chip, Microchip was quite proud that they now had interrupts!

--Rich
 
Top