You are hereCódigo en C, para el robot CARMIX

Código en C, para el robot CARMIX


witsuk's picture

By witsuk - Posted on 21 February 2009

 

 Para todos aquellos que quieren armar el robot seguidor de lineas CARMIX, aqui les envio el codigo fuente hecho en un compilador gratuito. El PIC C lite, es una compilador que soporta los microcontroladores de Microchip y es totalmente gratis para los variantes de PIC16.

 

 

/*
ROBOT SEGUIDOR DE LINEA BLANCA
SOBRE FONDO NEGRO: “CARMIX”.
Jacob J. Vásquez Sanjuan
jacobvasquezs@msn.com
*/

/*

Ya esta con PWM y sigue la linea p16
se le reduce la velocidad en las curvas


*/

#include "robot03.h"

void timer0(char j);
void PWM(unsigned char,unsigned char);
static void interrupt isr(void);
unsigned char siga=1,cont=0;;

void main()
{
unsigned char i,BAND=0;
unsigned char conta;
TRISA=0x1F;
TRISB=0x00;
OPTION=0x02;
GIE=1;
T0IE=1;

DIR1=ADELANTE; DIR2=ADELANTE; /* CONTINUA*/
PWM1=PWM2=TRUE;
FRENO1=FRENO2=FALSE;/*SIN FRENO*/

while(1)
{
if (SENSOR1==TRUE & SENSOR2==TRUE) /*  2 SENSORES EN LA LINEA */
{   
PWM(90,90);
}

if (SENSOR1==FALSE & SENSOR2==TRUE) /* SENSORES EN LA ORILLA*/
{
PWM(90,45);
BAND=0;
}

if (SENSOR1==TRUE & SENSOR2==FALSE) /* SENSORES AFUERA*/
{
PWM(45,90);
BAND=1;
}
if (SENSOR1==FALSE & SENSOR2==FALSE)/* SENSORES AFUERA*/
{
if(BAND==1)
{
PWM(20,70); 
}

else if(BAND==0)
{
PWM(70,20);    
}
}
}
}

void timer0(char x){
TMR0=x;
while(siga);
siga=1;
}

static void interrupt isr(void){
if(T0IF==1){
siga=0;
T0IF=0;
}
}  
void PWM(unsigned char x, unsigned char y){
unsigned char i;
PWM1=PWM2=TRUE;
if(x<y){
for(i=0;i<x;i++)
timer0(0XFF);
PWM1=FALSE;
for(i=0;i<y-x;i++)
timer0(0XFF);   
PWM2=FALSE;
for(i=0;i<100-y;i++)
timer0(0XFF);   
}
if(y<x){
for(i=0;i<y;i++)
timer0(0XFF);
PWM2=FALSE;
for(i=0;i<x-y;i++)
timer0(0XFF);
PWM1=FALSE;
for(i=0;i<100-x;i++)
timer0(0XFF);   
}
if(x==y){
for(i=0;i<x;i++)
timer0(0XFF);
PWM1=PWM2=FALSE;
for(i=0;i<100-y;i++)
timer0(0XFF);   
}   
}


AdjuntoTamaño
robot16.zip

To research the this post was not simple and perfect way out is to buy essays at the custom writing service.
The introductory program combines studies of Andean culture and literature, past and present, with language studies in Quechua. The objective of this eight-week course is for students to learn to comprehend, speak ecommerce hosting, read, and write Quechua, as well as understand the culture and role of the Quechua-speaking populations in Andean society. Students may choose to take either elementary or continuing Quechua, or both of the culture courses. Language courses will be taught by Luis Morató Peña, a native of Cochabamba, Senior Lecturer at Cornell University, and textbook author, while literature and culture courses will include José Edmundo Paz-Soldán. Read More Aymara (Bolivia): The University of Chicago The FLAS-eligible Aymara summer institute offers intensive 9-week instruction in introductory spoken Aymara budget hosting, an indigenous language spoken by 1.8 million people primarily in Bolivia with smaller populations in Peru, Chile and Argentina. Instruction utilizes the text Aymar Arux Akhamawa and its accompanying CD-ROM dialogues, written and produced by the course instructor, as well as a wide variety of authentic cultural materials including film, literature, music, visual and mass media. Students acquire proficiency in formal language structures, conversation, aural and writing skills, and grammar. Instruction contextualizes Aymara language within its culturally-specific context. The course is appropriate for master’s, doctoral, and advanced undergraduate students, particularly, though not exclusively, those in the fields of Andean anthropology and history, as well as students in linguistics adult hosting. Read More Bolivian Quechua: Cochabamba, Bolivia through Florida International University Intensive basic Bolivian Quechua courses are offered as part of a larger Andean Studies Program. In addition to Quechua language courses, students can select from a number of graduate-level Andean area studies courses offered by Florida International University and Universidad Privada Boliviana (UPB) and/or conduct research at Fundación Inca, one of the region’s largest private research libraries with over 110,000 volumes and 5,000 periodicals on the Andes (Chile, Bolivian, Peru, Ecuador website templates, Colombia, Venezuela). Classes are conducted in Cochabamba at Fundación Inca or UPB. Intensive basic Quechua classes are held four hours per day, Monday-Friday, in each six week mini-semester during the above dates. Sponsored weekend trips allow students additional practice with the language and immersion in Andean culture. Independent study courses for intermediate and advanced Quechua instruction are also available. The Andean Studies Program is offered year round with regular (3 hour, 2 days/week) basic and intermediate and independent study Quechua courses also offered in September-December and January-April sessions. Read More
Thanks, at last that has found that wished to read here. By the way, I have drawings on this theme.Evden eve nakliyat , Where it is possible to throw off?evden eve nakliyat

Recent comments

Who's online

There are currently 0 users and 8 guests online.

Who's new

  • drlf24
  • grom759
  • rauli212
  • Waifemyjoiniagoatn
  • miffAcimeWaceceletpo