huomen._c

来自「是一款开发板的外围电路试验程序(附有原理图)」· _C 代码 · 共 62 行

_C
62
字号
//ICC-AVR application builder : 2006-11-4 10:04:08
// Target : M16
// Crystal: 7.3728Mhz

#include <iom16v.h>
#include <macros.h>
#include <stdlib.h>

#include "12864.h"
int i,j;
void port_init(void)
{
 PORTA = 0xFF;
 DDRA  = 0xFF;
 PORTB = 0xFF;
 DDRB  = 0xFF;
 PORTC = 0xFF; //m103 output only
 DDRC  = 0xFF;
 PORTD = 0xFF;
 DDRD  = 0xFF;
}

//call this routine to initialise all peripherals
void init_devices(void)
{
 //stop errant interrupts until set up
 CLI(); //disable all interrupts
 port_init();

 MCUCR = 0x00;
 GICR  = 0x00;
 TIMSK = 0x00; //timer interrupt sources
 SEI(); //re-enable interrupts
 //all peripherals are now initialised
}

//
void main(void)
{
 int k;
 init_devices();
 

  OutI(0,0x3e);
  OutI(0,0xb8);
  OutI(0,0x40);
  
  OutI(0,0xC0);
  OutI(0,0x3f); //启动LCD
  ClearDisplay();
  ClearDisplay();
 //DisplayLine(0,0x04,0,1);
 //DisplayLine(128,0x04,4,1);
 //DisplayLine(256,0x04,1,1);
 


  
 //insert your functional code here...
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?