Hi, Foodie

Something like that ???

http://www.vgies.com/downloads/EME31_TD4_enonce.pdf

...

remember : Google is your friend ...

Alain

PS: BTW : which programming language, max speed and deceleration of your device, solenoid characteristics ... etc, etc, etc ...

RePS : It's YOUR Homework, no ??? ... Help on How to realize the " functions " in PIC Language is a Honorable Forum matter ...

Doing YOUR Work means you give us money .... Ok ???