150 likes | 289 Views
OptiFlex. Asad Chaudhry Guthrey Coy Brandonn Gorman. Review of Project Objectives/Goals. Develop a “self-aware” fiber optic mesh that is conscious of its current state (temperature, shape, strain, etc.) by using Bragg graded fiber Display the data on a monitor. FBG. Block Diagram.
E N D
OptiFlex Asad Chaudhry Guthrey Coy Brandonn Gorman
Review of Project Objectives/Goals • Develop a “self-aware” fiber optic mesh that is conscious of its current state (temperature, shape, strain, etc.) by using Bragg graded fiber • Display the data on a monitor
Block Diagram Optical Processing I/O
Completed Code void lcd_init( void) { usleep(15000); /* Wait for more than 15 ms before init */ /* Set function code four times -- 8-bit, 2 line, 5x7 mode */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x38); usleep(4100); /* Wait for more than 4.1 ms */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x38); usleep(100); /* Wait for more than 100 us */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x38); usleep(5000); /* Wait for more than 100 us */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x38); usleep(100); /* Wait for more than 100 us */ /* Set Display to OFF*/ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x08); usleep(100); /* Set Display to ON */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x0C); usleep(100); /* Set Entry Mode -- Cursor increment, display doesn't shift */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x06); usleep(100); /* Set the Cursor to the home position */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x02); usleep(2000); /* Display clear */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x01); usleep(2000); } char convert_int_to_char(int x) { if (x >= 0 && x <= 9) return (x + '0'); else { convert_int_to_char(x/10); return (x%10 + '0'); } } #include "system.h" #include "sys/alt_irq.h" #include "altera_avalon_pio_regs.h" #include "altera_avalon_timer_regs.h" #include <stdlib.h> #include <unistd.h> //e.g. //usleep(5000000); is 5 seconds #include <stdio.h> #include <io.h> #include <altera_avalon_uart_regs.h> #include "priv/alt_busy_sleep.h" #include "altera_avalon_lcd_16207_regs.h" #define LCD_WR_COMMAND_REG 0 #define LCD_RD_STATUS_REG 1 #define LCD_WR_DATA_REG 2 #define LCD_RD_DATA_REG 3 void lcd_disp ( char k[], inti, char g[], int u){ int j; /* Set the Cursor to the home position */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x02); usleep(2000); /* Display clear */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x01); usleep(2000); for(j = 0; j < i; j++){ IOWR(LCD_0_BASE, LCD_WR_DATA_REG,k[j]); usleep(100); } /* Set the cursor to the second line * * */ for(j = 0; j < u; j++){ IOWR(LCD_0_BASE, LCD_WR_DATA_REG,g[j]); usleep(100); } }
Completed Code alt_u32 clear_lcd(void) { /* Set the Cursor to the home position */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x02); usleep(2000); /* Display clear */ IOWR(LCD_0_BASE, LCD_WR_COMMAND_REG, 0x01); usleep(2000); return(0); } void led_disp(char led_val){ IOWR_ALTERA_AVALON_PIO_DATA(RED_LEDS_BASE, (led_val & 0xFF)); } void adc_handler(intadc_data[]){ int count = 0,i,j; for(i=0; i < 3; i++){ IOWR_ALTERA_AVALON_PIO_DATA(ADC_SEL1_BASE,i); for(j=0; j < 7; j++){ IOWR_ALTERA_AVALON_PIO_DATA(MUX_SEL1_BASE,j); IOWR_ALTERA_AVALON_PIO_DATA(CS1_BASE,0); IOWR_ALTERA_AVALON_PIO_DATA(WR1_BASE,0); //might need usleep() here to wait for BUSY to go low while(BUSY1_BASE != 1) usleep(100); IOWR_ALTERA_AVALON_PIO_DATA(WR1_BASE,1); IOWR_ALTERA_AVALON_PIO_DATA(RD1_BASE,0); adc_data[count] = DATA1_BASE; IOWR_ALTERA_AVALON_PIO_DATA(CS1_BASE,1); IOWR_ALTERA_AVALON_PIO_DATA(RD1_BASE,1); count++; } } }
Planned Deliverables Milestone 1 • Working ADC • Completed interfacing code Milestone 2 • Working single fiber sensor • Temperature and Pressure module completed • Mesh completely assembled