Amit Radha
Apr 1 2008, 10:22 AM
I want to controll some AC devices thats why thinking of bulbs n fans n stuff.
The demo will have a make or break impression on the examiner so need to think from their point of view.
Is this ckt viable?
CAn use the uC pins to turn on/off transistors which can be used as a switch for the relays which inturn can turn on devices..
The demo will have a make or break impression on the examiner so need to think from their point of view.
Is this ckt viable?
CAn use the uC pins to turn on/off transistors which can be used as a switch for the relays which inturn can turn on devices..

Amit Radha
Apr 1 2008, 10:24 AM
I am unable to get the upload file option
wwat do i do?
wwat do i do?
Amit Radha
Apr 1 2008, 10:29 AM
Yeah i am not jumping to the relay part now. was just clearing the doubt in my mind before hand
I need the opamp for the LM35 as i have only worked on the look up table for that as of now. As for the LCD part, i was unable to get hold off a resistor pack. Connecting the 10ks with long leads would introduce noise so i thought of playing it safe.
And as for testing my code... for now even that has not been possible because i have either a brand new and faulty uC or programmer and wil take a day or two to have this resolved.
I need the opamp for the LM35 as i have only worked on the look up table for that as of now. As for the LCD part, i was unable to get hold off a resistor pack. Connecting the 10ks with long leads would introduce noise so i thought of playing it safe.
And as for testing my code... for now even that has not been possible because i have either a brand new and faulty uC or programmer and wil take a day or two to have this resolved.
pdi33
Apr 1 2008, 12:09 PM
circuit looks good. test ur lcd part first and then go for the ADC. hope ur programmer works well.all the best 

Amit Radha
Apr 1 2008, 7:49 PM
Hoping for the best... unless the programmer is set right i cant do anything on the code!
Cya for now
have a nice day
Cya for now
have a nice dayChiru
Apr 2 2008, 2:09 AM
Dear Amit, i understand your agony
in case your programmer doesn't work, use a 89S52
it has ISP mode. Circuits are available free with Atmel and over the net, take the pain to search them.
Best wishes
in case your programmer doesn't work, use a 89S52
it has ISP mode. Circuits are available free with Atmel and over the net, take the pain to search them.
Best wishes

