Discussion in "8051 Discussion Forum" started by    DavesGarage    Nov 14, 2009.
Fri Apr 15 2016, 01:42 am
#21
This pseudo code give the idea.
The way interrupts are coded will be specific to your compiler.


[ Edited Fri Apr 15 2016, 01:42 am ]
 Karan123 like this.
Fri Apr 15 2016, 06:48 am
#22
Thanks for reply..
Mon Apr 18 2016, 05:26 pm
#23
Hi,

@ Thanks again ExperimenterUK.

Your program as in pseudocontrolcode.zip greatly helps me .

I have implemented it in MPLAB XC8 for PIC18F4520 with Crystal Frequecny 11.0592 MHZ.

For Simplicity i have used switches to increase or decrease the values.

Now The Problem is that the Code Wait at
Delay(8000); // Scroll Delay [Display it for some time] Function as Below:

Please guide me any solution for this.
Means Relays should ON or OFF independently while scrolling the data on LCD or SEG7 will be done independently .


while(1)
	{
		///////////    Read Temperature //
		ReadTemperature();	
		if (temperature < 4 && heaterCount==0)		
	 	{
	  			heaterRelay=RELAY_ON;  		
	  			heaterCount=200;  			
	 	}
		if (temperature >
 4)
	 	{
	  			heaterRelay=RELAY_OFF;  		
				heaterCount=200;  				  			
	 	}
	  	 Delay(8000);	 	//	Scroll Delay  [Display it for some time]
		/*    Read Pressure */
		ReadPresure();
		if (pressure < 4 && pressureCount==0)		
	 	{
	  			pressureRelay=RELAY_ON;  		
	  			pressureCount=100;  					
	 	}
		if (pressure >
 4)
	 	{
	  			pressureRelay=RELAY_OFF;  			
				pressureCount=100;  				
	  			
	 	}
		Delay(8000);	 	  //	Scroll Delay [Display it for some time]
	}



For Complete Code please check attachment .


Any other suggestions are Welcome.

--
Karan
Attachment


[ Edited Mon Apr 18 2016, 05:34 pm ]
Tue Apr 19 2016, 01:33 am
#24


@ Thanks again ExperimenterUK.


Your program as in pseudocontrolcode.zip greatly helps me .

Karan123



Thanks


Now The Problem is that the Code Wait at
Delay(8000); // Scroll Delay [Display it for some time]

Karan123



What is the problem ?



      ///////////    Read Presure //
      ReadTemperature();
                 // If relay already on don't restart it
      if (temperature < 4 && heaterCount==0)      
                       
       {
               //   Turn on the pump ..10 second on time
              heaterRelay=RELAY_ON;         
              heaterCount=200;         
       }
      if (temperature  >
 4)
      {
              heaterRelay=RELAY_OFF;  //Turn OFF the pump
           //  heaterCount=200;  //--is this needed ? 
       }

  


I'm not sure of your logic here.
You can turn the relay on for a set time,
or turn the relay on and off at the set temperature.
To do both seems odd.


[ Edited Tue Apr 19 2016, 01:44 am ]
Tue Apr 19 2016, 05:36 pm
#25
Hello Again,

The Problem:

ReadTemperature(); -------------Shows it for Some time [Say 4 sec]
Delay(4000); // Scroll Delay [Display it for some time]
if(desired relay ON for after 10s(say))

ReadPressure(); -------------Shows it for Some time [Say 4 sec]
Delay(4000); // Scroll Delay [Display it for some time]
if(desired relay ON for after 1s(say))

if Not desired ReadTemperature() and ReadPressure() keep scroll [4 sec ]on LCD or 7 Seg.

if desired ReadTemperature() and ReadPressure() keep scroll [4 sec ]on LCD or 7 Seg with Relay ON delay.

You have deleted Delay(4000); // Scroll Delay [Display it for some time]

Tue Apr 19 2016, 05:41 pm
#26
I want to
if temperature exceed certain limit (say 7)
the Relay should ON after (10s)

if temperature reach again its limit (say 7)
the Relay should OFF after (10s)

Values from temperature and pressure keep scrolling after 4 seconds (says)

--
karan
Wed Apr 20 2016, 02:56 am
#27


I want to
if temperature exceed certain limit (say 7)
the Relay should ON after (10s)

if temperature reach again its limit (say 7)
the Relay should OFF after (10s)

Values from temperature and pressure keep scrolling after 4 seconds (says)

--
karan

Karan123


I'm afraid I don't understand what you want.


the Relay should ON after (10s)

Karan123


Did you mean
the Relay should be ON for (10s) ?

Can you describe the full project so I can get a better idea of what you
are doing ?

Wed Apr 20 2016, 03:39 pm
#28
Hi,

1)
In Simple words.
I want to make a system that will scroll temperature and pressure on LCD or 7 Segments every 4 seconds.


Did you mean ..
the Relay should be ON for (10s) ?



2)
No . Relay should ON after 10 sec . and Kept ON when condition is true . If Condition will be false (somehow) Relay should OFF after 10 sec and Kept OFF

3)
when condition is true 10 sec should Not be added to 4 sec delays.

Means Relay Should kept ON and OFF Independently and Scrolling will be done Independently.


--
Karan
Fri Apr 22 2016, 02:35 am
#29
Try this

Fri Apr 22 2016, 05:09 pm
#30
Hello,

Many of Thanks for pseudocontrolcode2.zip .

The Display Scrolling is done prefactly with your code .

But there is problem in Relay ON Relay OFF Timing.

Sometimes Relay Get ON after 10sec, Sometimes 5sec, Sometimes 8Sec

Means Not Exact Timing. Same thing for Relay OFF timing.

Meanfile . I have shifted these two lines to main.But results are same.

if(heaterOnDelayCount==0)  //when we hit 0, turn on the relay
  heaterRelay=ON;     //turn relay on
if(heaterOffDelayCount==0) 
  heaterRelay=OFF;     //turn relay off





Please Check complete code as attchment guide me how to correct the mistake .

Code made for PIC18F4520 with MPLAB XC8 complier .




--
Karan
Attachment

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am