void set_up(){ // Stop WDT WDT_A_hold(WDT_A_BASE); // Basic GPIO initialization Board_init(); Clock_init(); // Set up LCD lcd_init(); print_string(22,30,"*WELCOME*"); Delay(); //Buttons S1 S2 switch_init(); //PORTD=0xFF; //adc 6.6 pin adc_init(); //DDRC=0XFF; eeprom_address=0x0000; AdcThreshold=eeprom_read_byte(eeprom_address); eeprom_address++; dcval=eeprom_read_byte(eeprom_address); eeprom_address++; fourier_offset=eeprom_read_byte(eeprom_address); eeprom_address=0x10; FThreshold=eeprom_read_byte(eeprom_address); //usart_init(); //pwm_init(); }
void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT Clock_init(); P4DIR |= 0xff; // P1.0 output timerA_init(); _BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt }
/** * \brief Application entry point. * * \return Unused (ANSI-C compatibility). */ int main(void) { Clock_init(); GPIO_init(); USART0_SPI_Master_Init(); USART0_SPI_DMA_Transfer(TxBuffer,RxBuffer,5); while (1) { //TODO:: Please write your application code } }
/************************************************************************* * Function Name: MCU_init * Parameters: none * Return: none * Description: initialization of peripheral modules after reset *************************************************************************/ void MCU_init(void) { Clock_init(); ADC0_init(); PDB_init(); FTM0_init(); FTM1_init(); FTM2_init(); SPI0_init(); UART1_init(); GPIO_init(); MC33927_config(); }
void main(void) { tRectangle myRectangle1 = { 5, 10, 60, 50}; tRectangle myRectangle2 = { 30, 20, 100, 60}; tRectangle myRectangle3 = { 0, 0, 101, 63}; // Stop WDT WDT_A_hold(WDT_A_BASE); // Basic GPIO initialization Board_init(); Clock_init(); // Set up LCD Dogs102x64_UC1701Init(); GrContextInit(&g_sContext, &g_sDogs102x64_UC1701); GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); GrContextFontSet(&g_sContext, &g_sFontFixed6x8); GrClearDisplay(&g_sContext); // Intro Screen GrStringDrawCentered(&g_sContext, "How to use MSP430", AUTO_STRING_LENGTH, 51, 16, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "Graphics Library", AUTO_STRING_LENGTH, 51, 32, TRANSPARENT_TEXT); GrStringDrawCentered(&g_sContext, "Primitives", AUTO_STRING_LENGTH, 51, 48, TRANSPARENT_TEXT); Delay(); GrClearDisplay(&g_sContext); // Draw pixels and lines on the display GrStringDraw(&g_sContext, "Draw Pixels", AUTO_STRING_LENGTH, 20, 0, TRANSPARENT_TEXT); GrStringDraw(&g_sContext, "& Lines", AUTO_STRING_LENGTH, 30, 10, TRANSPARENT_TEXT); GrPixelDraw(&g_sContext, 10, 10); GrPixelDraw(&g_sContext, 10, 12); GrPixelDraw(&g_sContext, 12, 12); GrPixelDraw(&g_sContext, 12, 10); GrLineDraw(&g_sContext, 15, 15, 60, 60); GrLineDraw(&g_sContext, 10, 50, 90, 10); GrLineDraw(&g_sContext, 0, GrContextDpyHeightGet(&g_sContext) - 1, GrContextDpyWidthGet(&g_sContext) - 1, GrContextDpyHeightGet(&g_sContext) - 1); Delay(); GrClearDisplay(&g_sContext); // Draw circles on the display GrStringDrawCentered(&g_sContext, "Draw Circles", AUTO_STRING_LENGTH, 51, 5, TRANSPARENT_TEXT); GrCircleDraw(&g_sContext, 30, 50, 10); GrCircleFill(&g_sContext, 65, 37, 23); Delay(); GrClearDisplay(&g_sContext); // Draw rectangles on the display GrStringDrawCentered(&g_sContext, "Draw Rectangles", AUTO_STRING_LENGTH, 51, 5, TRANSPARENT_TEXT); GrRectDraw(&g_sContext, &myRectangle1); GrRectFill(&g_sContext, &myRectangle2); // Text won't be visible on screen due to transparency GrStringDrawCentered(&g_sContext, "Normal Text", AUTO_STRING_LENGTH, 65, 30, TRANSPARENT_TEXT); // Text draws foreground and background for opacity GrStringDrawCentered(&g_sContext, "Opaque Text", AUTO_STRING_LENGTH, 65, 40, OPAQUE_TEXT); GrContextForegroundSet(&g_sContext, ClrWhite); GrContextBackgroundSet(&g_sContext, ClrBlack); // Text draws with inverted color to become visible GrStringDrawCentered(&g_sContext, "Invert Text", AUTO_STRING_LENGTH, 65, 50, TRANSPARENT_TEXT); Delay(); GrClearDisplay(&g_sContext); // Invert the foreground and background colors GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); GrRectFill(&g_sContext, &myRectangle3); GrContextForegroundSet(&g_sContext, ClrWhite); GrContextBackgroundSet(&g_sContext, ClrBlack); GrStringDrawCentered(&g_sContext, "Invert Colors", AUTO_STRING_LENGTH, 51, 5, TRANSPARENT_TEXT); GrRectDraw(&g_sContext, &myRectangle1); GrRectFill(&g_sContext, &myRectangle2); // Text won't be visible on screen due to transparency GrStringDrawCentered(&g_sContext, "Normal Text", AUTO_STRING_LENGTH, 65, 30, TRANSPARENT_TEXT); // Text draws foreground and background for opacity GrStringDrawCentered(&g_sContext, "Opaque Text", AUTO_STRING_LENGTH, 65, 40, OPAQUE_TEXT); GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); // Text draws with inverted color to become visible GrStringDrawCentered(&g_sContext, "Invert Text", AUTO_STRING_LENGTH, 65, 50, TRANSPARENT_TEXT); Delay(); GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); GrClearDisplay(&g_sContext); // Draw Images on the display GrImageDraw(&g_sContext, &LPRocket_96x37_1BPP_UNCOMP, 3, 13); Delay(); GrClearDisplay(&g_sContext); GrImageDraw(&g_sContext, &TI_Logo_69x64_1BPP_UNCOMP, 16, 0); while(1) { } }
void main(void) { // Stop WDT WDT_A_hold(WDT_A_BASE); // Basic GPIO initialization Board_init(); Clock_init(); // Set up LCD Dogs102x64_UC1701Init(); GrContextInit(&g_sContext, &g_sDogs102x64_UC1701); GrContextForegroundSet(&g_sContext, ClrBlack); GrContextBackgroundSet(&g_sContext, ClrWhite); GrContextFontSet(&g_sContext, &g_sFontFixed6x8); GrClearDisplay(&g_sContext); int toggle=0; while(1){ //GrClearDisplay(&g_sContext); print_string(0,0,"===Team Members==="); print_string(0,8,"Anson Bastos"); print_string(0,16,"Dhiraj Patil"); print_string(0,24,"Abhinendra Singh"); print_string(0,32,"Melroy Tellis"); print_string(0,40,"Abhishek Suryawanshi"); toggle=(toggle>4)?(0):(toggle); switch(toggle){ case 0: highlight_and_print_string(0,8,"Anson Bastos"); Delay(); toggle++; break; case 1: highlight_and_print_string(0,16,"Dhiraj Patil"); Delay(); toggle++; break; case 2: highlight_and_print_string(0,24,"Abhinendra Singh"); Delay(); toggle++; break; case 3: highlight_and_print_string(0,32,"Melroy Tellis"); Delay(); toggle++; break; case 4: highlight_and_print_string(0,40,"Abhishek Suryawanshi"); Delay(); toggle++; break; } } }