Ajay
Apr 2 2008, 6:13 AM
keyword for search is AtmelISP
will take you to right place..
will take you to right place..Amit Radha
Apr 2 2008, 9:50 AM
Well i finally am a bit happy today
and it shows (so says my mom).
Firstly, thanks to pdi33, my supply problem is sorted out! I am using a LM324 to amplify the LM35 o/p. So, have eliminated the need for a -5V in the supply ckt. Had a Panasonic 9V adapter so i just connected it to the 7805, preeceded by the 1000uF and succeded by a 10u and 1u Caps. Faced peculiar problem though! The o/p of the adapter seems to be 12V though it shows a rating of 9V but the 7805 dint heat up
Do i need to check its current rating (how do i do it?)
Regarding the programmer, i had it replaced, tried a sample blinky hex code and it successfully programed (but i have not checked it as my supply is in the college lab
)
I am using the 89S52 only (picked it up for the watchdog timer and extra ROM) but il create a disaster if i try making my own programmer!!!
I shall now check my code and hope for the best...
I also realised that since i had put power ON LEDs on all my sensors and ADC board, that was drawing nearly 10mA each, i decided to remove them, i got hold of the lowest current rating LEDs (wat OM electronics had) and I also got some SMD LEDs (as they supposedly will draw lesser current) but i dunno how to use them!!! Could you help me with this???
Regarding the Relays. Was just playing around with them today as i had nothing to work on in the lab. The ones i bought (SPDT) turn ON (or should i say 'throw') at ~7.5v. That means il need another ~12V supply to source them? Can i use my 6-0-6 transformer for that?
and it shows (so says my mom).Firstly, thanks to pdi33, my supply problem is sorted out! I am using a LM324 to amplify the LM35 o/p. So, have eliminated the need for a -5V in the supply ckt. Had a Panasonic 9V adapter so i just connected it to the 7805, preeceded by the 1000uF and succeded by a 10u and 1u Caps. Faced peculiar problem though! The o/p of the adapter seems to be 12V though it shows a rating of 9V but the 7805 dint heat up
Do i need to check its current rating (how do i do it?) Regarding the programmer, i had it replaced, tried a sample blinky hex code and it successfully programed (but i have not checked it as my supply is in the college lab
)I am using the 89S52 only (picked it up for the watchdog timer and extra ROM) but il create a disaster if i try making my own programmer!!!
I shall now check my code and hope for the best...
I also realised that since i had put power ON LEDs on all my sensors and ADC board, that was drawing nearly 10mA each, i decided to remove them, i got hold of the lowest current rating LEDs (wat OM electronics had) and I also got some SMD LEDs (as they supposedly will draw lesser current) but i dunno how to use them!!! Could you help me with this???
Regarding the Relays. Was just playing around with them today as i had nothing to work on in the lab. The ones i bought (SPDT) turn ON (or should i say 'throw') at ~7.5v. That means il need another ~12V supply to source them? Can i use my 6-0-6 transformer for that?
Ajay
Apr 2 2008, 10:08 AM
i dont like OM Electronics
they charge so high..
anyways.. after reading your post first i thought which question to answer first
whats the problem with SMD LED?
if current requirement is high then replace the 9V adapter with 12V then check the response..
its better to use a 12V adapter and then regulate power later on board so that you have only one power source.
they charge so high..anyways.. after reading your post first i thought which question to answer first
whats the problem with SMD LED?
if current requirement is high then replace the 9V adapter with 12V then check the response..
its better to use a 12V adapter and then regulate power later on board so that you have only one power source.
Amit Radha
Apr 2 2008, 7:59 PM
Well i prefer OM cause hes kind of reliable... n infact he is quite cheap too (atleast wrt PCBs. others were charging ~double he was!)
Regarding the SMD LEDs, I dont know how to use them. Do they require a resistance to be added like ordinary LEDs? Well am hoping my lab foreman knows how to use them as he only suggested that we use them. Also they are so tiny!!! how in the world do i solder them?!!! I have not gained that level of expertise!
Regarding the supply, for now am hoping my adapter should suffice... esp sice its o/p as shown by the multmeter is 12V and not 9V as it is rated
I thought il eliminate my relay ckt cupply from the rest just to be safe, incase it draws more current... and i have 2 more transformers at my display, a 6-0-6 and 9-0-9
cya for now... hope i can test my code today...
Regarding the SMD LEDs, I dont know how to use them. Do they require a resistance to be added like ordinary LEDs? Well am hoping my lab foreman knows how to use them as he only suggested that we use them. Also they are so tiny!!! how in the world do i solder them?!!! I have not gained that level of expertise!
Regarding the supply, for now am hoping my adapter should suffice... esp sice its o/p as shown by the multmeter is 12V and not 9V as it is rated
I thought il eliminate my relay ckt cupply from the rest just to be safe, incase it draws more current... and i have 2 more transformers at my display, a 6-0-6 and 9-0-9
cya for now... hope i can test my code today...

pdi33
Apr 2 2008, 8:24 PM
forget about SMD LEDs. use the normal 3mm round ones. both consume approx. the same current and voltage.
regarding the relay supply, if u are using a seperate transformer altogether, then just generate a singe supply from it. if the txformer used is 9-0-9, then ur hardware would certainly reduce. just convert the 9-0-9 ac voltage to DC using FULL WAVE rectification which uses only two diodes and no need to regulate it as it will output about 9 x 1.414 = 12V DC voltage which is perfect for relay of 12V. If possible use sugar cube relays as they consume less current (approx. 30A per relay) and can operate from 10V to 16V.
regarding the relay supply, if u are using a seperate transformer altogether, then just generate a singe supply from it. if the txformer used is 9-0-9, then ur hardware would certainly reduce. just convert the 9-0-9 ac voltage to DC using FULL WAVE rectification which uses only two diodes and no need to regulate it as it will output about 9 x 1.414 = 12V DC voltage which is perfect for relay of 12V. If possible use sugar cube relays as they consume less current (approx. 30A per relay) and can operate from 10V to 16V.
pdi33
Apr 2 2008, 8:39 PM
reference to how a sugar cube relay looks and its pin connections:
search for this model on google:
make: goodsky model: RW-SH-112D
OR check this link :
http://www.leonerelays.com/pcbpowerrelay.htm
ur model is SC-5

search for this model on google:
make: goodsky model: RW-SH-112D
OR check this link :
http://www.leonerelays.com/pcbpowerrelay.htm
ur model is SC-5

