0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

Proteus:簡(jiǎn)易示波器

Harmony&嵌入式學(xué)習(xí) ? 來(lái)源:Harmony&嵌入式學(xué)習(xí) ? 作者:Harmony&嵌入式學(xué) ? 2023-06-14 11:35 ? 次閱讀

視頻鏈接:https://www.bilibili.com/video/BV1sr4y1C7tH

pYYBAGSJNVqAVd_sAAFQLSkZtBE712.pngpYYBAGSJNWGAemFmAARCyOnG4UU501.pngpoYBAGSJNWeAII6aAAFbdaTb3xE825.pngpYYBAGSJNW2ANOfGAAJCXhm_3tw495.png
#include "reg52.h"			 //此文件中定義了單片機(jī)的一些特殊功能寄存器
#include 
#define uchar unsigned char
#define uint  unsigned int
#define ulong unsigned long
typedef unsigned int u16;	  //對(duì)數(shù)據(jù)類型進(jìn)行聲明定義
typedef unsigned char u8;

sbit CLK=P3^3;//定義時(shí)鐘信號(hào)口
sbit DIN=P3^1;//定義2543數(shù)據(jù)寫入口
sbit DOUT=P3^0;//定義2543數(shù)據(jù)讀取口
sbit CS=P3^2;//定義2543片選信號(hào)口

#define LCD_databus P0 //LCD12864的8位數(shù)據(jù)口

sbit RS=P2^2; 	//RS為0---命令;1----數(shù)據(jù) 
sbit RW=P2^1; 	//RW為1---寫;0---讀 
sbit EN=P2^0; 	//使能端 
sbit CS1=P2^4; 	//片選1低電平有效,控制左半屏 
sbit CS2=P2^3; 	//片選1低電平有效,控制右半屏 
ulong volt;//測(cè)量的電壓值
ulong Result;

unsigned char code da[]={/*--  文字:  大  --*/
/*--  楷體_GB231212;  此字體下對(duì)應(yīng)的點(diǎn)陣為:寬x高=16x16   --*/
0x00,0x00,0x40,0x40,0x40,0x40,0xFF,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,
0x00,0x20,0x10,0x08,0x04,0x03,0x00,0x01,0x02,0x04,0x08,0x10,0x30,0x20,0x20,0x00};


unsigned char code BMP[][64]={/*--  調(diào)入了一幅圖像:D:Desktop12848坐標(biāo).BMP  --*/
/*--  寬度x高度=128x48  --*/
0X00,0X17,0X15,0X1D,0X00,0X02,0XFE,0X06,0X02,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0X04,0X1F,0X00,0X00,0XFF,0X04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X15,0X15,0X1F,0X00,0X00,0XFF,0X04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X0E,0X8B,0X0B,0X00,0X00,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0XC0,0X00,0X0F,0X00,0XC0,0X00,0XFF,0X02,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X02,0X01,0X00,0X78,0X4B,0X7A,0X02,0X02,0X02,0X02,0X02,0X02,0X02,0X02,
0XFB,0X02,0X02,0X02,0X02,0X02,0X02,0X02,0X02,0XEA,0XAA,0XBA,0X02,0X02,0X02,0X02,
0X02,0X02,0XA2,0XAA,0XFA,0X02,0X02,0X02,0X02,0X02,0X02,0X02,0X3A,0X23,0XFA,0X02,
0X02,0X02,0X02,0X02,0X02,0X02,0XBA,0XAB,0XEA,0X02,0X02,0X02,0X02,0X02,0X02,0X02,
0XFA,0XAB,0XEA,0X02,0X02,0X02,0X02,0X02,0X02,0X02,0X0A,0X0B,0XFA,0X02,0X02,0X02,
0X02,0X02,0X02,0X02,0XFA,0XAB,0XFA,0X02,0X02,0X02,0X02,0X02,0X02,0X02,0XBA,0XFA,
0X02,0X02,0X02,0X02,0X02,0X02,0XFA,0X02,0XFB,0X8A,0XFA,0X02,0X02,0X02,0X02,0X02,
0X02,0XFA,0X03,0XFA,0X02,0X02,0X02,0X02,0X07,0X00,0X00,0X00,0X00,0X00,0X02,0X02,
};


void Read_busy()//讀“忙”函數(shù)-----數(shù)據(jù)線的最高位DB71則busy		
{
	P0=0x00;
   	RS=0;  
   	RW=1; 
	EN=1;
	while(P0 & 0x80);
	EN=0;
}

void write_LCD_command(uchar value)	//寫命令函數(shù) 
{
   Read_busy();						//對(duì)LCD的每次讀寫都要讀忙 
   RS=0;	 						//選擇命令 
   RW=0; 							//讀操作 
   LCD_databus=value;
   EN=1;							//EN由1----0鎖存有效數(shù)據(jù) 
   _nop_();
   _nop_(); 
   EN=0;
}

