I am trying to learn how to use C to control PIC16C57 Microcontroller chip that is built into the BASIC Stamp 2. I have a decent, although beginner's yet, understanding of how to write code in C, but I have had no training as of yet with interfacing with hardware from C. In the end, I would like to control a simple 12V DC motor. Forward, backward, and with 3 speed settings. I have already designed the circuit necessary to drive the motor, now I just need help writing the code to control 3 pins. I was planning on using PWM for the speed control, but have been unable to find any information how to do it for someone who is just learning about this subject. Any help is appreciated. Thanks!