sashijoseph
Apr 3 2008, 3:05 AM
pdi33 wrote ...
If possible use sugar cube relays as they consume less current (approx. 30A per relay) and can operate from 10V to 16V.
Oops.....
Amit Radha
Apr 3 2008, 5:45 AM
Hey pdi33,
I used those SMD LEDs, they are cute lil things and the light they emit
too good... and they consume musch lesser than the 2mm diodes!:D The only troble is to solder them... bur have somehow managed to solder them.
Well i got those sugar cube relays from leone only
but i had doubt... u said they consume a low current of 30A! but my transformer is just 1A! Wont that be a problem?
Regardng the status of my programming! Well, the led blinking code which i downloaded onto the uC at home worked but no system in the lab detected the programmer so couldnt try my codes. Il put them on the 3 uCs i have bought and then try them out in college on my board (hoping that i have made it right and it wont burn the uCs) if there any precautions to be taken before i put it on my board pls tell me. BTW how do i check that my crustal is generating a good clock? I tried the dev board i got with the programmer and it gives a 2.5V ~11.1MHz ~sinusoidal signal b/w pins 18 and gnd and nothing b/w 18 19 or b/w 19-gnd. So is that ok?
Il post my code in a while. need to make a few minor modifications to it and pls tel me if its ok.
Btw shashi i dint understand ur reply??
If possible use sugar cube relays as they consume less current (approx. 30A per relay) and can operate from 10V to 16V.
Oops.....
I used those SMD LEDs, they are cute lil things and the light they emit
too good... and they consume musch lesser than the 2mm diodes!:D The only troble is to solder them... bur have somehow managed to solder them.Well i got those sugar cube relays from leone only
but i had doubt... u said they consume a low current of 30A! but my transformer is just 1A! Wont that be a problem? Regardng the status of my programming! Well, the led blinking code which i downloaded onto the uC at home worked but no system in the lab detected the programmer so couldnt try my codes. Il put them on the 3 uCs i have bought and then try them out in college on my board (hoping that i have made it right and it wont burn the uCs) if there any precautions to be taken before i put it on my board pls tell me. BTW how do i check that my crustal is generating a good clock? I tried the dev board i got with the programmer and it gives a 2.5V ~11.1MHz ~sinusoidal signal b/w pins 18 and gnd and nothing b/w 18 19 or b/w 19-gnd. So is that ok?
Il post my code in a while. need to make a few minor modifications to it and pls tel me if its ok.
Btw shashi i dint understand ur reply??
sashijoseph wrote ...
pdi33 wrote ...
If possible use sugar cube relays as they consume less current (approx. 30A per relay) and can operate from 10V to 16V.
Oops.....
sashijoseph
Apr 3 2008, 6:13 AM
That reply was for the 30A "less" current consuming relay which pdi mentioned.Of course it was a typo and he meant 30mA.
And don't worry about the crystal.It's fine.
And don't worry about the crystal.It's fine.
Amit Radha
Apr 3 2008, 6:21 AM
Hey shashi,
Thanks
Well that crystal was on the small dev board i got with the programmer. not checked the board i have made. will do it tommorow.
Btw, How do i upload mu code now! Attachments are blocked for now and Ajay mentioned imageshack whic is only for images. I dont want to post the whole code on this pae it is huge... wat do i do..
Thanks
Well that crystal was on the small dev board i got with the programmer. not checked the board i have made. will do it tommorow.
Btw, How do i upload mu code now! Attachments are blocked for now and Ajay mentioned imageshack whic is only for images. I dont want to post the whole code on this pae it is huge... wat do i do..
Amit Radha
Apr 3 2008, 7:09 AM
You can see the code here (Link provided by Ajay.. Thanks
)
http://www.paste2.org/p/18647
)http://www.paste2.org/p/18647
pdi33
Apr 3 2008, 9:00 AM
code looks good except for one smal error. The interrupt calls sensor_display which in turn calls the routines lcd delay and delay_5s. these routines modify registers r3,r4 and r7. so u have to push pop them too .
Rest i think will work fine. check the ascii conversion table once again as i feel something is wrong there in thevalues but not sure about it.

Rest i think will work fine. check the ascii conversion table once again as i feel something is wrong there in thevalues but not sure about it.

