16 16點陣顯示漢字原理及顯示程序 #include "config.h" #define DOTLED_LINE_PORT PORTB #define DOTLED_LINE_DDR DDRB #define DOTLED_LINE_PIN PINB #define DOTLED_LINE_SCKT PB1 #define DOTLED_LINE_SCKH PB5 #define DOTLED_LINE_SDA PB3 #define DOTLED_ROW_PORT PORTC #define DOTLED_ROW_DDR DDRC #define DOTLED_ROW_PIN PINC #define DOTLED_ROW_A0 PC0 #define DOTLED_ROW_A1 PC1 #define DOTLED_ROW_A2 PC2 #define DOTLED_ROW_A3 PC3 #define DOTLED_ROW_E PC4 uint8 font[] = { /*-- 調(diào)入了一幅圖像:這是您新建的圖像 --*/ /*-- 寬度x高度=16x16 --*/ 0x00,0x00,0x00,0x00,0x08,0x38,0x18,0x44,0x08,0x44,0x08,0x04,0x08,0x08,0x08,0x10, 0x08,0x20,0x08,0x40,0x08,0x40,0x08,0x40,0x3E,0x7C,0x00,0x00,0x00,0x00,0x00,0x00 }; static void TransmitByte(uint8 byte); static void SelectRow(uint8 row); static void FlipLatchLine(void); static void TransmitByte(uint8 byte) { uint8 i; for(i = 0 ; i < 8 ; i ++) { if(byte & (1 << i)) { DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA); } else { DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SDA); } //__delay_cycles(100); DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKH); //__delay_cycles(100); DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKH); //__delay_cycles(100); } } static void SelectRow(uint8 row) { //row -= 1; row |= DOTLED_ROW_PIN & 0xe0; DOTLED_ROW_PORT = row; } static void FlipLatchLine(void) { DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SCKT); DOTLED_LINE_PORT &= ~_BV(DOTLED_LINE_SCKT); } void InitDotLedPort(void) { DOTLED_LINE_PORT &= ~(_BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH)); DOTLED_LINE_PORT |= _BV(DOTLED_LINE_SDA); DOTLED_LINE_DDR |= _BV(DOTLED_LINE_SCKT) | _BV(DOTLED_LINE_SCKH) | _BV(DOTLED_LINE_SDA); DOTLED_ROW_PORT |= 0x1f; DOTLED_ROW_PORT &= 0xf0; DOTLED_ROW_DDR |= 0x1f; } void EnableRow(boolean IsEnable) { if(IsEnable) { DOTLED_ROW_PORT &= ~_BV(DOTLED_ROW_E); } else { DOTLED_ROW_PORT |= _BV(DOTLED_ROW_E); } } void PrintDotLed(uint8 * buffer) { uint8 i , tmp; for(i = 0 ; i < 16 ; i ++) { tmp = *buffer ++; TransmitByte(~tmp); tmp = *buffer ++; TransmitByte(~tmp); SelectRow(i); FlipLatchLine(); } } void main(void) { InitDotLedPort(); EnableRow(TRUE); while(1) { PrintDotLed(font); __delay_cycles(5000); } } //---------------------------------------------------- config.h文件 #ifndef _CONFIG_H #define _CONFIG_H //#define GCCAVR #define CPU_CYCLES 7372800L #ifndef GCCAVR #define _BV(bit) (1 << (bit)) #endif #define MSB 0x80 #define LSB 0x01 #define FALSE 0 #define TRUE 1 typedef unsigned char uint8; typedef unsigned int uint16; typedef unsigned long uint32; typedef unsigned char boolean; #include <ioavr.h> #include <inavr.h> #include "dotled.h" #endif //-----
上傳時間: 2013-11-18
上傳用戶:mnacyf
SelectionDemo also has code (not included in the preceding snippet) that changes the table s selection orientation. By changing a couple of boolean values, you can make the table allow either column selections or individual cell selections, instead of row selections.
標(biāo)簽: SelectionDemo the preceding included
上傳時間: 2015-05-04
上傳用戶:gut1234567
delphi 自定義網(wǎng)絡(luò)函數(shù):unit net interface uses sysutils ,windows ,dialogs ,winsock ,classes ,comobj ,wininet //得到本機的局域網(wǎng)ip地址 function getlocalip(var localip:string): boolean //通過ip返回機器名 function getnamebyipaddr(ipaddr: string var macname: string): boolean //獲取網(wǎng)絡(luò)中sqlserver列表 function getsqlserverlist(var list: tstringlist): boolean //獲取網(wǎng)絡(luò)中的所有網(wǎng)絡(luò)類型 function getnetlist(var list: tstringlist): boolean //獲取網(wǎng)絡(luò)中的工作組
標(biāo)簽: interface sysutils classes dialogs
上傳時間: 2015-05-09
上傳用戶:wanghui2438
unit Other interface Uses Windows,tlhelp32,PsAPI type PStrData = ^TStrData TStrData = record Ident: Integer Str: string end TUseInfo=record QQ, Mail, Page:string DL:boolean end TSendMailInfo=record IPAddress, FAddress, FName, FPW, FCName, FCPW:string //發(fā)信郵箱檢證用戶密碼 end { FloatToText, FloatToTextFmt, TextToFloat, and FloatToDecimal type codes }
標(biāo)簽: TStrData interface PStrData Windows
上傳時間: 2014-12-22
上傳用戶:asddsd
Visual Basic 6.0可以通過調(diào)用API函數(shù)格式化一個磁盤,無論是軟盤還是硬盤。 打開一個新的項目(工程1) ,如果你沒有更改過缺省模式,那么Visual Basic 6.0會自動添加一個form1文件,在form1上添加一個命令控件,將下面的代碼拷入。 Option Explicit Private Declare Function SHFormatDrive Lib"shell32"( ByVal Hend AS Long,ByVal Drive AS Long,ByVal FormatID AS Long,ByVal Options AS Long) as Long Private Sub FormatDisk(intDrive as integer,blnQuickFormat as boolean) dim lngReturn As Long if (blnQuickFormat) then lngReturn= SHFormatDrive(0,intDrive,0&,1&) else lngReturn= SHFormatDrive(0,intDrive,0&,0&) end if end Sub Private Sub Command1_Click() call FormatDisk(0,True) End Sub 運行此程序。 注意FormatDisk函數(shù)的第一個變量很重要,他的值是0,1,2時代表格式化的分別是:A、B、C盤。
標(biāo)簽: Visual Basic 6.0 API
上傳時間: 2015-10-05
上傳用戶:kytqcool
編譯原理詞法和語法分析,體內(nèi)容是產(chǎn)生一個二元式文本文件,擴(kuò)展名為dyd,可將Pascal程序(測試程序)分解成為一個一個的單詞,并查“單詞符號與種別對照表”得出其種別,用一數(shù)字表示,范圍1-56(52-56分別對應(yīng)保留字integer、real、boolean、char)。
上傳時間: 2013-12-11
上傳用戶:003030
問題描述:編寫一個JAVA程序,用面向?qū)ο笤O(shè)計的方法編寫一個電話卡的類。包括卡號、密碼、余額、撥入號碼等 b)基本要求:類的屬性有卡號、密碼、余額、撥入號碼,電話卡的常用操作可以用連接電話方法、返回余額方法與通電話方法來實現(xiàn)。 c)方法功能描述: 構(gòu)造方法(PhoneCard(卡號,密碼,余額,撥入號碼))可以完成屬性值初始化賦值,并判斷余額,余額為負(fù)就退出系統(tǒng),請在構(gòu)造方法中將初始時的連接置為false即表示沒有連接。 卡號long cardNumber 密碼private int password,余額double balance,撥入號碼string connectNumber boolean connected(一個布爾類型變量表示電話卡連接狀態(tài),初始時默認(rèn)沒有連接,值為false,當(dāng)調(diào)用連接電話方法()后,在判斷卡號和密碼相匹配后值置為true) 連接電話方法(performConnection(卡號,密碼))可以完成檢查卡號和密碼,它是只有在卡號和密碼相匹配時才連接 返回余額方法(getBalance())得到電話卡的余額 通電話方法(performDial())是模擬通過過程中,余額會不斷減少,每調(diào)用此方法,電話卡的余額減少0。5元,打一次電話調(diào)用一次
上傳時間: 2014-01-20
上傳用戶:1109003457
Delphi6.0函數(shù)大全,Delphi程序員的至愛。∷圖書簡介∷ 電子圖書名:Delphi6函數(shù)大全 Delphi6函數(shù)大全(1) <> 首部 function AnsiResemblesText(const AText, AOther: string): boolean $[StrUtils.pas功能 返回兩個字符串是否相似說明 ANSI(American National Standards Institute)美國國家標(biāo)準(zhǔn)協(xié)會 不區(qū)分大小寫參考 function StrUtils.SoundexProc var StrUtils.AnsiResemblesProc例子 CheckBox1.Checked := AnsiResemblesText(Edit1.Text, Edit2.Text)
上傳時間: 2016-01-25
上傳用戶:mikesering
武林DLL注入源碼 VB調(diào)用 Private Declare Function CallHotKey Lib "wulin.dll" (ByVal hWnd As Long, ByVal hotkey As Long) As boolean Private Declare Function CallBase Lib "wulin.dll" (ByVal hWnd As Long, ByVal action As Long) As boolean CallHotKey(窗體句柄,HotKey) HotKey ====0---------17 分別是0-----9 F1-----F8 CallBase(窗體句柄,Action) Action==0-------N 分別實現(xiàn)不同的功能 Action=0 選怪 函數(shù)反回值是 布爾值 ( 窗體句柄,Action 窗體句柄,HotKey 都為DWORD值)
標(biāo)簽: ByVal CallHotKey Function Private
上傳時間: 2013-11-25
上傳用戶:maizezhen
Floyd-Warshall算法描述 1)適用范圍: a)APSP(All Pairs Shortest Paths) b)稠密圖效果最佳 c)邊權(quán)可正可負(fù) 2)算法描述: a)初始化:dis[u,v]=w[u,v] b)For k:=1 to n For i:=1 to n For j:=1 to n If dis[i,j]>dis[i,k]+dis[k,j] Then Dis[I,j]:=dis[I,k]+dis[k,j] c)算法結(jié)束:dis即為所有點對的最短路徑矩陣 3)算法小結(jié):此算法簡單有效,由于三重循環(huán)結(jié)構(gòu)緊湊,對于稠密圖,效率要高于執(zhí)行|V|次Dijkstra算法。時間復(fù)雜度O(n^3)。 考慮下列變形:如(I,j)∈E則dis[I,j]初始為1,else初始為0,這樣的Floyd算法最后的最短路徑矩陣即成為一個判斷I,j是否有通路的矩陣。更簡單的,我們可以把dis設(shè)成boolean類型,則每次可以用“dis[I,j]:=dis[I,j]or(dis[I,k]and dis[k,j])”來代替算法描述中的藍(lán)色部分,可以更直觀地得到I,j的連通情況。
標(biāo)簽: Floyd-Warshall Shortest Pairs Paths
上傳時間: 2013-12-01
上傳用戶:dyctj
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1