void write_LCD_data(uchar value)//寫數(shù)據(jù)函數(shù)	
{
   Read_busy();
   RS=1; 						//選擇數(shù)據(jù) 
   RW=0;	
   LCD_databus=value;
   EN=1;						//EN由1----0鎖存有效數(shù)據(jù) 
   _nop_();		
   _nop_();
   EN=0;
}

uchar Read_LCD(void)			//讀數(shù)據(jù)函數(shù) 
{
	uchar value;
	Read_busy();
	LCD_databus=0xFF;			//先進(jìn)行一次空讀操作 
	RS=1;
	RW=1;
	EN=1;
	_nop_();
	_nop_();
	EN=0;
	
	LCD_databus=0xFF;			//讀取真正的數(shù)據(jù) 
	RS=1;
	RW=1;
	EN=1;
	value=LCD_databus;
	_nop_();
	_nop_();
	EN=0;
	
	return value; 
}

void Set_page(uchar page)		//設(shè)置“頁(yè)”LCD12864共8頁(yè),一頁(yè)是8行點(diǎn)陣點(diǎn)	
{
  page=0xb8|page; 				//頁(yè)的首地址為0xB8
  write_LCD_command(page);
}

void Set_line(uchar startline)  //設(shè)置顯示的起始行	   
{
  startline=0xC0|startline;     //起始行地址為0xC0 
  write_LCD_command(startline); //設(shè)置從哪行開(kāi)始:共0--63;一般從0 行開(kāi)始顯示
}

void Set_column(uchar column)	//設(shè)置顯示的列	
{
  column=column &0x3f; 			//列的最大值為64
  column= 0x40|column; 			//列的首地址為0x40 
  write_LCD_command(column);	//規(guī)定顯示的列的位置 
}

void SetOnOff(uchar onoff)		//顯示開(kāi)關(guān)函數(shù):0x3E是關(guān)顯示,0x3F是開(kāi)顯示   
{
	onoff=0x3e|onoff; 			//onoff:1---開(kāi)顯示;0---關(guān)顯示
	write_LCD_command(onoff);
}

void SelectScreen(uchar screen)	//選擇屏幕 
{ 						 
   switch(screen)
   { 
   	 case 0: CS1=0;CS2=0;break; //全屏     
     case 1: CS1=0;CS2=1;break;//左半屏        
     case 2: CS1=1;CS2=0;break;//右半屏       
     default:break; 
   }
}

