Category Archives: PIC

Stepper motion control from signals on SD card (co-author: Mark Flanagan)

Note: This post is co-authored by Mark Flanagan. Mark is blogging about his final-year project here and has also posted a really interesting account of his preliminary investigative work here. Mark’s project concerns the development of a fascinating robotic simulator … Continue reading

Posted in PIC, Uncategorized | Tagged , , , , , , , , | Leave a comment

Analog-to-PWM Conversion with the PIC18f4620

The main function below is reproduced with the kind permission of Robert Byrne who is using it in an Instrumentation project. His program is an adaptation of my PIC18F4620 template code that I posted recently, so to form a complete … Continue reading

Posted in PIC | Tagged , , , , , , , , , , | Leave a comment

Template Code for the PIC18F4620

I’m writing a new template program for the PIC18F4620, for use in our RoboSumo module and other projects. The template program basically sets up a few frequently used features – e.g. digital inputs, digital outputs, analog inputs, serial communication, PWM … Continue reading

Posted in PIC | Tagged , , , , , , , , , | 4 Comments

Timer 1 Interrupt Example for the dsPIC30F4011

// // This is a Timer 1 interrupt example for the dsPIC30F4011. // Timer 1 is a 16-bit Type A timer. // It toggles an LED on pin RD0 8 times a second. // // Written by Ted Burke – … Continue reading

Posted in PIC | Tagged , , , , , , | 5 Comments

Analog input on the dsPIC30F4011

The following example program demonstrates basic analog input on the dsPIC30F4011. Only one of the ADC module’s four converters is used (AD0) and only one channel at a time is read. The sampling time is controlled manually and is currently … Continue reading

Posted in PIC | Tagged , , , , , , | 15 Comments

Some C code for the dsPIC30F4011

This is the C code from my main.c file: #include <p30f4011.h> _FOSC(CSW_FSCM_OFF & FRC_PLL16); _FWDT(WDT_OFF); int main() { long int n; TRISD = 0b11111110; LATD = 0; for(n=0 ; n<5000 ; ++n) { if (_LATD0) _LATD0 = 0; else _LATD0 … Continue reading

Posted in PIC | 11 Comments