-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
65 lines (62 loc) · 2.3 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*******************************************************************************
*
* MSP-EXP430G2_007: Manejo de LCD 16x2 "Mostrar Textos"
*
*******************************************************************************
* FileName: lcd.c
* Processor: MSP430G2231 (Puede ser otro)
* Complier: CCS 7.2.0.00013
* Author: Pedro Sánchez Ramírez (MrChunckuee)
* Blog: http://mrchunckuee.blogspot.com/
* Email: mrchunckuee.psr@gmail.com
* Description: Considerar la distribucion de pines especificada en lcd.h
* Forma de mostar textos simples en el LCD
*******************************************************************************
* Historial del firmware
* Rev. Date Comment
* v0.00 28/09/2015 Creación del firmware
* v0.01 29/11/2017 Se compilo con CCS 7.2.0.00013
******************************************************************************/
#include <msp430g2231.h>
#include "lcd.h"
void Delay_Seg(volatile unsigned int t);
void main(void) {
WDTCTL = WDTPW + WDTHOLD;//Stop watchdog timer
BCSCTL1 = CALBC1_1MHZ;// Use 1Mhz cal data for DCO
DCOCTL = CALDCO_1MHZ;// Use 1Mhz cal data for DCO
P1DIR = 0xFF;
P1OUT = 0x00;
LCD_Init();//Se inicializa LCD
while(1){
LCD_WriteCommand(LCD_CLEAR_SCREEN);
LCD_WriteROMString("Hello World!!",1,0);
LCD_WriteROMString("by MrChunckuee!!",0,1);
Delay_Seg(3);
LCD_WriteCommand(LCD_CLEAR_SCREEN);
LCD_WriteROMString("Using LCD 16x2",1,0);
LCD_WriteROMString("Code Composer S.",0,1);
Delay_Seg(3);
LCD_WriteCommand(LCD_CLEAR_SCREEN);
LCD_WriteROMString("Electr. y Robot.",0,0);
LCD_WriteROMString("Likes FB: 5170",1,1);
Delay_Seg(3);
LCD_WriteCommand(LCD_CLEAR_SCREEN);
LCD_WriteROMString("http://mrchuncku",0,0);
LCD_WriteROMString("ee.blogspot.com/",0,1);
Delay_Seg(3);
}
}
/*******************************************************************************
* Function: void Delay_Seg(volatile unsigned int t)
* Description: Realiza retardo en segundos
* Precondition: None
* Parameters: t = Tiempo de espera
* Return Values: None
* Remarks: None
* ****************************************************************************/
void Delay_Seg(volatile unsigned int t){
volatile unsigned int i;
for (i=0 ;i<t; i++){
__delay_cycles(1000000);
}
}