/* This header file declares the internal
register addresses for PIC16F874 */
#include <io16f877.h>
// Main
void main(void)
{
unsigned char temp;
ADCON1 = 0x0f; // Configure PORTE pins as digital input
// Define directions for port pins
TRISE = 0x17;
TRISB = 0x00;
do{
if (IBF) temp = PORTD;
else if (OBF == 0) PORTB = temp;
}while(1);
}
I want to add a light sensor with the high priority in this circuit so when the light is more than a specified value,reading and writing stop working.
and altough I have another circuit with pic16f877 :
#include <io16f874.h>
// Transmit
void TXD(unsigned char data)
{
RC2 = 1;
TXREG = data; // Put data into buffer sneds the data
TXEN = 1;
while(!TRMT); // Wait for empty transmit buffer
TXEN = 0;
RC2 = 0;
}
// Receive
unsigned char RXD(void)
{
unsigned char data;
RC0 = 1;
RC0 = 0;
RC0 = 1;
RC1 = 0;
RCIF = 0;
SREN = 1;
TXEN = 1;
while(!RCIF); // Wait for data to be received
data = RCREG; // Read RCREG into data
RC1 = 1;
TXEN = 0;
return(data); // Return received data
}
// Main
void main(void)
{
unsigned char data;
// Set baud rate(19200[bps])
SPBRG = 191;
TXSTA = 0x90;
TRISC = 0xf8; // Set RC<0:2) as outputs
TRISA = 0xff; // Set RA0 input
ADCON1 = 0x06; // Configure all pins as digital inputs
PORTC = 0xfa;
RCSTA = 0x80;
do{
while(RA0);
data = RXD();
TXD(data);
while(!RA0);
}while(1);
}
when we press X4 the value of dip switch will be display on level meter. I want to add a light sensor in this circuit so when the light is more than a specified value, the circuit stop functioning.
can anyone help me with these two problems??">
[img]https://www.electro-tech-online.com/attachments/untitled-jpg.115594/[/img]
/* This header file declares the internal
register addresses for PIC16F874 */
#include <io16f877.h>
// Main
void main(void)
{
unsigned char temp;
ADCON1 = 0x0f; // Configure PORTE pins as digital input
// Define directions for port pins
TRISE = 0x17;
TRISB = 0x00;
do{
if (IBF) temp = PORTD;
else if (OBF == 0) PORTB = temp;
}while(1);
}
I want to add a light sensor with the high priority in this circuit so when the light is more than a specified value,reading and writing stop working.
and altough I have another circuit with pic16f877 :
#include <io16f874.h>
// Transmit
void TXD(unsigned char data)
{
RC2 = 1;
TXREG = data; // Put data into buffer sneds the data
TXEN = 1;
while(!TRMT); // Wait for empty transmit buffer
TXEN = 0;
RC2 = 0;
}
// Receive
unsigned char RXD(void)
{
unsigned char data;
RC0 = 1;
RC0 = 0;
RC0 = 1;
RC1 = 0;
RCIF = 0;
SREN = 1;
TXEN = 1;
while(!RCIF); // Wait for data to be received
data = RCREG; // Read RCREG into data
RC1 = 1;
TXEN = 0;
return(data); // Return received data
}
// Main
void main(void)
{
unsigned char data;
// Set baud rate(19200[bps])
SPBRG = 191;
TXSTA = 0x90;
TRISC = 0xf8; // Set RC<0:2) as outputs
TRISA = 0xff; // Set RA0 input
ADCON1 = 0x06; // Configure all pins as digital inputs
PORTC = 0xfa;
RCSTA = 0x80;
do{
while(RA0);
data = RXD();
TXD(data);
while(!RA0);
}while(1);
}
when we press X4 the value of dip switch will be display on level meter. I want to add a light sensor in this circuit so when the light is more than a specified value, the circuit stop functioning.
can anyone help me with these two problems??">
[img]https://www.electro-tech-online.com/attachments/untitled-jpg.115594/[/img]
/* This header file declares the internal
register addresses for PIC16F874 */
#include <io16f877.h>
// Main
void main(void)
{
unsigned char temp;
ADCON1 = 0x0f; // Configure PORTE pins as digital input
// Define directions for port pins
TRISE = 0x17;
TRISB = 0x00;
do{
if (IBF) temp = PORTD;
else if (OBF == 0) PORTB = temp;
}while(1);
}
I want to add a light sensor with the high priority in this circuit so when the light is more than a specified value,reading and writing stop working.
and altough I have another circuit with pic16f877 :
#include <io16f874.h>
// Transmit
void TXD(unsigned char data)
{
RC2 = 1;
TXREG = data; // Put data into buffer sneds the data
TXEN = 1;
while(!TRMT); // Wait for empty transmit buffer
TXEN = 0;
RC2 = 0;
}
// Receive
unsigned char RXD(void)
{
unsigned char data;
RC0 = 1;
RC0 = 0;
RC0 = 1;
RC1 = 0;
RCIF = 0;
SREN = 1;
TXEN = 1;
while(!RCIF); // Wait for data to be received
data = RCREG; // Read RCREG into data
RC1 = 1;
TXEN = 0;
return(data); // Return received data
}
// Main
void main(void)
{
unsigned char data;
// Set baud rate(19200[bps])
SPBRG = 191;
TXSTA = 0x90;
TRISC = 0xf8; // Set RC<0:2) as outputs
TRISA = 0xff; // Set RA0 input
ADCON1 = 0x06; // Configure all pins as digital inputs
PORTC = 0xfa;
RCSTA = 0x80;
do{
while(RA0);
data = RXD();
TXD(data);
while(!RA0);
}while(1);
}
when we press X4 the value of dip switch will be display on level meter. I want to add a light sensor in this circuit so when the light is more than a specified value, the circuit stop functioning.
can anyone help me with these two problems??">
The Engineering Projects
A lot of Engineering projects and tutorials for the students to help them in their final year projects and semester projects.
/* This header file declares the internal
register addresses for PIC16F874 */
#include <io16f877.h>
// Main
void main(void)
{
unsigned char temp;
ADCON1 = 0x0f; // Configure PORTE pins as digital input
// Define directions for port pins
TRISE = 0x17;
TRISB = 0x00;
do{
if (IBF) temp = PORTD;
else if (OBF == 0) PORTB = temp;
}while(1);
}
I want to add a light sensor with the high priority in this circuit so when the light is more than a specified value,reading and writing stop working.
and altough I have another circuit with pic16f877 :
#include <io16f874.h>
// Transmit
void TXD(unsigned char data)
{
RC2 = 1;
TXREG = data; // Put data into buffer sneds the data
TXEN = 1;
while(!TRMT); // Wait for empty transmit buffer
TXEN = 0;
RC2 = 0;
}
// Receive
unsigned char RXD(void)
{
unsigned char data;
RC0 = 1;
RC0 = 0;
RC0 = 1;
RC1 = 0;
RCIF = 0;
SREN = 1;
TXEN = 1;
while(!RCIF); // Wait for data to be received
data = RCREG; // Read RCREG into data
RC1 = 1;
TXEN = 0;
return(data); // Return received data
}
// Main
void main(void)
{
unsigned char data;
// Set baud rate(19200[bps])
SPBRG = 191;
TXSTA = 0x90;
TRISC = 0xf8; // Set RC<0:2) as outputs
TRISA = 0xff; // Set RA0 input
ADCON1 = 0x06; // Configure all pins as digital inputs
PORTC = 0xfa;
RCSTA = 0x80;
do{
while(RA0);
data = RXD();
TXD(data);
while(!RA0);
}while(1);
}
when we press X4 the value of dip switch will be display on level meter. I want to add a light sensor in this circuit so when the light is more than a specified value, the circuit stop functioning.
can anyone help me with these two problems??
Comments on ‘’ parallel slave port in pic16f877 / usrt with pic16f87x ‘’ ( 0 )