Shamooooot
Newbie level 6
- Joined
- Jan 1, 2013
- Messages
- 14
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,420
NEED HELP PLEASE!!!:-(
int t;
unsigned int adcvalue;
//LCD pinout settings
sbit LCD_RS at Rc3_bit;
sbit LCD_EN at Rc5_bit;
sbit LCD_d0 at Rb0_bit;
sbit LCD_d1 at Rb1_bit;
sbit LCD_d2 at Rb2_bit;
sbit LCD_d3 at Rb3_bit;
sbit LCD_d4 at Rb4_bit;
sbit LCD_d5 at Rb5_bit;
sbit LCD_d6 at Rb6_bit;
sbit LCD_d7 at Rb7_bit;
//Pin direction
sbit LCD_RS_Direction at TRISc3_bit;
sbit LCD_EN_Direction at TRISc5_bit;
sbit LCD_d0_Direction at TRISB0_bit;
sbit LCD_d1_Direction at TRISB1_bit;
sbit LCD_d2_Direction at TRISB2_bit;
sbit LCD_d3_Direction at TRISB3_bit;
sbit LCD_d4_Direction at TRISB4_bit;
sbit LCD_d5_Direction at TRISB5_bit;
sbit LCD_d6_Direction at TRISB6_bit;
sbit LCD_d7_Direction at TRISB7_bit;
void main()
{
TRISA = 0xFF; // PORTA Input
LCD_Init();
LCD_out(1,4,"J.U.S.T");
delay_ms(100);
LCD_out(1,3,"Biomedical");
LCD_out(2,3,"Engineering");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
delay_ms(100);
LCD_out(1,4,"Done By");
LCD_out(2,3,"M.Juhair");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
LCD_out(1,4,"& M. Fahed");
LCD_out(2,3,"& A.Jroud");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
LCD_out(1,1,"Supervised By Dr.");
LCD_out(2,1,"Areen Al-Basheer");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
while (1) {
t = ADC_read(2); // get ADC value from 2nd channel
adcvalue=t;
}
if (adcvalue>>2) {
LCD_out(1,1,"RATE/MIN=(30)");
}
}
The Micro controller in the normal case it receives once Low and once high in ordered or not ordered intervals on its A2 input, and in each interval (in a minute for example) it shows the number of transition from low to high or vice versa. For example it shows on the screen:
RATE PER MIN = ("number of transitions")
OK…
but when input becomes low for 10 or more seconds, a clock starts on the screen and it counts for two minutes. Once input comes high to the PIN 2 the program back to it's normal mode for example "RATE PER MIN = (30)". But if the 2 minutes completed the screen shows:
WARNING !!!
Oxygenated Blood Problem
and a buzzer connected on D7 for example is activated
"My biggest concern is that I can't get the value on A2 input to compare it in an if statement with 2 volts for example
if (adcvalue>>2) {
LCD_out(1,1,"RATE/MIN=(30)");
} even though the condition is true"
Thanks in advance
int t;
unsigned int adcvalue;
//LCD pinout settings
sbit LCD_RS at Rc3_bit;
sbit LCD_EN at Rc5_bit;
sbit LCD_d0 at Rb0_bit;
sbit LCD_d1 at Rb1_bit;
sbit LCD_d2 at Rb2_bit;
sbit LCD_d3 at Rb3_bit;
sbit LCD_d4 at Rb4_bit;
sbit LCD_d5 at Rb5_bit;
sbit LCD_d6 at Rb6_bit;
sbit LCD_d7 at Rb7_bit;
//Pin direction
sbit LCD_RS_Direction at TRISc3_bit;
sbit LCD_EN_Direction at TRISc5_bit;
sbit LCD_d0_Direction at TRISB0_bit;
sbit LCD_d1_Direction at TRISB1_bit;
sbit LCD_d2_Direction at TRISB2_bit;
sbit LCD_d3_Direction at TRISB3_bit;
sbit LCD_d4_Direction at TRISB4_bit;
sbit LCD_d5_Direction at TRISB5_bit;
sbit LCD_d6_Direction at TRISB6_bit;
sbit LCD_d7_Direction at TRISB7_bit;
void main()
{
TRISA = 0xFF; // PORTA Input
LCD_Init();
LCD_out(1,4,"J.U.S.T");
delay_ms(100);
LCD_out(1,3,"Biomedical");
LCD_out(2,3,"Engineering");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
delay_ms(100);
LCD_out(1,4,"Done By");
LCD_out(2,3,"M.Juhair");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
LCD_out(1,4,"& M. Fahed");
LCD_out(2,3,"& A.Jroud");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
LCD_out(1,1,"Supervised By Dr.");
LCD_out(2,1,"Areen Al-Basheer");
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
while (1) {
t = ADC_read(2); // get ADC value from 2nd channel
adcvalue=t;
}
if (adcvalue>>2) {
LCD_out(1,1,"RATE/MIN=(30)");
}
}
The Micro controller in the normal case it receives once Low and once high in ordered or not ordered intervals on its A2 input, and in each interval (in a minute for example) it shows the number of transition from low to high or vice versa. For example it shows on the screen:
RATE PER MIN = ("number of transitions")
OK…
but when input becomes low for 10 or more seconds, a clock starts on the screen and it counts for two minutes. Once input comes high to the PIN 2 the program back to it's normal mode for example "RATE PER MIN = (30)". But if the 2 minutes completed the screen shows:
WARNING !!!
Oxygenated Blood Problem
and a buzzer connected on D7 for example is activated
"My biggest concern is that I can't get the value on A2 input to compare it in an if statement with 2 volts for example
if (adcvalue>>2) {
LCD_out(1,1,"RATE/MIN=(30)");
} even though the condition is true"
Thanks in advance