pdi33
Apr 3 2008, 9:02 AM
and sorry for the typing error (30A instead of 30mA).
. thanks Shashi for t\rectifi\ying the mistake. I got amit real
with that 
. thanks Shashi for t\rectifi\ying the mistake. I got amit real
with that 
Amit Radha
Apr 3 2008, 10:33 AM
Hey Shashi,
Am facing a problem regarding the HIH 4000. I am getting varying voltages on different days (Dint try it with those soultions u mentioned) But i am facing a peculiar problem, for the o/p voltage, if I refer the graph in the datasheet, i get an RH very close to the RH mentioned in that days newspaper
so i am assuming it is working right.
But the formula that you mentioned:
Just measure the 3605's output voltage with an ADC and the temperature with the LM and apply the fol. formulae for calculating RH
Sensor RH = (VOUT / VSUPPLY) – 0.16 /0.0062, typical at 25°C
To correct the calculation for temperature and compute true RH, use:
True RH = sensor RH / (1.0546 –0.00216 T)
where T is in °C
Its the same as what i got in another document online, but for any o/p voltage it gives an RH of ~25% only, basically because .16/.0062 =25.8 and Vout/Vsupply will always be a decimal! (as Vout will not cross 3.9V)
So what do i do about that?
Also,regarding the current drawn by it, i checked it and it was ~0.2mA which is just fine... but to be on the safer side incase of any problem and to avoid any chances of it drawing more current (due to other devices in my setup), should i put a current limiting resistor? or probably a fuse? (Are fuses of such low rating and PCB mountable available?)
Am facing a problem regarding the HIH 4000. I am getting varying voltages on different days (Dint try it with those soultions u mentioned) But i am facing a peculiar problem, for the o/p voltage, if I refer the graph in the datasheet, i get an RH very close to the RH mentioned in that days newspaper
so i am assuming it is working right.But the formula that you mentioned:
sashijoseph wrote ...
Just measure the 3605's output voltage with an ADC and the temperature with the LM and apply the fol. formulae for calculating RH
Sensor RH = (VOUT / VSUPPLY) – 0.16 /0.0062, typical at 25°C
To correct the calculation for temperature and compute true RH, use:
True RH = sensor RH / (1.0546 –0.00216 T)
where T is in °C
Its the same as what i got in another document online, but for any o/p voltage it gives an RH of ~25% only, basically because .16/.0062 =25.8 and Vout/Vsupply will always be a decimal! (as Vout will not cross 3.9V)
So what do i do about that?
Also,regarding the current drawn by it, i checked it and it was ~0.2mA which is just fine... but to be on the safer side incase of any problem and to avoid any chances of it drawing more current (due to other devices in my setup), should i put a current limiting resistor? or probably a fuse? (Are fuses of such low rating and PCB mountable available?)
Amit Radha
Apr 3 2008, 10:46 AM
Hey pdi33,
Well i did get a bit worried when i saw 30A. But its oki
Il incorporate the changes u mentioned, infact i think il change the register bank as u suggested rather than pushing and popping all the registers.
Il try it both ways. Lesser m/c cycles also that way
Can now try on optimisation also
Regarding the ASCII conversion table, i think it is correct, i dint put my head into it much thoufg, my group mates calculated the values for the possible ranges by calculating the o/p of the ADC and in that location number we stored the corresponding temperature's ASCII value...(I have not made the table for the decimals place yet)
Used this method because the formula for the humidity sensor was complicated, but then just realised today that the formula is flawed and we need to find a way to get the RH o/p for it and think of a way of displaying it.
Hope it works.
Well i did get a bit worried when i saw 30A. But its oki
Il incorporate the changes u mentioned, infact i think il change the register bank as u suggested rather than pushing and popping all the registers.
Il try it both ways. Lesser m/c cycles also that way
Can now try on optimisation also
Regarding the ASCII conversion table, i think it is correct, i dint put my head into it much thoufg, my group mates calculated the values for the possible ranges by calculating the o/p of the ADC and in that location number we stored the corresponding temperature's ASCII value...(I have not made the table for the decimals place yet)
Used this method because the formula for the humidity sensor was complicated, but then just realised today that the formula is flawed and we need to find a way to get the RH o/p for it and think of a way of displaying it.
Hope it works.

Amit Radha
Apr 3 2008, 10:54 AM
Had made another mistake, i just noticed, the order of popping from stack was wrong
sashijoseph
Apr 3 2008, 11:15 AM
Amit Radha wrote ...
Used this method because the formula for the humidity sensor was complicated, but then just realised today that the formula is flawed and we need to find a way to get the RH o/p for it and think of a way of displaying it.
The formula is OK.Just one bracket,or rather the lack of it,played spoilsport.Here it is :
Sensor RH = ((VOUT / VSUPPLY) – 0.16)/0.0062, typical at 25°C.
Now is it ok?
The above formula boils down to RH = (Vout - 0.8)/0.031 (for 5v Vsupp)
The 0.8 is actually the zero offset value(Vout when RH is 0%).This may vary from sensor to sensor and should be supplied as calibration data along with the sensor.The 0.031 is the slope of the linear RH vs Vout line.
So use the above formula and you'll be ok.
sashijoseph
Apr 3 2008, 11:24 AM
Amit Radha wrote ...
Also,regarding the current drawn by it, i checked it and it was ~0.2mA which is just fine... but to be on the safer side incase of any problem and to avoid any chances of it drawing more current (due to other devices in my setup), should i put a current limiting resistor? or probably a fuse? (Are fuses of such low rating and PCB mountable available?)
In my opinion there's absolutely no need of the resistor and more so the fuse.Just relax buddy...

