毕业设计的开始:传感器无线网络——入手的几个模块
毕业设计后记

毕业设计2:传感器无线网络

G-one posted @ 2010年4月12日 08:08 in program , 4658 阅读

     离上次发毕业设计日志已经都好一段时间了,还是没啥大进展,懒了很多。当中有两天回了学校,有一天去了面试。工作还是要找D ,不然没法活了,当然面试还是......  继续呆家吧

弄了一下STC12C5A32S2 的内带AD ,方便当然方便过0809这东西啦。

        几天没怎么工作过了~ 忙了一个下午到晚上,准备无线模块的整体弄了一下,焊好了

精致小巧,哈哈。其实也就没啥东西,就单片机,引接口出来接那无线模块而已 ,不过用的是电池供电,还好4节5号电池也 就6V不到的样子,电源部分不用怎么整它。

这是背面...... 焊得啊~ 不咋D

上面的IC是 AMS117-3.3,无线模块要的是1.9V~3.6V的工作电压,3.3V最好啦

再来个整体的

毫无问题,试了一下能够完全正常工作,接收机也能接收到发出的信号。

关于毕业设计现在也就做到这里了,协议部分还有太多的不明,不知从何下手好。


下面这里讲讲STC12C5A32S2的内带AD使用,发现网上找了,很少相关资料,幸好这单片机的资料还是中文的。

这是新增的几个AD相关特殊寄存器

只要相关位设置好了就能直接用了,可以用查询的方式,也可以用中断的方式。按个人需求啦。我这就做了个查询的,中断的差不多,就多了打开中断的相关位EADC就行了

另外发现P1ASF寄存器设定好相关的IO口作为模拟功能AD输入时,被设定的IO口将无法做其他功能用。而在CHS2、CHS1、CHS0设定好相关IO口作为AD输入情况下,非工作在AD状态下却可以做使用

稍微注意一下,内带AD是10位的,因此有两个寄存器作为结果的存储,AUXR1寄存器中ADRJ位 可以控制AD转换结果寄存器存储方式

可能会有人问怎么会有8位的呢?这是十位的后两位可做精度看待,降低精度就可以不看最后的两位了。

自己写的实例程序:

 数码管做的显示,没做运算,直接输出而已

#include<reg51.h>
#include<intrins.h>

#define uchar unsigned char
#define uint unsigned int
#define LED P0

sfr P1AFS=0X9d;
sfr ADC_CONTR=0XBC;
sfr ADC_RES=0XBD;
sfr ADC_RESL=0XBE;
sfr AUXRI=0XA2;
bit ADRJ=0XA2^2;

sbit Led0=P1^0;
sbit Led1=P1^1;
sbit Led2=P1^2;
sbit Led3=P1^3;

uchar code NUM[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};//公阳
			
uint LED_DATA=1234;




void delay(uchar );
void LEDplay(void);
uchar ADC_Play(void);

int main(void)
{
	P1AFS=0X10;
	ADC_CONTR=0X24;
	ADC_RES=0;
	ADC_RESL=0;

	while(1)
	{
		 
	LED_DATA=ADC_Play();
	LEDplay();
	}
return 0;
}

uchar ADC_Play(void)
{
	uint DATA;
	ADC_CONTR|=0X80;
	ADRJ=0;
	ADC_CONTR|=0X08;
	_nop_();
	_nop_();
	_nop_();
	_nop_();
	_nop_();
	if((ADC_CONTR&0X10)==1)
	ADC_CONTR&=0XE7;
	
	DATA=ADC_RES;
	DATA<<=2;
	DATA+=ADC_RESL;
	return DATA;
}

void  LEDplay(void)
{
uchar D[4]=1;

D[0]=LED_DATA/1000;
D[1]=LED_DATA%1000/100;
D[2]=LED_DATA%100/10;
D[3]=LED_DATA%10;			  
LED=NUM[D[0]];Led0=0;delay(3);Led0=1;
LED=NUM[D[1]];Led1=0;delay(3);Led1=1;
LED=NUM[D[2]];Led2=0;delay(3);Led2=1;
LED=NUM[D[3]];Led3=0;delay(3);Led3=1;
}


