⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main._c

📁 ICCAVR Rainguage counter program
💻 _C
字号:
//ICC-AVR application builder : 14/3/2007 23:29:10
// Target : M16
// Crystal: 7.3728Mhz

#include <stdio.h>
#include <STDLIB.h>
#include "config.h"
#include "predef.h"
#include "lcd.h"

unsigned int rcount;
unsigned char * lcdmsg1;
unsigned char * umsg;
char buffer [33];

//unsigned int count=0; //to count timer0

// INTERRUPT can be interrupted
// SIGNAL can't be interrupted
//for future use
/*
void SIGNAL (SIG_UART_RECV) { // USART RX interrupt
	unsigned char c;
	c = UDR;
	uart_putc(c);
}
*/

void main(void)
{
init_devices();

//initialize the  counter 1 
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
TCCR1A=0x00;
TCCR1B=0x06;


//LCD DISPLAY 
 LCD_IO_INIT (); 
 LCD_INIT (); 
   
while(1)
{

rcount = TCNT1H*256 + TCNT1L;
utoa(buffer, rcount,10);  //integer convert to string  in base decimal
 
  LCD_PutCmd (CLR_DSP);   //clear display
  LCD_Delay(500);  
  LCD_PutCmd (LINE1+0);
  lcdmsg1 = "Current Dropcounts:";
  LCD_PutString (lcdmsg1);
  LCD_PutCmd(LINE2+0);
  LCD_PutString(buffer);
  LCD_PutCmd(LINE2+4);
  LCD_PutString("counts");
  
  SPI_MasterTransmit('A');
 

//format the message into the uabuffer 
//sprintf(uabuffer, "The count H: %d  L:%d \n",TCNT1H, TCNT1L);
//uart_puts(buffer);  //put the uabuffer to the serial 
//alternate method to print out in serial communication
//printf("The count is %d \n",rcount);

delay_ms(200);
}

}

⌨️ 快捷键说明

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