Amit Radha
Apr 3 2008, 11:43 AM
Hey thanks alot! The formula works perfectly now
Did i read it wrong!!! i better check it out now! Thanks for the info regarding the fuse and resistor also
just trying to be as safe as possible
Am having syntax errors in the look up table of my code could u pls help? I had initially put direct hex values, but even after putting the numbers in quotes as u can see, i am getting error A9: syntax error.
temp_tens: DB '0','0','0','0','0','0','0','0','0','0',
30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h,
30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h,
30, 30, 30, 30, 30, 30, 31, 31h, 31h, 31h,
31, 31, 31, 31, 31, 31, 31, 31h, 31h, 31h,
31h, 31h, 31h, 31h, 31h, 31h, 31h, 31h, 31h, 31h,
31h, 31h, 32h, 32h, 32h, 32h, 32h, 32h, 32h, 32h,
32h, 32h, 32h, 32h, 32h, 32, 32, 32, 32h, 32h,
32h, 32h, 32h, 32h, 32h, 32h, 32h, 32h, 33h, 33h,
33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h,
33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h,
33h, 33h, 33h, 33h, 34h, 34h, 34h, 34h, 34h, 34h,
34h, 34h, 34h, 34h, 34h, 34h, 34h, 34h, 34h, 34h,
34h, 34h, 34h, '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*'
temp_ones: DB
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '1', '1', '1', '1',
'2', '2', '2', '3', '3', '3', '3', '4', '5', '5',
'5', '5', '6', '6', '6', '7', '7', '8', '8', '9',
'9', '0', '0', '1', '1', '1', '2', '2', '2', '3',
'3', '4', '4', '4', '5', '5', '6', '6', '6', '7',
'7', '7', '8', '8', '9', '9', '9', '0', '0', '1',
'1', '1', '2', '2', '2', '3', '3', '4', '4', '4',
'5', '5', '5', '6', '6', '7', '7', '7', '8', '8',
'9', '9', '9', '0', '0', '1', '1', '1', '2', '2',
'2', '3', '3', '4', '4', '4', '5', '5', '6', '6',
'6', '6', '7', '7', '0', '0', '0', '0', '0', '0',
'0','0','0','0','0','0','0','0','0','0'
temp_dec: DB '0', '0' ;(MAKE THIS!!!)
I am getting syntax error in all the lines right from the label "temp_tens" till the line above "temp_ones". but no error in the line with the label "temp_dec"
Could u tell me what have i done wrong?
Did i read it wrong!!! i better check it out now! Thanks for the info regarding the fuse and resistor also
just trying to be as safe as possibleAm having syntax errors in the look up table of my code could u pls help? I had initially put direct hex values, but even after putting the numbers in quotes as u can see, i am getting error A9: syntax error.
CODE:
temp_tens: DB '0','0','0','0','0','0','0','0','0','0',
30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h,
30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h,
30, 30, 30, 30, 30, 30, 31, 31h, 31h, 31h,
31, 31, 31, 31, 31, 31, 31, 31h, 31h, 31h,
31h, 31h, 31h, 31h, 31h, 31h, 31h, 31h, 31h, 31h,
31h, 31h, 32h, 32h, 32h, 32h, 32h, 32h, 32h, 32h,
32h, 32h, 32h, 32h, 32h, 32, 32, 32, 32h, 32h,
32h, 32h, 32h, 32h, 32h, 32h, 32h, 32h, 33h, 33h,
33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h,
33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h,
33h, 33h, 33h, 33h, 34h, 34h, 34h, 34h, 34h, 34h,
34h, 34h, 34h, 34h, 34h, 34h, 34h, 34h, 34h, 34h,
34h, 34h, 34h, '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*',
'*', '*', '*', '*', '*', '*', '*', '*', '*', '*'
temp_ones: DB
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '1', '1', '1', '1',
'2', '2', '2', '3', '3', '3', '3', '4', '5', '5',
'5', '5', '6', '6', '6', '7', '7', '8', '8', '9',
'9', '0', '0', '1', '1', '1', '2', '2', '2', '3',
'3', '4', '4', '4', '5', '5', '6', '6', '6', '7',
'7', '7', '8', '8', '9', '9', '9', '0', '0', '1',
'1', '1', '2', '2', '2', '3', '3', '4', '4', '4',
'5', '5', '5', '6', '6', '7', '7', '7', '8', '8',
'9', '9', '9', '0', '0', '1', '1', '1', '2', '2',
'2', '3', '3', '4', '4', '4', '5', '5', '6', '6',
'6', '6', '7', '7', '0', '0', '0', '0', '0', '0',
'0','0','0','0','0','0','0','0','0','0'
temp_dec: DB '0', '0' ;(MAKE THIS!!!)
I am getting syntax error in all the lines right from the label "temp_tens" till the line above "temp_ones". but no error in the line with the label "temp_dec"
Could u tell me what have i done wrong?
pdi33
Apr 3 2008, 11:50 AM
not sure as i do not use the common assembly compiler but i think u should try adding the directive DB at the start of each line and try compiling it
e.g.
temp_tens: DB '0','0','0','0','0','0','0','0','0','0',
DB 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h,
DB 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h,
and so on...
e.g.
temp_tens: DB '0','0','0','0','0','0','0','0','0','0',
DB 30h, 30h, 30h, 30h, 30h, 30h, 30h, 30h,
DB 33h, 33h, 33h, 33h, 33h, 33h, 33h, 33h,
and so on...

