beginer electroner
New Member
I need a link on the adc working, and some basic application
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
//----- Include Files ---------------------------------------------------------
#include <avr/io.h> // include I/O definitions (port names, pin names, etc)
#include <avr/signal.h> // include "signal" names (interrupt names)
#include <avr/interrupt.h> // include interrupt support
#include <avr/iom8.h>
#include <avr/delay.h>
#include "global.h" // include our global settings
//#include "uart.h" // include uart function library
#include "rprintf.h" // include printf function library
#include "a2d.h" // include A/D converter function library
#include "timer.h" // include timer function library (timing, PWM, etc)
#include "lcd.h"
//----- Begin Code ------------------------------------------------------------
int main(void)
{
u08 a=0;
u08 Pressure;
a2dInit();
// initialize LCD
lcdInit();
// direct printf output to LCD
rprintfInit(lcdDataWrite);
// print message on LCD
rprintf("Welcome");
DDRC = 0x00;
PORTC = 0x00;
lcdClear();
// display a bargraph of the analog voltages on a2d channels 0,1
while(1)
{
lcdGotoXY(0,0);
lcdProgressBar(a2dConvert8bit(0), 255, 20);
lcdGotoXY(0,1);
Pressure=(int)((((a2dConvert8bit(0)+0.3)/255)-0.04)/0.009);
rprintf("Pressure:%d kPa", Pressure);
}
return 0;
}