1 / 11

Introduction to Using MPLAB and Hi-tide

Introduction to Using MPLAB and Hi-tide. Group #9 Jose Alex Mike Roberto Goto http://www.alexhan.net/senior.html and print the file. Purpose of Programs. Cgywin is to emulate Linux to run the other programs

perrin
Download Presentation

Introduction to Using MPLAB and Hi-tide

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Using MPLAB and Hi-tide Group #9 Jose Alex Mike Roberto Goto http://www.alexhan.net/senior.html and print the file

  2. Purpose of Programs • Cgywin is to emulate Linux to run the other programs • Picc lite and Hi-tide are the environment to write your code for programming the microcontroller and converts to Hex • MPLAB is software that allows the codes to be transferred to the microcontroller

  3. Program Code • Motor Control • IR Sensor • Key Debouncer

  4. LED On #include "init.h"// included by C-Wiz #include <htc.h> void main(void) { init();// Function call inserted by C-Wiz while (1){ RA0=1; //TODO Auto-generated main function } }

  5. LED flashing 5 sec int i,k; void main(void) { init();// Function call inserted by C-Wiz while (1){ k=0; while (k<1000){ i=0; k++; while (i<1500){ i++;} } RA0=RA0^1; } }

  6. LED Flashing w / Interrupts // Interrupt service routines #include <htc.h> externint k; void interrupt my_isr(void){ /***** Timer 1 Code *****/ if((TMR1IE)&&(TMR1IF)){ if(k>50) { k=0; RA0=RA0^1; } else k++; TMR1IF=0;// clear event flag } }

  7. Conflict With Loop 5 Second LED flip-flop And Key Debouncer running in main.c

  8. Key Debouncer i = 0; // Wait 20 ms for Button Down while (i < Twentyms) if (1 == RA3) // Button Up / Start over i = 0; else // Button Down /Increment Count i = i + 1;

  9. Motor Control main(void) { init();// Function call inserted by C-Wiz while (1){ RA0=RA0^1; i=0; while(i<10) { i++; k=0; while(k<3000) {k++;}} //CCPR1L= 0b01111111; A=A+1; CCPR2L= A; if(CCPR2L==0XFF) CCPR1L=~CCPR1L;

  10. IR Sensor #include "init.h"// included by C-Wiz #include <htc.h> void main(void) { init();// Function call inserted by C-Wiz while (1){ if(RB2==1) RA0=0; else RA0=1; //TODO Auto-generated main function } }

  11. The End Thanks Ya’ll Email or get in touch with us for more information or questions.

More Related