Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <xc.h>
- #define _XTAL_FREQ 8000000
- #include "flex_lcd.h"
- #include <stdio.h>
- // CONFIG
- #pragma config FOSC = XT // Oscillator Selection bits (XT oscillator)
- #pragma config WDTE = OFF // Watchdog Timer (WDT disabled)
- #pragma config PWRTE = OFF // Power-up Timer Enable bit (Power-up Timer is disabled)
- #pragma config CP = OFF // Code Protection bit (Code protection disabled)
- void main(void) {
- TRISA =12; //12=01100
- PORTA =0; //LIMPIAR RESIDUOS
- int a=0;
- if(PORTAbits.RA2==1 || PORTAbits.RA3==1){
- }else{
- Lcd_Init();
- Lcd_Cmd(LCD_CLEAR);
- Lcd_Cmd(LCD_CURSOR_OFF);
- Lcd_Out(1,1,"sistemas77C");
- a2=1;
- a=0;
- }
- if(PORTAbits.RA2==1){
- if(a==0){
- Lcd_Cmd(LCD_CLEAR); //limpiar lcd
- Lcd_Cmd(LCD_CURSOR_OFF); //apagar cursor
- Lcd_Out(1,1,"sentido de motor");
- Lcd_Out(2,2,"izquierda.");
- }
- a=1;
- PORTAbits.RA0=1;
- PORTAbits.RA1=0;
- __delay_ms(1000);
- }else if(PORTAbits.RA3==1){
- if(a==0){
- Lcd_Cmd(LCD_CLEAR); //limpiar lcd
- Lcd_Cmd(LCD_CURSOR_OFF); //apagar cursor
- Lcd_Out(1,1,"sentido de motor");
- Lcd_Out(2,2,"derecha");
- }
- a=1;
- PORTAbits.RA1=1;
- PORTAbits.RA0=0;
- __delay_ms(1000);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement