This file contains example code to print over the serial port of the P87C591 MCU and Evaultion Board (EVAL-P87C591QS). This example will test the I2C function of the P87C591. This will be done by writing and reading from a serial A/D & D/A (P8591).
標簽: Evaultion the contains P87C591
上傳時間: 2017-06-20
上傳用戶:hebmuljb
RSA ( Rivest Shamir Adleman )is crypthograph system that used to give a secret information and digital signature . Its security based on Integer Factorization Problem (IFP). RSA uses an asymetric key. RSA was created by Rivest, Shamir, and Adleman in 1977. Every user have a pair of key, public key and private key. Public key (e) . You may choose any number for e with these requirements, 1< e <Æ (n), where Æ (n)= (p-1) (q-1) ( p and q are first-rate), gcd (e,Æ (n))=1 (gcd= greatest common divisor). Private key (d). d=(1/e) mod(Æ (n)) Encyption (C) . C=Mª mod(n), a = e (public key), n=pq Descryption (D) . D=C° mod(n), o = d (private key
標簽: crypthograph information Adleman Rivest
上傳時間: 2017-09-01
上傳用戶:chfanjiang
#include <stdio.h> #include <stdlib.h> #define SMAX 100 typedef struct SPNode { int i,j,v; }SPNode; struct sparmatrix { int rows,cols,terms; SPNode data [SMAX]; }; sparmatrix CreateSparmatrix() { sparmatrix A; printf("\n\t\t請輸入稀疏矩陣的行數,列數和非零元素個數(用逗號隔開):"); scanf("%d,%d,%d",&A.cols,&A.terms); for(int n=0;n<=A.terms-1;n++) { printf("\n\t\t輸入非零元素值(格式:行號,列號,值):"); scanf("%d,%d,%d",&A.data[n].i,&A.data[n].j,&A.data[n].v); } return A; } void ShowSparmatrix(sparmatrix A) { int k; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { k=0; for(int n=0;n<=A.terms-1;n++) { if((A.data[n].i-1==x)&&(A.data[n].j-1==y)) { printf("%8d",A.data[n].v); k=1; } } if(k==0) printf("%8d",k); } printf("\n\t\t"); } } void sumsparmatrix(sparmatrix A) { SPNode *p; p=(SPNode*)malloc(sizeof(SPNode)); p->v=0; int k; k=0; printf("\n\t\t"); for(int x=0;x<=A.rows-1;x++) { for(int y=0;y<=A.cols-1;y++) { for(int n=0;n<=A.terms;n++) { if((A.data[n].i==x)&&(A.data[n].j==y)&&(x==y)) { p->v=p->v+A.data[n].v; k=1; } } } printf("\n\t\t"); } if(k==1) printf("\n\t\t對角線元素的和::%d\n",p->v); else printf("\n\t\t對角線元素的和為::0"); } int main() { int ch=1,choice; struct sparmatrix A; A.terms=0; while(ch) { printf("\n"); printf("\n\t\t 稀疏矩陣的三元組系統 "); printf("\n\t\t*********************************"); printf("\n\t\t 1------------創建 "); printf("\n\t\t 2------------顯示 "); printf("\n\t\t 3------------求對角線元素和"); printf("\n\t\t 4------------返回 "); printf("\n\t\t*********************************"); printf("\n\t\t請選擇菜單號(0-3):"); scanf("%d",&choice); switch(choice) { case 1: A=CreateSparmatrix(); break; case 2: ShowSparmatrix(A); break; case 3: SumSparmatrix(A); break; default: system("cls"); printf("\n\t\t輸入錯誤!請重新輸入!\n"); break; } if (choice==1||choice==2||choice==3) { printf("\n\t\t"); system("pause"); system("cls"); } else system("cls"); } }
上傳時間: 2020-06-11
上傳用戶:ccccy
正則表達式用于字符串處理、表單驗證等場合,實用高效。現將一些常用的表達式收集于此,以備不時之需。 匹配中文字符的正則表達式: [\u4e00-\u9fa5] 評注:匹配中文還真是個頭疼的事,有了這個表達式就好辦了 匹配雙字節字符(包括漢字在內):[^\x00-\xff] 評注:可以用來計算字符串的長度(一個雙字節字符長度計2,ASCII字符計1) 匹配空白行的正則表達式:\n\s*\r 評注:可以用來刪除空白行 匹配HTML標記的正則表達式:<(\S*?)[^>]*>.*?</\1>|<.*? /> 評注:網上流傳的版本太糟糕,上面這個也僅僅能匹配部分,對于復雜的嵌套標記依舊無能為力 匹配首尾空白字符的正則表達式:^\s*|\s*$ 評注:可以用來刪除行首行尾的空白字符(包括空格、制表符、換頁符等等),非常有用的表達式 匹配Email地址的正則表達式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* 評注:表單驗證時很實用 匹配網址URL的正則表達式:[a-zA-z]+://[^\s]* 評注:網上流傳的版本功能很有限,上面這個基本可以滿足需求 匹配帳號是否合法(字母開頭,允許5-16字節,允許字母數字下劃線):^[a-zA-Z][a-zA-Z0-9_]{4,15}$ 評注:表單驗證時很實用 匹配國內電話號碼:\d{3}-\d{8}|\d{4}-\d{7} 評注:匹配形式如 0511-4405222 或 021-87888822 匹配騰訊QQ號:[1-9][0-9]{4,} 評注:騰訊QQ號從10000開始 匹配中國郵政編碼:[1-9]\d{5}(?!\d) 評注:中國郵政編碼為6位數字 匹配身份證:\d{15}|\d{18} 評注:中國的身份證為15位或18位 匹配ip地址:\d+\.\d+\.\d+\.\d+ 評注:提取ip地址時有用。 匹配特定數字:
上傳時間: 2020-12-16
上傳用戶:
STM32F103開發板 DHT11溫濕度DS18B20 氣體MQ-2光敏聲控雨滴傳感器實驗程序**--------------------------------------------------------------------------------------------------------** Created by: FiYu** Created date: 2015-12-12** Version: 1.0** Descriptions: DHT11溫濕度傳感器實驗 **--------------------------------------------------------------------------------------------------------** Modified by: FiYu** Modified date: ** Version: ** Descriptions: ** Rechecked by: **********************************************************************************************************/#include "stm32f10x.h"#include "delay.h"#include "dht11.h"#include "usart.h"DHT11_Data_TypeDef DHT11_Data;/************************************************************************************** * 描 述 : GPIO/USART1初始化配置 * 入 參 : 無 * 返回值 : 無 **************************************************************************************/void GPIO_Configuration(void){ GPIO_InitTypeDef GPIO_InitStructure; /* Enable the GPIO_LED Clock */ RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE); GPIO_DeInit(GPIOB); //將外設GPIOA寄存器重設為缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽輸出 GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_DeInit(GPIOA); //將外設GPIOA寄存器重設為缺省值 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //推挽輸出 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //浮空輸入 GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_SetBits(GPIOB , GPIO_Pin_9); //初始狀態,熄滅指示燈LED1}/************************************************************************************** * 描 述 : 串口顯示實時溫濕度 * 入 參 : 無 * 返回值 : 無 **************************************************************************************/void DHT11_SCAN(void){ if( Read_DHT11(&DHT11_Data)==SUCCESS) { printf("\r\n讀取DHT11成功!\r\n\r\n濕度為%d.%d %RH ,溫度為 %d.%d℃ \r\n",\ DHT11_Data.humi_int,DHT11_Data.humi_deci,DHT11_Data.temp_int,DHT11_Data.temp_deci); //printf("\r\n 濕度:%d,溫度:%d \r\n" ,DHT11_Data.humi_int,DHT11_Data.temp_int); } else { printf("Read DHT11 ERROR!\r\n"); }}/************************************************************************************** * 描 述 : MAIN函數 * 入 參 : 無 * 返回值 : 無 **************************************************************************************/int main(void){ SystemInit(); //設置系統時鐘72MHZ GPIO_Configuration(); USART1_Init(); //初始化配置TIM DHT11_GPIO_Config(); // 初始化溫濕度傳感器PB1引腳初始時為推挽輸出 GPIO_ResetBits(GPIOB , GPIO_Pin_9); delay_ms(500); while(1) { GPIO_SetBits(GPIOB , GPIO_Pin_9); DHT11_SCAN(); //實時顯示溫濕度 delay_ms(1500); } }
上傳時間: 2022-05-03
上傳用戶:得之我幸78
計算機基本知識、SPI總線說明串行外圍設備接口SPI(serial peripheral interface)總線技術是Motorola公司推出的一種同步串行接口,Motorola公司生產的絕大多數MCU(微控制器)都配有SPI硬件接口,如68系列MCU,SPI用于CPU與各種外圍器件進行全雙工、同步串行通訊。SPI可以同時發出和接收串行數據。它只需四條線就可以完成MCU與各種外圍器件的通訊,這四條線是:串行時鐘線(CSK)、主機輸入/從機輸出數據線(MISO)主機輸出/從機輸入數據線(MOSD)、低電平有效從機選擇線es。這些外圍器件可以是簡單的TTL移位寄存器,復雜的LCD顯示驅動器,A/D.D/A轉換子系統或其他的MCU,當SPI工作時,在移位寄存器中的數據逐位從輸出引腳(MOSI)輸出(高位在前),同時從輸入引腳(MISO)接收的數據逐位移到移位寄存器(高位在前),發送一個字節后,從另一個外圍器件接收的字節數據進入移位寄存器中。主SPI的時鐘信號(SCK)使傳輸同步,其典型系統框圖如下圖所示。
上傳時間: 2022-06-19
上傳用戶:
D-sub-jy
標簽: D-sub-jy
上傳時間: 2013-04-15
上傳用戶:eeworm
D類音頻功率放大器設計
上傳時間: 2013-04-15
上傳用戶:eeworm
積分式A/D轉換器其它專用集成電路分冊 清晰書簽版
上傳時間: 2013-05-29
上傳用戶:eeworm
OTP 4-位帶SAR8-位A-D轉換器單片機
上傳時間: 2013-05-17
上傳用戶:eeworm