pdi33
Apr 3 2008, 11:52 AM
And as far as the pushing and popping is concerned, u were NOT wrong buddy! that order is the exact way first in last out. 

Amit Radha
Apr 3 2008, 11:55 AM
Oops... forgot that every new line under the same label must start with the DB directive! And teh comma also is not supposed to be there... just checked my lab record! solved the error now
Thanks pdi33
And btw had loads of errors in code i posted online... corrected them now...
http://paste2.org/p/18683
Also, i needed to know how do i make a degree symbol on the LCD, mazidi doesnt give its ASCII value in the table in his book
Thanks pdi33
And btw had loads of errors in code i posted online... corrected them now...
http://paste2.org/p/18683
Also, i needed to know how do i make a degree symbol on the LCD, mazidi doesnt give its ASCII value in the table in his book
Amit Radha
Apr 3 2008, 11:58 AM
Well yeah my instructions were right but the comments i put was wrong 

Ajay
Apr 3 2008, 1:57 PM
you can find the ascii for degree in LCD datasheet.
Amit Radha
Apr 3 2008, 8:05 PM
Thanks Ajay,
Found it there, but i am cinfused. There are 2 tables:
Correspondence between Character Codes and Character Patterns (ROM Code: A00)
According to which i think its ASCII will be dfh
and another table
Correspondence between Character Codes and Character Patterns (ROM Code: A02)
According to which it will be b0h.(which is same as Microsoft word symbols, butt in mazidi bo is code for something else!)
Anyways if my setup works today, il try them out and see
thanks bye have a nice day 
Found it there, but i am cinfused. There are 2 tables:
Correspondence between Character Codes and Character Patterns (ROM Code: A00)
According to which i think its ASCII will be dfh
and another table
Correspondence between Character Codes and Character Patterns (ROM Code: A02)
According to which it will be b0h.(which is same as Microsoft word symbols, butt in mazidi bo is code for something else!)
Anyways if my setup works today, il try them out and see
thanks bye have a nice day 
Amit Radha
Apr 4 2008, 7:00 AM
Hey Ajay, Shashi, pdi33, Chiru and Shyam
Thanks to all of you!!! My code worked today (not flawlessly though!)
I could display the temperature successfully on the LCD. No changes to the code
But pdi33 u are too good, u so easily found that the look up table was wrong and yes it was! In the 10s place LUT, i had stored 32 instead of 33 in a few locations, so because of that from 30deg C to 34deg C it was displaying 20 to 24, but below 30 and above 34 the display was correct.
I am so happy! Thanks to all of you
I have not tested the interrupt part (started late in the lab so dint get the time)
Now need to get the code for all the sensors in place!
Also, Shyam I need help with the barrel shifter algo, i could see variations and sudden jumps in the o/p once in a while...
Pls help me do that in assembly!!!
Thanks to all of you!!! My code worked today (not flawlessly though!)
I could display the temperature successfully on the LCD. No changes to the code
But pdi33 u are too good, u so easily found that the look up table was wrong and yes it was! In the 10s place LUT, i had stored 32 instead of 33 in a few locations, so because of that from 30deg C to 34deg C it was displaying 20 to 24, but below 30 and above 34 the display was correct.
I am so happy! Thanks to all of you
I have not tested the interrupt part (started late in the lab so dint get the time)
Now need to get the code for all the sensors in place!
Also, Shyam I need help with the barrel shifter algo, i could see variations and sudden jumps in the o/p once in a while...
Pls help me do that in assembly!!!
Amit Radha
Apr 4 2008, 7:02 AM
Btw, Ajay, i couldnt get the code for degree symbol.
I used 0B0h from the table 2 of the datasheet. and it displayed hyphen '-'
So pls tell me how to interpret it. Probably i did it wrong!
I had referred the Hitachi 44780 datasheet...
I used 0B0h from the table 2 of the datasheet. and it displayed hyphen '-'
So pls tell me how to interpret it. Probably i did it wrong!
I had referred the Hitachi 44780 datasheet...
Ajay
Apr 4 2008, 11:41 AM
in datasheet two tables are given one for 5x7 and other for 5x10 i think.
according to font type you initialized your LCD look into that table.
according to font type you initialized your LCD look into that table.
shyam
Apr 4 2008, 8:24 PM
well gud to know that ur code works....
i am not that gud in asm... still i can guide u thru the steps...
once u have finished with the other stuffs we will try and make the adc consistent!

