Monday, 25 November 2013

/*
 * SERVOS_EXECUTION.c
 *
 * Created: 25-Nov-13 11:37:32
 *  Author: avrnarm
 */

#define F_CPU 16000000ul
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRC=0xFF;
DDRD=0xFF;
char i ;
    while(1)
    {

_delay_ms(2000);
for (i=0;i<2;i++)
{
PORTC=0xFF;
PORTD=0xFF;
_delay_us(1000+5.55*10) ;
PORTC=0x00;
PORTD=0x00;
_delay_us(2010) ;
}

Friday, 15 November 2013

/*
Interfacing Ultra Sonic Module (4 PIN HCSR04) with Atmega16
Hardware Pin Configuration: Vcc, Gnd, Trigger input pulse, echo output pulse.

LCD Connected to port A.
Sensor to PORTD.

Sensor |

Trig   --> PD0
Echo   --> PD1
Vcc   --> Vcc
Gnd   --> Gnd

 Programmer: Raj Prajapati
 rajatmelavr@gmail.com

 For any query

*/

//Header File
#include <avr/io.h>
#include <util/delay.h>
#include "ilcd.h"
//Macros
#define US_PORT PORTD
#define US_PIN PIND
#define US_DDR DDRD
#define US_TRIG PD0
#define US_ECHO PD1
//Globle Variable
int distance;
//Calculating width of high pulse in micro second.
#define US_Time_out -12
#define US_NO_OBSTACLE -13
void US_init();
void US_trig();
void US_init()
{
US_DDR|=(1<<US_TRIG);
}

void US_trig()
{
//Send a 10uS pulse on trigger line

US_PORT|=(1<<US_TRIG); //high

_delay_us(15); //wait 15uS

US_PORT&=~(1<<US_TRIG); //low

Basic Interfacing GLCD with ATmega16

Posted by Unknown On 10:13 | No comments
Following is the program to Generate the basic verticle line on the glcd at and 0th Column.
Connection is shown in the Image. PORTC is reserved for the Control Port and PORTB for data Port.
Here we had not used any Library for this purpose.

/*
 * GLCDpattern1.c
 *
 * Created: 14-Nov-13 23:27:35
 *  Author: avrnarm
 *  Description: To print the simple verticle line on the Display.
 */

#define F_CPU 8000000ul

#include <avr/io.h>
#include <util/delay.h>
#include <compat/deprecated.h>


//Macros

//for controlling on portC
#define EN 0
#define RW 1
#define RS 2
#define CS1 3
#define CS2 4
#define RST 5
#define dataport PORTB
#define ctrlport PORTC

//Function Declaration
void GLCD_init(void);
void enable (void)
{
ctrlport|=(1<<EN);
_delay_us(100);
ctrlport&=~(1<<EN);
}

Blogroll

Copyright © 2013 RAJ PRAJAPATI (raj@electronicsrj.com)

Comments

About Projects

We also Provide support in making Electronics Projects at different level at Cheapest price. Contact Us for the further help.