PC與單片機雙向通訊智能溫控程序
#include <AT89X51.H>
#include <intrins.h>
#define Key_UP P1_0
#define Key_DOWN P1_1
#define Key_SET P1_2
#define RelayOutPort P2_0
#define LEDPort P0
#define DELPort P2_1
#define LEDTwoC P3_6
#define LEDThreeC P3_7
#define TMPort P2_7
#define INBUF_LEN 5 //數(shù)據(jù)長度
unsigned char inbuf1[INBUF_LEN]={ 0 , 0 , 0 , 0 , 0 } //發(fā)送緩沖區(qū)
unsigned char inbuf2[50] //接收緩沖區(qū)
unsigned char count3
void init_serialcomm( void )
{
SCON = 0x50 //SCON: serail mode 1, 8-bit UART, enable ucvr
TMOD |= 0x20 //TMOD: timer 1, mode 2, 8-bit reload
PCON |= 0x80 //SMOD=1
TH1 = 0xFA //Baud:4800 fosc=11.0592MHz
IE |= 0x90 //Enable Serial Interrupt
TR1 = 1 // timer 1 run
}
//向串口發(fā)送一個字符
void send_char_com( unsigned char ch)
{
SBUF=ch
while (TI== 0 )
TI= 0
標(biāo)簽:
include
intrins
define
Key_UP
上傳時間:
2014-11-29
上傳用戶:風(fēng)之驕子
This example shows how you can use signal functions in the Visiondebugger to simulate a signal that is coming into one of the analog inputs of the LPC21xx.The Measure example is described in detail in the Getting StartedUser's Guide.The MEASURE example program is available for several targets:Simulator: uVision Simulator for LPC2129MCB2100: Keil MCB2100 evaluation board with ULINK debugger - Application is loaded to internal Flash. - Switch S2 (INT1) is used as GPIO and sampled (jumper positions: J1= off, J7= on) - potentiometer POT1 is sampled as AIN0 (jumper position: J2= on) - serial port COM1 parameters: 9600 Baud, no parity, 8-bits, 1 stop bit, flow control noneMCB2130: Keil MCB2130 evaluation board with ULINK debugger - Application is loaded to internal Flash. - Switch S2 (INT1) is used as GPIO and sampled (jumper positions: J1= off, J7= on) - potentiometer POT1 is sampled as AIN1 (jumper position: J2= on) - serial port COM1 parameters: 9600 Baud, no parity, 8-bits, 1 stop bit, flow control none
標(biāo)簽:
dac8568
上傳時間:
2022-06-28
上傳用戶: