交通灯具体实现 ----- 微机原理课程设计

微机原理课程设计,交通灯的具体实现

// firstDlg.cpp : implementation file
//

#include "stdafx.h"
#include "first.h"
#include "firstDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif





#include "PCI9052Dll.h"
unsigned char table[10]={0xc0,0xf9,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10}; //0到9的数码管代码
int judge = 0,aaa=1; //判断黄灯,若为黄灯则为1,aaa是用来帮助保存干预前红绿灯状态的参数;
unsigned short usIoAddr;
unsigned short Addr;
unsigned char data,data1,data2,data3,data4; //data用来记录当前黄灯的方向,data1,data2,data3,data4用来记录4个数码管的数字
unsigned char Idata,Idata0,Idata1,Idata3,Idata2; //Idata0和Idata1用来判断时间是否到1秒,Idata2记录被干预之前的灯状态

unsigned char Idata4; //保存是否为自动运行模式
#define DefaultTime 30
#define smgd 0xc0 //数码管段初始化
#define smgw 0xc0 //数码管位初始化数据
#define hld 0xf3 //红绿灯初始化数据

int yellowtime=5;
int redtime=30;
int greentime=30;
int night=0;
int ID=0;
/*////////////////////////////////////////////////////////////////////////////
// 8255.cpp : Defines the entry point for the console application.
//B口为输入(开关用做输入),A口为输出(输出到led上显示)
#include<iostream>
#include<ctime>
#include "windows.h"
#include "stdio.h"

#include "conio.h"
using namespace std;







////////////////////////////////////////////////////////////////////////////*/
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFirstDlg dialog

CFirstDlg::CFirstDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFirstDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFirstDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CFirstDlg::DoDataExchange

你可能喜欢

  • 微机原理交通灯
  • 微机原理交通灯实验
  • 微机原理接口课程设计
  • 微机原理电子琴课程设计
  • 微机原理课程设计动画
  • 微机原理课程设计实验报告
  • 微机原理课程设计报告

交通灯具体实现 微机原理课程设计相关文档

最新文档

返回顶部