void ClearScreen(uchar screen)	//清屏函數(shù)  
{ 	
     uchar i,j;
     SelectScreen(screen);		//0--全屏;1---左半屏;2---右半屏 
	 for(i=0;i>3);  		//計(jì)算出該點(diǎn)屬于哪個(gè)字節(jié) 
	x_bit=y-(x_byte63)				//x>63則顯示在右半屏 
	{
		SelectScreen(2);
		x=x-64;
	}
	else					//顯示在左半屏 
	{
		SelectScreen(1); 
	}
	Set_page(x_byte);		//設(shè)置行地址 
	Set_column(x);			//設(shè)置列地址
 	Temp_data=Read_LCD();	//先讀出沒(méi)打點(diǎn)前LCD中的數(shù)據(jù) 
	switch(color)
	{
		case 0x01 : Temp_data &= ~(1=1;
	volt=ad;//取走轉(zhuǎn)換結(jié)果
	volt=volt*1221;//例子的滿量程為5V,轉(zhuǎn)換分辯率為12位(2的12次方=4096) 。即最大值是255,5/4096=1221mV,即例子中的1V代表實(shí)際1221mV        
}

void delay(uchar ms) 
{  // 延時(shí)子程序 
uchar i; 
while(ms--) 
{ 
  for(i = 0;i
審核編輯:湯梓紅
);break;>
聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 示波器
    +關(guān)注

    關(guān)注

    113

    文章

    6167

    瀏覽量

    184327
  • 寄存器
    +關(guān)注

    關(guān)注

    31

    文章

    5295

    瀏覽量

    119838
  • Proteus
    +關(guān)注

    關(guān)注

    79

    文章

    1692

    瀏覽量

    106294
收藏 人收藏

    評(píng)論

    相關(guān)推薦

    Proteus教程:簡(jiǎn)易電壓表

    Proteus教程:簡(jiǎn)易電壓表
    的頭像 發(fā)表于 06-14 11:33 ?4835次閱讀
    <b class='flag-5'>Proteus</b>教程:<b class='flag-5'>簡(jiǎn)易</b>電壓表

    【assingle分享】proteus仿真之a(chǎn)vr簡(jiǎn)易示波器仿真

    `proteus仿真之a(chǎn)vr簡(jiǎn)易示波器仿真`
    發(fā)表于 03-30 15:23

    書(shū)籍教程:Proteus簡(jiǎn)易教程

    本資料是關(guān)于Proteus.簡(jiǎn)易教程的下載,有需要的可以下載看看
    發(fā)表于 07-26 23:16

    求基于單片機(jī)的簡(jiǎn)易示波器的課程設(shè)計(jì)包括proteus仿真

    求基于單片機(jī)的簡(jiǎn)易示波器的課程設(shè)計(jì)包括proteus仿真
    發(fā)表于 06-22 10:20

    基于51單片機(jī)的簡(jiǎn)易示波器仿真——》Proteus7.5仿真源文件+C語(yǔ)言源工程文件

    基于51單片機(jī)的簡(jiǎn)易示波器仿真——》Proteus7.5仿真源文件+C語(yǔ)言源工程文件;一切來(lái)自互聯(lián)網(wǎng),無(wú)私分享!
    發(fā)表于 04-14 10:08

    基于AVR的簡(jiǎn)易示波器設(shè)計(jì)

    基于AVR的簡(jiǎn)易示波器設(shè)計(jì):介紹了以AVR單片機(jī)ATmega16為核心,采用前端信號(hào)調(diào)理電路、程控增益放大器以及波形顯示LCD(GDM12864A)實(shí)現(xiàn)的一個(gè)簡(jiǎn)易示波器。并給出該系統(tǒng)設(shè)
    發(fā)表于 05-26 23:41 ?97次下載

    基于FPGA的雙通道簡(jiǎn)易可存儲(chǔ)示波器設(shè)計(jì)

    基于FPGA的雙通道簡(jiǎn)易可存儲(chǔ)示波器設(shè)計(jì):本文介紹了一種基于FPGA的采樣速度60Mbit/s的雙通道簡(jiǎn)易數(shù)字示波器設(shè)計(jì),能夠?qū)崿F(xiàn)量程和采樣頻率的自動(dòng)調(diào)整、數(shù)據(jù)緩存、顯示以及與計(jì)算機(jī)
    發(fā)表于 09-29 10:45 ?110次下載

    簡(jiǎn)易示波器時(shí)基發(fā)生器

    簡(jiǎn)易示波器時(shí)基發(fā)生器 NE555
    發(fā)表于 09-29 11:49 ?950次閱讀
    <b class='flag-5'>簡(jiǎn)易</b><b class='flag-5'>示波器</b>時(shí)基發(fā)生器

    Proteus示波器使用技巧

    Proteus示波器使用技巧 左下角
    發(fā)表于 03-21 18:46 ?2.8w次閱讀
    <b class='flag-5'>Proteus</b>中<b class='flag-5'>示波器</b>使用技巧

    基于STM32的簡(jiǎn)易示波器設(shè)備驅(qū)動(dòng)的研究

    基于STM32的簡(jiǎn)易示波器設(shè)備驅(qū)動(dòng)的研究
    發(fā)表于 11-06 17:04 ?68次下載

    Proteus示波器簡(jiǎn)介

    Proteus示波器的操作 簡(jiǎn)介 此簡(jiǎn)介基于 proteus7.8 版本
    發(fā)表于 03-22 11:19 ?15次下載

    簡(jiǎn)易電子示波器_陳鵬飛

    簡(jiǎn)易電子示波器_陳鵬飛。
    發(fā)表于 05-05 11:01 ?30次下載

    簡(jiǎn)易數(shù)字存儲(chǔ)示波器設(shè)計(jì)

    設(shè)計(jì)一簡(jiǎn)易數(shù)字存儲(chǔ)示波器簡(jiǎn)易DSO)。
    發(fā)表于 03-18 15:20 ?412次下載
    <b class='flag-5'>簡(jiǎn)易</b>數(shù)字存儲(chǔ)<b class='flag-5'>示波器</b>設(shè)計(jì)

    基于stm32mini開(kāi)發(fā)板的簡(jiǎn)易函數(shù)發(fā)生器和簡(jiǎn)易示波器

    基于stm32 mini開(kāi)發(fā)板的簡(jiǎn)易示波器
    發(fā)表于 01-17 10:01 ?35次下載
    基于stm32mini開(kāi)發(fā)板的<b class='flag-5'>簡(jiǎn)易</b>函數(shù)發(fā)生器和<b class='flag-5'>簡(jiǎn)易</b><b class='flag-5'>示波器</b>

    基于LabVIEW的簡(jiǎn)易虛擬示波器設(shè)計(jì)

    基于LabVIEW的簡(jiǎn)易虛擬示波器設(shè)計(jì)方法。
    發(fā)表于 04-06 15:33 ?126次下載