1392 views|0 replies

3836

Posts

19

Resources
The OP
 

msp430f169 bluetooth fan adjustable speed program [Copy link]

The design is relatively simple. The mobile phone is connected to the microcontroller via UART. The PWM can adjust the speed arbitrarily. Pay attention to the driving voltage of the fan.
#include <msp430f169.h>
#include "lcd12864.h"
#include "PWM.h"
#include "UART.h"
#include "adc.h"

unsigned char key = 0;
unsigned char Statu = 0;
unsigned int a = 0;

#pragma vector=USART0RX_VECTOR
__interrupt void USART0_RX_ISR(void)
{
unsigned char data=0;
data=U0RXBUF; //Save the received data
key = data;
Uart0Send_Byte(data); //Send the received data again

}

void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
Clock_Init(1); // 0 is 1M, 1 is 8M
PWM_init(); // Init the PWM
Port_init(); // Init the LCD1602
LCD_init();
UART0_Init();
LCD_Desk();
ADC_Init();
_BIS_SR(GIE); //Enable system interrupt
while(1){
LCD_Desk();
ADC();
LCD_DisplayTemp((uchar)TemperC);
delay_ms(500);
_NOP();
switch(key){
case 49:start(); LCD_write_str(4,2,"1"); 4,1,"ON ");break;
case 50:speed(1);LCD_Display_num(4,2,2);LCD_write_str(4,1,"ON ");break;
case 51:speed(2);LCD_Display_num(4,2,3);LCD_write_str(4,1,"ON ");break;
case 52:speed(3);LCD_Display_num(4,2,4);LCD _write_str(4,1,"ON ");break;
case 48:stop(); LCD_write_str(4,2,"0");LCD_write_str(4,1,"OFF");break;
default:break;
}
key=0;
}
}

lan_ya_fan.7z (43.55 KB, downloads: 4)

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list