i am not that gud in asm... still i can guide u thru the steps...
once u have finished with the other stuffs we will try and make the adc consistent!

Amit Radha
Apr 5 2008, 6:38 AM
Oki il try it again. I have brought al my stuff home so i can work over the week end and try finishing off as much as possible.
Il look into the tables again Ajay, hope i can settle that matter.
Also, the display is not static, i mean u can see it change every time it is being displayed. hw do i prevent that from happening. Il try uploading a video somewhere and u can have a look. Could it be because i have put too much delay for the LCD instructions? Can i reduce the delays? wat would be ideal? Il try some hot and trial methods but pls do tell me what is the minimum limit. I cant figure it out from the datasheet.
Thanks Shyam, il try completing the code by monday and il even work on that algorithm, ils urely need ur expert guidance...
Bye for now
Il look into the tables again Ajay, hope i can settle that matter.
Also, the display is not static, i mean u can see it change every time it is being displayed. hw do i prevent that from happening. Il try uploading a video somewhere and u can have a look. Could it be because i have put too much delay for the LCD instructions? Can i reduce the delays? wat would be ideal? Il try some hot and trial methods but pls do tell me what is the minimum limit. I cant figure it out from the datasheet.
Thanks Shyam, il try completing the code by monday and il even work on that algorithm, ils urely need ur expert guidance...
Bye for now
Amit Radha
Apr 5 2008, 8:27 AM
Well thats not the end of my worries. Got stuck up again. My interrupt doesnt seem to be working. I have connected a button b/w INT0 and GND. During the execution of the prog. INT0 is always high.
The instant the button is pressed the screen becomes clear and initially i thought nothing is being displayed but when i looked at the LCD at an angle, it was displaying the original screen with the temperature. Resetting the system also doesnt change anything. Only turning off and on the power again sets it right.
What could be wrong?
Is my code right? Even if it is wrong , the contrast of the LCD must not get affected right?
Another thing i noticed is that when the button is pressed for a little longer then it is displaying complete squares on the first few places on the 1st line only and sometimes again some number and those blocks but that is again in low contrast and seen at an angle only!
Wats wrong.. pls help :'(
The instant the button is pressed the screen becomes clear and initially i thought nothing is being displayed but when i looked at the LCD at an angle, it was displaying the original screen with the temperature. Resetting the system also doesnt change anything. Only turning off and on the power again sets it right.
What could be wrong?
Is my code right? Even if it is wrong , the contrast of the LCD must not get affected right?
Another thing i noticed is that when the button is pressed for a little longer then it is displaying complete squares on the first few places on the 1st line only and sometimes again some number and those blocks but that is again in low contrast and seen at an angle only!
Wats wrong.. pls help :'(
sashijoseph
Apr 5 2008, 10:15 AM
The LJMP you used in the ISR is a 3-byte instruction,whereas you've reserved only 2 bytes for it.Start your main from 06H and check again.
Amit Radha
Apr 5 2008, 10:59 AM
Hi shashi,
Thanks it worked. I started from 07h
Also made another change. Instead of EQU.
now I am facing a small problem, I am unable to display on the 2nd line of the LCD. I am using that 0C0h command to set it to 2nd line but still.
I made a change to the initialisation msg also to display something on 2nd line but even that is not working so probably it is some concpet mistake. I am unable to figure it out...
Il post my new code again.
Thanks it worked. I started from 07h
Also made another change. CODE:
LCD_INTR BIT 00h
now I am facing a small problem, I am unable to display on the 2nd line of the LCD. I am using that 0C0h command to set it to 2nd line but still.
I made a change to the initialisation msg also to display something on 2nd line but even that is not working so probably it is some concpet mistake. I am unable to figure it out...
Il post my new code again.
Amit Radha
Apr 5 2008, 11:13 AM
This is my latest corrected code.
Unable to display anything on line 2 of LCD even though i am using 0C0h command function..
Unable to display anything on line 2 of LCD even though i am using 0C0h command function..
Amit Radha
Apr 5 2008, 11:14 AM
This is my latest corrected code.
http://paste2.org/p/18990
Unable to display anything on line 2 of LCD even though i am using 0C0h command function..
http://paste2.org/p/18990
Unable to display anything on line 2 of LCD even though i am using 0C0h command function..
Ajay
Apr 5 2008, 12:19 PM
use busy flag of LCD instead of using delay. second line will work 

