Discussion in "8051 Discussion Forum" started by    DavesGarage    Nov 14, 2009.
Thu Apr 14 2016, 08:12 PM
#21
This pseudo code give the idea.
The way interrupts are coded will be specific to your compiler.


[ Edited Thu Apr 14 2016, 08:12 PM ]
 Karan123 like this.
Fri Apr 15 2016, 01:18 AM
#22
Thanks for reply..
Mon Apr 18 2016, 11:56 AM
#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, 12:04 PM ]
Mon Apr 18 2016, 08:03 PM
#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 Mon Apr 18 2016, 08:14 PM ]
Tue Apr 19 2016, 12:06 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, 12:11 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
Tue Apr 19 2016, 09:26 PM
#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, 10:09 AM
#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
Thu Apr 21 2016, 09:05 PM
#29
Try this

Fri Apr 22 2016, 11:39 AM
#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

Conversation

ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html
ExperimenterUK
Thu Jul 11 2019, 07:44 PM
@praveen123. Can you give a link to the project ?

Downloads

Comments

ANKITPATEL
Mon Nov 18 2019, 11:00 AM
Casmir
Wed Nov 13 2019, 06:25 AM
DeepakBGattani
Mon Nov 11 2019, 01:31 PM
Jeanbusatta
Sun Nov 10 2019, 04:42 AM
mdayaz
Sat Nov 09 2019, 03:41 PM
baoyen123
Fri Nov 08 2019, 10:06 AM
xiwang
Fri Nov 08 2019, 07:28 AM
ilylily07
Tue Oct 15 2019, 04:32 PM

Online

Guests: 144, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38104
Newest member: ANKITPATEL
Forum Activity
ilylily07 Avatar
Posted By ilylily07
Mon Nov 18 2019, 09:54 AM
0v7670 camera interfacing with stc 8051.using asse...
Jeanbusatta Avatar
Posted By Jeanbusatta
Sun Nov 10 2019, 04:43 AM
ty, really needed it
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Oct 22 2019, 05:18 AM
wimac Avatar
Posted By wimac
Mon Oct 21 2019, 09:18 AM
I’ve been following this thread and looking at the...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:09 PM
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:02 PM
sir, when i on display ,sometime 3rd display is no...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 02:53 PM
sir, when i on display ,sometime 3rd display is no...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:13 PM
please find video attachment. 3rd & 4th displa...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:05 PM
sir, 3rd and 4th dot matrix display flickering, ...