Entradas

Mostrando las entradas de febrero, 2015

Lab 8, Shape the World "SwitchLEDInterface"

En este Lab se hizo un ejemplo de una alarma, en mi caso recicle codigo que habia usado en los labs anteriores. El jueves pasado (Febrero 19) subieron una noticia, diciendo que este Lab8 y el Lab10 no activarian el scope y daban algunos pasos para poder agregarlo en dichos Labs, esto me dio problemas ya que las funciones del Timer4 no estaban implementadas dentro de una funcion que debiamos de invocar (TExaS_Scope();), asi que no la agregue, al final no influyo en el grader. Los pasos que tenia que seguir el sistema son: • Hacer PE1 salida y PE0 entrada. • Iniciar con el LED encendido (PE1 = 1). • Esperar 100 ms • Al presionar un switch (en mi caso lo llame boton, ubicado en PE0) toggleara el LED ubicado en PE1 cada 100ms. • Repetir los pasos 3 y 4 una y otra vez. Este es parte del codigo (las declaraciones de las funciones estan afuera del main), no era muy dificil, pero por no poder estudiar entre semana se me olvidaron algunas cosas XD. int main(void){ //********

Lab 7, Shape the World

En el laboratorio numero 7 del curso en linea de TI "Shape the World" seguimos haciendo uso de delays, leds y el switch con los que cuenta la placa. La función para generar el delay me causo problemas, aun ignoro el porque, para hacerla funcionar la borre y escribi exactamente lo mismo -.-. Con este codigo obtuve los 45/45 puntos en la simulacion del laboratorio, no lo pude checar en el hardware real ya que no tengo la placa. // 0.Documentation Section // Lab7_HeartBlock, main.c // Runs on LM4F120 or TM4C123 LaunchPad // Input from PF4(SW1) is AS (atrial sensor), // Output to PF3, Green LED, is Ready, // Output to PF1, Red LED, is VT (ventricular trigger) // Make PF4 input, PF3,PF1 output // Initialize Ready to high and VT to low // Repeat this sequence of operation over and over // 1) Wait for AS to fall (touch SW1 switch) // 2) Clear Ready low // 3) Wait 10ms (debounces the switch) // 4) Wait for AS to rise (release SW1) // 5) Wait 250ms (simulates the time b

Iniciando con la KL25Z

Imagen
Primeros pasos con la placa FRDM-KL25Z de Freescale. Tutorial para poder usar la FRDM - KL25Z board en Windows 8.1. Para maquinas con Windows anteriores podemos usar los pasos descritos en el Quick Start package . Igualmente sera muy util tener a la mano el esquematico de la placa, ya sea la Rev E o la Rev  F (solo cambiaron el C12 de 1uF a 0.1uF).

Lab 5, Shape the World

Imagen
Codigo que use en el Lab 5 del curso de TI Shape the World // ***** 0. Documentation Section ***** // main.c // Runs on TM4C123 // UART runs at 115,200 baud rate // Daniel Valvano // June 17, 2013 // Lab 5 // Jon Valvano and Ramesh Yerraballi // November 21, 2013 // ***** 1. Pre-processor Directives Section ***** #include // standard C library #include "uart.h" // functions to implment input/output #include "TExaS.h" // Lab grader functions // ***** 2. Global Declarations Section ***** // FUNCTION PROTOTYPES: Each subroutine defined unsigned long Calc_Area(unsigned long l, unsigned long w); void EnableInterrupts(void); // Enable interrupts // ***** 3. Subroutines Section ***** int main (void) { unsigned long length, width, area; TExaS_Init(UART_PIN_PA0,UART_PIN_PA1); // this initializes the TExaS grader lab 5 UART_Init(); // initialize UART for printing printf("\nThis program calculates areas of rect

PsoC 4xxx

Imagen
Los microcontroladores de Cypress no son tan comunes o no he podido encontrar tanta información como los de otras compañias, pero este blog digitalprojects nos ayuda bastante para dar los primeros pasos con estos micros, usando las placas de entrenamiento como la Psoc 4 (Pioneer) y la Prototyping kit.

Lab 6, Shape the World

En el Lab6 nos piden prender el Led Azul desde la configuración del PORTF. Dentro del main debemos chequear el estado del Sw1, si esta presionado, el Led Azul debe flashear, si no esta presionado el Led debe quedarse encendido. Configuracion del PORTF void PORTF_Init (void){ volatile unsigned long delay; SYSCTL_RCGC2_R |= 0x20; //Enable PORTF clock delay = SYSCTL_RCGC2_R; GPIO_PORTF_AMSEL_R &= (~0x14); //Clear PF4 and PF2 on AMSEL GPIO_PORTF_PCTL_R &= (~0x14); //Clear PF4 and PF2 on PCTL GPIO_PORTF_DIR_R &= (~0x10); //Set PF4 as input, PF2 as output GPIO_PORTF_DIR_R |= 0x04; GPIO_PORTF_AFSEL_R &= (~0x14); //Clear PF4 and PF2 on AFSEL GPIO_PORTF_DEN_R |= 0x14; //Set PF4 and PF2 on DEN GPIO_PORTF_PUR_R |= 0x14; //Set PF4 and PF2 on PUR GPIO_PORTF_DATA_R |= 0x04; //Set PF2 in DATA so the LED is initially ON } Solución al Lab6 del curso Shape the World de T.I. // BranchingFunctionsDelays.c Lab 6 // Ru