#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請(qǐng)輸入稀疏矩陣的行數(shù),列數(shù)和非零元素個(gè)數(shù)(用逗號(hào)隔開(kāi)):"); scanf("%d,%d,%d",&A.cols,&A.terms); for(int n=0;n<=A.terms-1;n++) { printf("\n\t\t輸入非零元素值(格式:行號(hào),列號(hào),值):"); 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對(duì)角線元素的和::%d\n",p->v); else printf("\n\t\t對(duì)角線元素的和為::0"); } int main() { int ch=1,choice; struct sparmatrix A; A.terms=0; while(ch) { printf("\n"); printf("\n\t\t 稀疏矩陣的三元組系統(tǒng) "); printf("\n\t\t*********************************"); printf("\n\t\t 1------------創(chuàng)建 "); printf("\n\t\t 2------------顯示 "); printf("\n\t\t 3------------求對(duì)角線元素和"); printf("\n\t\t 4------------返回 "); printf("\n\t\t*********************************"); printf("\n\t\t請(qǐng)選擇菜單號(hào)(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輸入錯(cuò)誤!請(qǐng)重新輸入!\n"); break; } if (choice==1||choice==2||choice==3) { printf("\n\t\t"); system("pause"); system("cls"); } else system("cls"); } }
上傳時(shí)間: 2020-06-11
上傳用戶:ccccy
#INclude<iostream> using namespace std; int s=0; int prime(int x){ int i,p=1; for(i=2;i<=x/2;i++){ if(x%i==0){ p=0; break; } } if(p!=0){ cout<<x<< " "; s++; } } int main(){ for (int k=5;k<=100;k++){ prime(k); if(s%5==0) cout<<'\n'; } return 0; }
標(biāo)簽: C++
上傳時(shí)間: 2020-06-30
上傳用戶:1274636550
--stdafx.h中沒(méi)有函數(shù)庫(kù),只是定義了一些環(huán)境參數(shù),使得編譯出來(lái)的程序能在32位的操作系統(tǒng)環(huán)境下運(yùn)行。 windows和mfc的INclude文件都非常大,即使有一個(gè)快速的處理程序,編譯程序也要花費(fèi)相當(dāng)長(zhǎng)的時(shí)間來(lái)完成工作。由于每個(gè).cpp文件都包含相同的INclude文件,為每個(gè).cpp文件都重復(fù)處理這些文件就顯得很傻了。 為避免這種浪費(fèi),appwizard和visualc++編譯程序一起進(jìn)行工作,如下所示: --appwizard建立了文件stdafx.h,該文件包含了所有當(dāng)前工程文件需要的mfcINclude文件。且這一文件可以隨被選擇的選項(xiàng)而變化。 --appwizard然后就建立stdafx.cpp。這個(gè)文件通常都是一樣的。 --然后appwizard就建立起工程文件,這樣第一個(gè)被編譯的文件就是stdafx.cpp。 --當(dāng)visualc++編譯stdafx.cpp文件時(shí),它將結(jié)果保存在一個(gè)名為stdafx.pch的文件里。(擴(kuò)展名pch表示預(yù)編譯頭文件。) --當(dāng)visualc++編譯隨后的每個(gè).cpp文件時(shí),它閱讀并使用它剛生成的.pch文件。visualc++不再分析windowsINclude文件,除非你又編輯了stdafx.cpp或stdafx.h。 在這個(gè)過(guò)程中你必須遵守以下規(guī)則: --你編寫(xiě)的任何.cpp文件都必須首先包含stdafx.h。 --如果你有工程文件里的大多數(shù).cpp文件需要.h文件,順便將它們加在stdafx.h(后部)上,然后預(yù)編譯stdafx.cpp。 --由于.pch文件具有大量的符號(hào)信息,它是你的工程文件里最大的文件。 如果你的磁盤(pán)空間有限,你就希望能將這個(gè)你從沒(méi)使用過(guò)的工程文件中的.pch文件刪除。執(zhí)行程序時(shí)并不需要它們,且隨著工程文件的重新建立,它們也自動(dòng)地重新建立。
標(biāo)簽: stdafx
上傳時(shí)間: 2021-05-19
上傳用戶:1155
STM32F407VGT6精確脈沖控制步進(jìn)電機(jī)源碼,采用STM32F407VGT6芯片,拋棄單脈沖輸出方式,直接使用普通PWM輸出方式精確輸出脈沖個(gè)數(shù),每個(gè)脈沖都可以改變頻率和占空比。PWM+中斷,簡(jiǎn)單粗暴。#INclude "sys.h"#INclude "delay.h"#INclude "pwm1.h"#INclude "pwm2.h"#INclude "pwm3.h"//注釋見(jiàn)pwm1.c文件extern int count2;int main(void){ delay_init(168); //初始化延時(shí)函數(shù) TIM2_Init(1,167); TIM3_Init(1,167); TIM5_Init(1,167); // delay_ms(1000); TIM2_OUTPUT(); TIM3_OUTPUT(); TIM5_OUTPUT(); while(1) { //TIM2每次輸出完10個(gè)脈沖后間隔100ms再次輸出 if(count2 >= 10){ delay_ms(100); TIM2_OUTPUT(); } }
標(biāo)簽: stm32f407vgt6 脈沖控制 步進(jìn)電機(jī)
上傳時(shí)間: 2021-10-26
上傳用戶:xsr1983
INclude<reg52.h> #define uint unsigned int #define uchar unsigned char uint temp,aa,wang,qian,bai,shi,ge; sbit dula=P2^6; sbit wela=P2^7; uchar code table[]={ 0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71}; void display( uint wang,uint qian,uint bai,uint shi,uint ge); void delay(uint z); void init(); void main() { init();//初始化子程序 while(1) { if(aa==20) { aa=0; temp++; if(temp==99999) { temp=0; } wang=temp/10000; qian=(temp-wang*10000)/1000; bai=(temp-wang*10000-qian*1000)/100; shi=(temp-wang*10000-qian*1000-bai*100)/10; ge=temp%10; } display(wang,qian, bai,shi,ge); } } void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void display(uint wang,uint qian,uint bai,uint shi,uint ge) { dula=1; P0=table[wang]; dula=0; P0=0xff; wela=1; P0=0xfe; wela=0; delay(1); dula=1; P0=table[qian]; dula=0; P0=0xff; wela=1; P0=0xfd; wela=0; delay(1); dula=1; P0=table[bai]; dula=0; P0=0xff; wela=1; P0=0xfb; wela=0; delay(1); dula=1; P0=table[shi]; dula=0; P0=0xff; wela=1; P0=0xf7; wela=0; delay(1); dula=1; P0=table[ge]; dula=0; P0=0xff; wela=1; P0=0xef; wela=0; delay(1); } void init() { wela=0; dula=0; temp=0; TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; } void timer0() interrupt 1 { TH0=(65536-50000)/256; TL0=(65536-50000)%256; aa++; } INclude<reg52.h> #define uint unsigned int #define uchar unsigned char uint temp,aa,wang,qian,bai,shi,ge; sbit dula=P2^6; sbit wela=P2^7; uchar code table[]={ 0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71}; void display( uint wang,uint qian,uint bai,uint shi,uint ge); void delay(uint z); void init(); void main() { init();//初始化子程序 while(1) { if(aa==20) { aa=0; temp++; if(temp==99999) { temp=0; } wang=temp/10000; qian=(temp-wang*10000)/1000; bai=(temp-wang*10000-qian*1000)/100; shi=(temp-wang*10000-qian*1000-bai*100)/10; ge=temp%10; } display(wang,qian, bai,shi,ge); } } void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void display(uint wang,uint qian,uint bai,uint shi,uint ge) { dula=1; P0=table[wang]; dula=0; P0=0xff; wela=1; P0=0xfe; wela=0; delay(1); dula=1; P0=table[qian]; dula=0; P0=0xff; wela=1; P0=0xfd; wela=0; delay(1); dula=1; P0=table[bai]; dula=0; P0=0xff; wela=1; P0=0xfb; wela=0; delay(1); dula=1; P0=table[shi]; dula=0; P0=0xff; wela=1; P0=0xf7; wela=0; delay(1); dula=1; P0=table[ge]; dula=0; P0=0xff; wela=1; P0=0xef; wela=0; delay(1); } void init() { wela=0; dula=0; temp=0; TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; } void timer0() interrupt 1 { TH0=(65536-50000)/256; TL0=(65536-50000)%256; aa++; } INclude<reg52.h> #define uint unsigned int #define uchar unsigned char uint temp,aa,wang,qian,bai,shi,ge; sbit dula=P2^6; sbit wela=P2^7; uchar code table[]={ 0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71}; void display( uint wang,uint qian,uint bai,uint shi,uint ge); void delay(uint z); void init(); void main() { init();//初始化子程序 while(1) { if(aa==20) { aa=0; temp++; if(temp==99999) { temp=0; } wang=temp/10000; qian=(temp-wang*10000)/1000; bai=(temp-wang*10000-qian*1000)/100; shi=(temp-wang*10000-qian*1000-bai*100)/10; ge=temp%10; } display(wang,qian, bai,shi,ge); } } void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void display(uint wang,uint qian,uint bai,uint shi,uint ge) { dula=1; P0=table[wang]; dula=0; P0=0xff; wela=1; P0=0xfe; wela=0; delay(1); dula=1; P0=table[qian]; dula=0; P0=0xff; wela=1; P0=0xfd; wela=0; delay(1); dula=1; P0=table[bai]; dula=0; P0=0xff; wela=1; P0=0xfb; wela=0; delay(1); dula=1; P0=table[shi]; dula=0; P0=0xff; wela=1; P0=0xf7; wela=0; delay(1); dula=1; P0=table[ge]; dula=0; P0=0xff; wela=1; P0=0xef; wela=0; delay(1); } void init() { wela=0; dula=0; temp=0; TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; } void timer0() interrupt 1 { TH0=(65536-50000)/256; TL0=(65536-50000)%256; aa++; }
標(biāo)簽: 矩陣式鍵盤(pán)
上傳時(shí)間: 2021-12-18
上傳用戶:2590813506
The PW4055 is a complete constant-current /constant-voltage linear charger for single cell lithiumion batteries.Its ThinSOT package and low external component count make the PW4055 ideallysuited for portable applications.Furthermore, the PW4055 is specifically designed to work within USBpower specifications.The PW4055 No external sense resistor is needed, and no blocking diode is required due to theinternal MOSFET architecture.Thermal feedback regulates the charge current to limit the dietemperature during high power operation or high ambient temperature. The charge voltage is fixedat 4.2V, and the charge current can be programmed externally with a single resistor. The PW4055automatically terminates the charge cycle when the charge current drops to 1/10th the programmedvalue after the final float voltage is reached. When the input supply (wall adapter or USB supply) isremoved, the PW4055 automatically enters a low current state, dropping the battery drain currentto less than 2μA. The PW4055 can be put into shutdown mode, reducing the supply current to 25μA.The BAT pin has a 7KV ESD(HBM) capability. Other features INclude charge current monitor, undervoltage lockout, automatic recharge and a status pin to indicate charge termination and the presenceof an input voltage
標(biāo)簽: pw4055
上傳時(shí)間: 2022-02-11
上傳用戶:jason_vip1
Agilent 34401A Service Guide.pdfIEC Measurement Category II INcludes electrical devices connected to mains at an outlet on a branch circuit. Such devices INclude most small appliances, test equipment, and other devices that plug into a branch outlet or socket. The 34401A may be used to make measurements with the HI and LO inputs connected to mains in such devices, or to the branch outlet itself (up to 300 VAC). However, the 34401A may not be used with its HI and LO inputs connected to mains in permanently installed electrical devices such as the main circuit-breaker panel, sub-panel disconnect boxes, or permanently wired motors. Such devices and circuits are subject to overvoltages that may exceed the protection limits of the 34401A. Note: Voltages above 300 VAC may be measured only in circuits that are isolated from mains. However, transient overvoltages are also present on circuits that are isolated from mains. The Agilent 34401A are designed to safely withstand occasional transient overvoltages up to 2500 Vpk. Do not use this equipment to measure circuits where transient overvoltages could exceed this level. Additional Notices Waste Electrical and Electronic Equipment (WEEE) Directive 2002/96/EC This product complies with the WEEE Directive (2002/96/EC) marking requirement. The affixed product label (see below) indicates that you must not discard this electrical/electronic product in domestic household waste. Product Category: With reference to the equipment types in the WEEE directive Annex 1, this product is classified as a "Monitoring and Control instrumentation" product. Do not dispose in domestic household waste. To return unwanted products, contact your local Agilent office, or see www.agilent.com/environment/product for more information. Agilent 34138A Test Lead Set The Agilent 34401A is compatible with the Agilent 34138A Test Lead Set described below. Test Lead Ratings Test Leads - 1000V, 15A Fine Tip Probe Attachments - 300V, 3A Mini Grabber Attachment - 300V, 3A SMT Grabber Attachments - 300V, 3A Operation The Fine Tip, Mini Grabber, and SMT Grabber attachments plug onto the probe end of the Test Leads. Maintenance If any portion of the Test Lead Set is worn or damaged, do not use. Replace with a new Agilent 3413
標(biāo)簽: agilent
上傳時(shí)間: 2022-02-20
上傳用戶:
This Getting Started Guide is written for Maxwell beginners and experienced users who would like to quickly re familiarize themselves with the capabilities of MaxwelL.This guide leads you step-by-step through solving and analyzing the results of a rotational actuator magnetostatic problem with motion By following the steps in this guide, you will learn how to perform the following tasks Modify a models design parameters y Assign variables to a model's design parameters.Specify solution settings for a design Validate a designs setupRun a maxwell simulation v Plot the magnetic flux density vecto v INclude motion in the simulation本《入門(mén)指南》是為希望快速重新熟悉MaxwelL功能的Maxwell初學(xué)者和有經(jīng)驗(yàn)的用戶編寫(xiě)的。本指南將引導(dǎo)您逐步解決和分析旋轉(zhuǎn)致動(dòng)器靜運(yùn)動(dòng)問(wèn)題的結(jié)果。按照本指南中的步驟,您將學(xué)習(xí)如何執(zhí)行以下任務(wù)。修改模型設(shè)計(jì)參數(shù)y將變量分配給模型的設(shè)計(jì)參數(shù)。指定設(shè)計(jì)的解決方案設(shè)置驗(yàn)證設(shè)計(jì)設(shè)置運(yùn)行maxwell模擬v繪制磁通密度vecto v在模擬中包含運(yùn)動(dòng)
上傳時(shí)間: 2022-03-10
上傳用戶:
電子書(shū)-十天學(xué)會(huì)單片機(jī)實(shí)例100.pdf//實(shí)例 4:用單片機(jī)控制一個(gè)燈閃爍:認(rèn)識(shí)單片機(jī)的工作頻率 #INclude<reg51.h> //包含單片機(jī)寄存器的頭文件 /**************************************** 函數(shù)功能:延時(shí)一段時(shí)間 *****************************************/ void delay(void) //兩個(gè) void 意思分別為無(wú)需返回值,沒(méi)有參數(shù)傳遞 { unsigned int i; //定義無(wú)符號(hào)整數(shù),最大取值范圍 65535 for(i=0;i<20000;i++) //做 20000 次空循環(huán) ; //什么也不做,等待一個(gè)機(jī)器周期 } /******************************************************* 函數(shù)功能:主函數(shù) (C 語(yǔ)言規(guī)定必須有也只能有 1 個(gè)主函數(shù)) ********************************************************/ void main(void) { while(1) //無(wú)限循環(huán) { P1=0xfe; //P1=1111 1110B, P1.0 輸出低電平 delay(); //延時(shí)一段時(shí)間 P1=0xff; //P1=1111 1111B, P1.0 輸出高電平 www.91
標(biāo)簽: 單片機(jī)
上傳時(shí)間: 2022-03-19
上傳用戶:kingwide
HX711_1Kg#INclude "HX711.h"float Weight = 0;void setup(){ Init_Hx711(); //初始化HX711模塊連接的IO設(shè)置 Serial.begin(9600); Serial.print("Welcome to use!\n"); delay(3000); Get_Maopi(); //獲取毛皮}void loop(){ Weight = Get_Weight(); //計(jì)算放在傳感器上的重物重量 Serial.print(float(Weight/1000),3); //串口顯示重量 Serial.print(" kg\n"); //顯示單位 Serial.print("\n"); //顯示單位 delay(1000); //延時(shí)1s}
上傳時(shí)間: 2022-03-20
上傳用戶:
蟲(chóng)蟲(chóng)下載站版權(quán)所有 京ICP備2021023401號(hào)-1