You have no items in your shopping cart.

Subtotal: 0.00

Abstract

This paper presents one of the counter applications that can change its state in either direction, under control of a falling edge and raising edge. Given here can count numbers from 0 to 9999 in up and down modes depending upon the state of the selector in the software.

It can be used to count the number of rotations per second in a motor i.e. speed. It can also be used as a metal detector and it can also be used at gates of parking areas and other public places.

This circuit divided in two parts: sensor and counter display. The sensor would detect the Metal and provide an input to the controller which would run the counter in raising edge / falling edge mode depending upon the selector setting. The same count is displayed on a set of LCD through the controller.

Block Diagram

Block Diagram

Project Description

This project is mainly based on digital counter using proximity sensor. A proximity sensor is a sensor in a position to detect the presence of nearby objects without any physical get in touch with. Initially connect the microcontroller with 9V power supply and interface the proximity sensor with ARM7 microcontroller with the capture pin. proximity sensor output is initially low whenever there is a presence of metal the proximity sensor detects and the signal goes high this is captured by using the capture pin in microcontroller.

The timer is switched ON and capture pin is set to detect the raising edge. The counter value is displayed on LCD and through serial port. It can be used to count the number of rotations per second in a motor i.e. speed. It can also be used as a metal detector and it can also be used at gates of parking areas and other public places.

proximity sensor

proximity sensor

A proximity sensor is a sensor in a position to detect the presence of nearby objects without any physical get in touch with. A proximity sensor often emits an electromagnetic field or a beam of electromagnetic radiation (infrared, for instance), and looks for changes in the field or return signal. The object becoming sensed is usually referred to as the proximity sensor’s target. Different proximity sensor targets demand diverse sensors. For example, a capacitive or photoelectric sensor could be suitable for a plastic target; an inductive proximity sensor normally demands a metal target.

The maximum distance that this sensor can detect is defined "nominal range". Some sensors have adjustments of the nominal range or means to report a graduated detection distance. proximity sensors can have a high reliability and long functional life because of the absence of mechanical parts and lack of physical contact between sensor and the sensed object. Abstract

This paper presents one of the counter applications that can change its state in either direction, under control of a falling edge and raising edge. Given here can count numbers from 0 to 9999 in up and down modes depending upon the state of the selector in the software.

It can be used to count the number of rotations per second in a motor i.e. speed. It can also be used as a metal detector and it can also be used at gates of parking areas and other public places.

This circuit divided in two parts: sensor and counter display. The sensor would detect the Metal and provide an input to the controller which would run the counter in raising edge / falling edge mode depending upon the selector setting. The same count is displayed on a set of LCD through the controller.

Block Diagram



Block Diagram

Project Description

This project is mainly based on digital counter using proximity sensor. A proximity sensor is a sensor in a position to detect the presence of nearby objects without any physical get in touch with. Initially connect the microcontroller with 9V power supply and interface the proximity sensor with ARM7 microcontroller with the capture pin. proximity sensor output is initially low whenever there is a presence of metal the proximity sensor detects and the signal goes high this is captured by using the capture pin in microcontroller.

The timer is switched ON and capture pin is set to detect the raising edge. The counter value is displayed on LCD and through serial port. It can be used to count the number of rotations per second in a motor i.e. speed. It can also be used as a metal detector and it can also be used at gates of parking areas and other public places.

proximity sensor

proximity sensor

A proximity sensor is a sensor in a position to detect the presence of nearby objects without any physical get in touch with. A proximity sensor often emits an electromagnetic field or a beam of electromagnetic radiation (infrared, for instance), and looks for changes in the field or return signal. The object becoming sensed is usually referred to as the proximity sensor’s target. Different proximity sensor targets demand diverse sensors. For example, a capacitive or photoelectric sensor could be suitable for a plastic target; an inductive proximity sensor normally demands a metal target.

The maximum distance that this sensor can detect is defined "nominal range". Some sensors have adjustments of the nominal range or means to report a graduated detection distance. proximity sensors can have a high reliability and long functional life because of the absence of mechanical parts and lack of physical contact between sensor and the sensed object. proximity sensors are also used in machine vibration monitoring to measure the variation in distance between a shaft and its support bearing. This is common in large steam turbines, compressors, and motors that use sleeve-type bearings.