void delay(uchar x)
{
uchar k;
while(x--)
	for(k=0;k<128;k++);
}
Avatar_small
TLHL28 说:
2010年4月13日 07:19

顶~~牛了不少噢.
毕业设计嘉宾我做定了.哈哈.

Avatar_small
G-one 说:
2010年4月13日 07:33

来吧来吧,欢迎光临

Avatar_small
celeb networth 说:
2021年9月08日 22:16

All the basic information about every celebrity is available now on the largest database of celeb networth post where you can find all the information and net worth of a singer, actor, businessman...

Avatar_small
Anonymous 说:
2021年9月29日 22:36

Your texts on this subject are correct, see how I wrote        this site is really very good. مكافحة حشرات

Avatar_small
TN EB online payment 说:
2022年8月02日 15:50

Tamil Nadu Electric Board was formally formed in 1957. It has now got over 300 Lakhs customers in the state. The company provides electricity to every consumer in the state through their different line and power rules. As per the usage of the electricity, TN EB online payment the TNEB does generate electricity bill for your provided electric meter. The bill generates every month by an executor of TNEB, who visits and scans the electric meter through their billing machine. The charges may differ for every 100 units used. Mostly the price does increase as you increase using the 100 unit’s slab. As per the regulation, the payment of Tamil Nadu Electric Board must pay in the same month. It is before the due date to have hassle-free connection.

Avatar_small
Anonymous 说:
2023年3月13日 17:23

Thanks for sharing the data on this topic. You know, I asked a couple of mates to share this data with me, but they wouldn't. That made me really angry and I just wanted to get this data. You helped me out a lot here. 슈어맨

Avatar_small
Anonymous 说:
2023年3月14日 12:55

Advice given by amazing and life changing. I used to lack in writing skills, but after I got some guidance from them I am now a professional writer. I am really glad for what they do. 카지노사이트

Avatar_small
blogss.in 说:
2023年4月21日 20:50

Professional writers have formed a group called blogss to produce specialised news coverage of the most recent events in the nation Our team consists of citizen journalists and professional writers with access to Those with a wide variety of journalism interests blogss.in who are committed to publishing the education updates in the public interest do so with transparency.a project of experienced writers who have gathered for specialised news coverage of recent events across the nation Our team is made up of professional writers and citizen journalists with a wide range of journalism interests who are committed about delivering education updates in the public interest while maintaining transparency.

Avatar_small
chatgpt dokument hoc 说:
2023年7月26日 00:25

ChatGPT kann viel mehr als nur Inhalte produzieren; Es kann auch bei der Prüfung, Überprüfung, Ergänzung und Recherche von Texten und Daten hilfreich sein. Obwohl Word-Dokumente noch nicht auf ChatGPT hochgeladen wurden, chatgpt dokument hochladen kann das Ghostwriter-Add-in ChatGPT-Funktionen in Word bereitstellen. Sie können auch Dateien und Dokumente in Google Docs hochladen, die KI von Google Labs nutzen, Ihr Dokument in PDF umwandeln und es dann in Bing Chat oder ChatPDF hochladen.

Avatar_small
Karnataka 9th Class 说:
2023年7月26日 19:27

Karnataka 9th Textbook 2024 will be Available in the Official Website Karnataka Textbook Society Upload the High School Standard eBooks, KSEEB Books Prepare by Senior Experts. KTBS Provide Std Kannada, English, Hindi, Urdu, Marathi, Tamil and Telugu Medium Books for Pdf File is upload in Website.Karnataka Textbook Society (KTBS) Every Year Published and Distribution for 10th Textbook Karnataka 9th Class Textbook 2024 Karnataka State High School Academic Year Start in Month of Jun Books 2024 Available in English, Hindi, Kannada, Science, Social Science, Maths Textbook at your Provide High Head Master.Karnataka State Board High School Students or Teachers can easily Download. These books Provide Quality Education


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter