Discussion in "Project Help" started by    Techsavy91    Mar 19, 2016.
Sat Mar 19 2016, 02:35 am
#1
Hello all,
I am posting this question about a project of mine which I have been struggling with as I can not resolve a piece of code in it. I am building a 8051 based capacitance meter with ie555 timer which I supposed to work but I can't figure out why my source code doesn't seem to work as it compiles fine in my proteus simulation but doesn't display anything on my LCD while sometimes during compiling the push_button_interrupt is ignored by the compiler and gives out an error. Thereby I have posted the code below, please let me know If there is any adjustment I should make to make it work or if I am doing something wrong. I am also posting the schematic of my project for better understanding.

Thanks



[ Edited Mon Mar 28 2016, 12:59 am ]
Sun Mar 20 2016, 03:03 am
#2
Can you post your Proteus project, and your code as a zip file.

"void writecmd(char c)" might cause bit 7 to be lost
use "void writecmd(unsigned char c)".
 Techsavy91 like this.
Sun Mar 20 2016, 07:59 am
#3


Can you post your Proteus project, and your code as a zip file.

"void writecmd(char c)" might cause bit 7 to be lost
use "void writecmd(unsigned char c)".

ExperimenterUK



I have tried what you have suggested but still can't seem to display anything at all on the LCD, I know there's something in my LCD code that isn't working right.
I have attached my Proteus project and code as a zip file, Please advise me lines of code that I can edit to make this work

Thanks
Attachment
Mon Mar 21 2016, 06:15 am
#4
Add pull up resistors to the Port 0 pins.
The standard Proteus RESPACK-8 works fine.
Tue Mar 22 2016, 04:10 am
#5


Add pull up resistors to the Port 0 pins.
The standard Proteus RESPACK-8 works fine.

ExperimenterUK



My lcd just worked thanks to you.

I have one more query that I need advise on, if you could see that I want to have a push button interrupt but for some reason my compiler ignore the push button interrupt function and keeps running.
Could you please advise me if I have created the interrupt function properly.

void pusb_button_interrupt() interrupt 2
{

writecmd(0x01);

writestr("calculating.......");

key_press_delay();

pulse_op = low;

pulse_op = high;

}

if you would refer the whole code in my project zip file perhaps you will get a better picture.
Wed Mar 23 2016, 08:31 am
#6
The button is on interrupt 0.
so..
void pusb_button_interrupt() interrupt 0

Interrupt routines should be short and simple.

Although it works here, I would not put a print call
or a delay in an Interrupt handler.
Edit Tags

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

AntoniaRoons
Fri Apr 19 2024, 09:59 pm
carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am