Hardware requirements

Software requirements

  • Programming Language: Embedded C
  • KEIL U Vision IDE
  • Flash magic
  • Orcad 16.3

Source Code

#define CR 0x0D
#include 
#define BUZZ 7
#define LED 1
void init_serial (void);
int putchar (int ch);
int getchar (void);
void lcd_initialize (void);
void delay (unsigned int);
void lcd_cmd (unsigned char);
void lcd_data (unsigned char);
unsigned char test;
const unsigned char msg[] = ("PS­ARM EVB KIT "); //msg
const unsigned char msg1[]= (" ::LCD DEMO:: "); //msg1
const unsigned char cmd[4] = {0x38,0x0c,0x06,0x01}; //lcd commands
unsigned char ch, I = 0;
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Initialize
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_initialize (void)
{
int i;
for(i=0;i<4;i++)
{
IOCLR0 = 0x00FF0000;
lcd_cmd (cmd[ I ]);
delay(15);
}
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Command Send
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_cmd(unsigned char data)
{
IOPIN0 = data << 16;
IOCLR1 |= 0x100000; //RS
IOCLR1 |= 0x200000; //RW
IOSET1 |= 0x400000; //EN
delay(15);
IOCLR1 |= 0x400000; //EN
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Data Send
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_data(unsigned char data)
{
IOPIN0 = data << 16;
IOSET1 |= 0x100000; //RS
IOCLR1 |= 0x200000; //RW
IOSET1 |= 0x400000; //EN
delay(15);
IOCLR1 |= 0x400000; //EN
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Display Msg
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_display(void)
{
char i;
/* First line message */
IOCLR0 = 0x00FF0000;
lcd_cmd(0x80);
delay(15);
i=0;
while(msg[i]!='\0')
{
IOCLR0 = 0x00FF0000;
lcd_data(msg[i]);
i++;
delay(15);
}
delay(15);
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// Delay Routine
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void delay(unsigned int n)
{
int i,j;
for(i=0;i>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int main(void)
{
char *Ptr = "*** UART0 Demo ***\n\n\rType Characters to be echoed!!\n\n\r";
PINSEL0 = 0;
PINSEL1 = 0;
IODIR0 = 0XFFFFFFFF; //PORT [P0.16­­P0.31] output
IODIR1 = 0X00Ff0000; //PORT [P1.20­­P1.23] output
IODIR0 |= 0xFF << LED; //Configure P1.24 ­ P1.31 as
Output
delay(10);
lcd_initialize(); //Initialize LCD
delay(10);
VPBDIV = 0x02; //Divide Pclk by two
init_serial();
delay(15);
lcd_display();
delay(15);
while(1)
{
while (*Ptr)
{
putchar(*Ptr++);
}
ch=getchar();
switch(ch)
{
case 0x33: IOSET1 |= 0x30080; break;
case 0x34: IOCLR1 |= 0x30080; break;
}
lcd_cmd(0xC0 + i++);
if(i==16) i=0;
lcd_data(ch);
}
}
//<<<<<<<<<<<<<<<<<<<<<<<<< Serial Initialization
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void init_serial (void) /* Initialize Serial Interface */
{
PINSEL0 = 0x00000005; /* Enable RxD0 and TxD0 */
U0LCR = 0x00000083; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 0x000000C3; /* 9600 Baud Rate @ 30MHz VPB Clock */
U0LCR = 0x00000003; /* DLAB = 0 */
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<< Putchar Function
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int putchar (int ch) /* Write character to Serial Port */
{
if (ch == '\n') {
while (!(U0LSR & 0x20));
U0THR = CR; /* output CR */
}
while (!(U0LSR & 0x20));
return (U0THR = ch);
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<< Getchar Function
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int getchar (void) /* Read character from Serial Port */
{
while (!(U0LSR & 0x01));
return (U0RBR);
}

Conclusion

Digital counter is using proximity sensor is a application which can be used for multiple application. It can be used to count the number of rotations per second in a motor i.e. speed. It can also be used as a metal detector and it can also be used at gates of parking areas and other public places.

proximity sensors are also used in machine vibration monitoring to measure the variation in distance between a shaft and its support bearing. This is common in large steam turbines, compressors, and motors that use sleeve-type bearings.

Hardware requirements

Software requirements

  • Programming Language: Embedded C
  • KEIL U Vision IDE
  • Flash magic
  • Orcad 16.3

Source Code

#define CR 0x0D
#include 
#define BUZZ 7
#define LED 1
void init_serial (void);
int putchar (int ch);
int getchar (void);
void lcd_initialize (void);
void delay (unsigned int);
void lcd_cmd (unsigned char);
void lcd_data (unsigned char);
unsigned char test;
const unsigned char msg[] = ("PS­ARM EVB KIT "); //msg
const unsigned char msg1[]= (" ::LCD DEMO:: "); //msg1
const unsigned char cmd[4] = {0x38,0x0c,0x06,0x01}; //lcd commands
unsigned char ch, I = 0;
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Initialize
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_initialize (void)
{
int i;
for(i=0;i<4;i++)
{
IOCLR0 = 0x00FF0000;
lcd_cmd (cmd[ I ]);
delay(15);
}
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Command Send
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_cmd(unsigned char data)
{
IOPIN0 = data << 16;
IOCLR1 |= 0x100000; //RS
IOCLR1 |= 0x200000; //RW
IOSET1 |= 0x400000; //EN
delay(15);
IOCLR1 |= 0x400000; //EN
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Data Send
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_data(unsigned char data)
{
IOPIN0 = data << 16;
IOSET1 |= 0x100000; //RS
IOCLR1 |= 0x200000; //RW
IOSET1 |= 0x400000; //EN
delay(15);
IOCLR1 |= 0x400000; //EN
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// LCD Display Msg
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void lcd_display(void)
{
char i;
/* First line message */
IOCLR0 = 0x00FF0000;
lcd_cmd(0x80);
delay(15);
i=0;
while(msg[i]!='\0')
{
IOCLR0 = 0x00FF0000;
lcd_data(msg[i]);
i++;
delay(15);
}
delay(15);
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
// Delay Routine
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void delay(unsigned int n)
{
int i,j;
for(i=0;i>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int main(void)
{
char *Ptr = "*** UART0 Demo ***\n\n\rType Characters to be echoed!!\n\n\r";
PINSEL0 = 0;
PINSEL1 = 0;
IODIR0 = 0XFFFFFFFF; //PORT [P0.16­­P0.31] output
IODIR1 = 0X00Ff0000; //PORT [P1.20­­P1.23] output
IODIR0 |= 0xFF << LED; //Configure P1.24 ­ P1.31 as
Output
delay(10);
lcd_initialize(); //Initialize LCD
delay(10);
VPBDIV = 0x02; //Divide Pclk by two
init_serial();
delay(15);
lcd_display();
delay(15);
while(1)
{
while (*Ptr)
{
putchar(*Ptr++);
}
ch=getchar();
switch(ch)
{
case 0x33: IOSET1 |= 0x30080; break;
case 0x34: IOCLR1 |= 0x30080; break;
}
lcd_cmd(0xC0 + i++);
if(i==16) i=0;
lcd_data(ch);
}
}
//<<<<<<<<<<<<<<<<<<<<<<<<< Serial Initialization
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void init_serial (void) /* Initialize Serial Interface */
{
PINSEL0 = 0x00000005; /* Enable RxD0 and TxD0 */
U0LCR = 0x00000083; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 0x000000C3; /* 9600 Baud Rate @ 30MHz VPB Clock */
U0LCR = 0x00000003; /* DLAB = 0 */
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<< Putchar Function
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int putchar (int ch) /* Write character to Serial Port */
{
if (ch == '\n') {
while (!(U0LSR & 0x20));
U0THR = CR; /* output CR */
}
while (!(U0LSR & 0x20));
return (U0THR = ch);
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<< Getchar Function
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int getchar (void) /* Read character from Serial Port */
{
while (!(U0LSR & 0x01));
return (U0RBR);
}

Conclusion

Digital counter is using proximity sensor is a application which can be used for multiple application. It can be used to count the number of rotations per second in a motor i.e. speed. It can also be used as a metal detector and it can also be used at gates of parking areas and other public places.