Amit Radha
Apr 5 2008, 12:28 PM
Oh oki... well i really dint under that concept and i had read somewhere that using delay is safer and more reliable than using the busy flag
oki il try using busy flag then.
So il have to change it for everything is it?
oki il try using busy flag then. So il have to change it for everything is it?
sashijoseph
Apr 5 2008, 12:51 PM
Try putting a 2ms delay between 'Enable' high and low.Also try increasing the other delay.
Ajay
Apr 5 2008, 1:06 PM
well busy flag is safer..
just change the content of lcd_delay with busy flag
so nothing will change.. just the code in lcd_delay subroutine.
just change the content of lcd_delay with busy flag
so nothing will change.. just the code in lcd_delay subroutine.
shyam
Apr 5 2008, 7:56 PM
it is always recommended to check busy flag!!!...
sometimes for th eease of programming we ignore it...
if u want to ignore it then do as sashijoseph said..
still if u face problem keep trying by increasing the delay interval!
sometimes for th eease of programming we ignore it...
if u want to ignore it then do as sashijoseph said..
still if u face problem keep trying by increasing the delay interval!

Amit Radha
Apr 5 2008, 9:15 PM
Oh oki. God knows where did i read that using delay is better than delay flag check!!! Or else i would have used the busy flag only. K il try that out now
I think thats better rather than again making use of timer for a 2ms delay
Thanks.
Have a nice sunday
I think thats better rather than again making use of timer for a 2ms delay
Thanks.
Have a nice sunday
Amit Radha
Apr 5 2008, 9:52 PM
I made this change
lcddelay:
SETB P0.7
CLR RS
SETB RW
chk_flag:
CLR E
ACALL delay
SETB E
JB P0.7, chk_flag
RET
But it does not help. Instead the whole display of each charachter has become slow! Also, when the 2nd mode of the LCD, it displays 1st line of actuator status, then the sensor staus, again the actuator status amd then the sensor status. That should not be happening. Also aft the actuator status display, when it changes to sensor status, it displays C twice! (degree C) and then it clears screen and displays correctly.
I tried another thing.
I started the LCD initialisation msg from 84h instead of 80h and it correctly displayed from the 5th locn on the LCD.
When i changed it to 0C0h then the LCD was blank for a while, it then displayed "Sensors..." in the 1st line (it is the 2nd line of the initialisation message, i had made a change and have posted it in the updated code whose link i have posted.) and then the sensor data screen.
Wat could be wron? IS the LCD bad by any chance?$@#!
Pls tell me that is not the problem
CODE:
lcddelay:
SETB P0.7
CLR RS
SETB RW
chk_flag:
CLR E
ACALL delay
SETB E
JB P0.7, chk_flag
RET
But it does not help. Instead the whole display of each charachter has become slow! Also, when the 2nd mode of the LCD, it displays 1st line of actuator status, then the sensor staus, again the actuator status amd then the sensor status. That should not be happening. Also aft the actuator status display, when it changes to sensor status, it displays C twice! (degree C) and then it clears screen and displays correctly.
I tried another thing.
I started the LCD initialisation msg from 84h instead of 80h and it correctly displayed from the 5th locn on the LCD.
When i changed it to 0C0h then the LCD was blank for a while, it then displayed "Sensors..." in the 1st line (it is the 2nd line of the initialisation message, i had made a change and have posted it in the updated code whose link i have posted.) and then the sensor data screen.
Wat could be wron? IS the LCD bad by any chance?$@#!
Pls tell me that is not the problem

Ajay
Apr 6 2008, 8:08 AM
I think you should have done tests on your LCD first.. or you can do it now.
One more thing is there in my mind.. i think your LCD is not getting initialized properly.
I have seen your code and there is no problem with code as such. Try testing your LCD alone..
One more thing is there in my mind.. i think your LCD is not getting initialized properly.
I have seen your code and there is no problem with code as such. Try testing your LCD alone..