共阳极连接的键盘扫描程序 PC5 pc4 PC3 PC2 PC1 PC0 PC10 0 1 2 3 17 18 PC9 4 5 6 7 19 20 PC8 8 9 10 11 21 22 PC7 12 13 14 15 23 24 PC6 16 25
上传时间: 2014-01-17
上传用户:familiarsmile
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[] = { /*-- 调入了一幅图像:这是您新建的图像 --*/ /*-- 宽度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
电压计(c语言编写的) 通过led灯显示 电路图说明: 1、R1、R2、D1、D2 组成发光二极管显示,显示过压或过流状态; 2、PC3外接模拟信号 采用内部参考电压所以AREF传电容接地抗干扰AVCC接VCC提供AD转换电压 3、PC5提供164的时钟信号 pc4提供串行输入信号 164具有10ma的输出电流,又具有串入并出以及信号锁存的动能,数码管又为共阴管,所以无须另加驱动 这里采用静态显示 4、现以在程序中加入小数点显示
上传时间: 2014-12-04
上传用户:冇尾飞铊
TG19264A接口程序(AVR模拟方式) 连线图 连线图: LCM------S8515* *LCM----S8515* *LCM-------S8515* *LCM------S8515* * *DB0-------PA0* *DB4-----PA4* *D/I--------PC6* *CS1-------PC5* * *DB1-------PA1* *DB5-----PA5* *R/W--------PC7* *CS2-------pc4* * *DB2-------PA2* *DB6-----PA6* */RST-------VCC* *CS3-------PD2* * *DB3-------PA3* *DB7-----PA7* *E----------PC3* * 注:AT90S8515的晶振频率为8MHz
上传时间: 2013-12-15
上传用户:lunshaomo
This is a source of 13.560MHz RFID card reader for TRH031M as ATMEGA8-16AU MPU. The title is 3Alogics TRH031M 13.56MHz RFID Reader V1.0. project : RFID Reader V2.0 Target : MEGA8-16AU Crystal: 16.000 Mhz Input : TRH031M RFID 13.56MHz Output : RS232C 115200,N,8,1 Compiler : ICC-AVR V6.26C // Pin configuration for ATMEGA8-16AU TQFP32 // #30 RXD <--- RXD (SP3232) // #31 TXD ---> TXD (SP3232) // #32 PD2/INT0 <--- INTR (TRH031M) // # 1 PD3/INT1 ---> RST (TRH031M) // # 2 PD4 ---> D4 (TRH031M) // # 9 PD5 ---> D5 (TRH031M) // #10 PD6 ---> D6 (TRH031M) // #11 PD7 ---> D7 (TRH031M) // #12 PB0 ---> D0 (TRH031M) // #13 PB1 ---> D1 (TRH031M) // #14 PB2 ---> D2 (TRH031M) // #15 PB3 ---> D3 (TRH031M) // #16 PB4 ---> CSB (TRH031M) // #17 PB5 ---> LED // #23 PC0 ---> A0 (TRH031M) // #24 PC1 ---> A1 (TRH031M) // #25 PC2 ---> A2 (TRH031M) // #26 PC3 ---> ALE (TRH031M) // #27 pc4 ---> /RD (TRH031M) // #28 PC5 ---> /WR (TRH031M)
标签: 13.560 ATMEGA 3Alogi source
上传时间: 2017-03-31
上传用户:s363994250
LM3S系列ARM用GPIO模拟并行总线扩展32KB SRAM PF0~PF7 D0~D7(数据总线) PA0~PA7 A0~A7(地址总线低8位) PB0~PB7 A8~A15(地址总线高8位) PB7 /CE(片选) pc4 /WE(写使能) PC5 /OE(读使能) 32KB SRAM 映射在地址0x0000~0x4FFF之间 为了加快访问速度,软件上将采用寄存器方式进行操作 PB7原为/TRST功能,现在也解放出来作为地址线A15
上传时间: 2014-01-01
上传用户:wlcaption
卡尔曼滤波在AVR单片机的应用,引脚接法:PC1 (ADC1) Y Accel (Pin 8) PC2 (ADC2) Z Accel (Pin 7) PC3 (ADC3) X Rate (Pin 3) pc4 (ADC4) Y Rate (Pin 4) PC5 (ADC5) VRef (Pin 5)
上传时间: 2013-12-13
上传用户:dengzb84