Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 04, 2016, 12:56:37 00:56


Login with username, password and session length


Pages: [1]
Print
Author Topic: Help with this asm code  (Read 1220 times)
0 Members and 1 Guest are viewing this topic.
spurs21
Cracking Team
Active Member
****
 Muted
Offline Offline

Posts: 151

Thank You
-Given: 33
-Receive: 50



« on: October 15, 2008, 05:22:29 05:22 »

Hi friends, i have a code about a digital thermometer using pic16f877. I have compiled this code in mplab ide 8.10 and the code is compiled and built with some warnings. The point is that i have built the circuit in proteus and it works perfectly. I burn the pic16f877A whith the .hex generated and my LCD just show squares  Undecided. I have written the same code using pbp and it works perfectly, i don't use assembler, thats the reason why i'm here asking for help. I put this circuit below in proteus and files .asm & .hex. Thanks in advance
Logged
sohel
Senior Member
****
Offline Offline

Posts: 437

Thank You
-Given: 140
-Receive: 124



WWW
« Reply #1 on: October 15, 2008, 04:15:52 16:15 »

compiled with proteus.

step by step and u will find error while lcd init. and also use config.  now i think its work in ur real world.
Logged

A Thousand Miles Journey Start With a Single Step<br />http://www.youtube.com/user/masud58
spurs21
Cracking Team
Active Member
****
 Muted
Offline Offline

Posts: 151

Thank You
-Given: 33
-Receive: 50



« Reply #2 on: October 15, 2008, 07:30:04 19:30 »

Hi friend, i have downloaded your code and loaded into the pic but still not work  Sad, i put a picture here, what you think about that?. And thanks for your fast answer  Wink. Thanks in advance.


By the way i'm using an 16x4 lcd, 4MHz OSC. The asm code was written for a 16x2 lcd, but this is not a problem or yes?  Undecided. In pbp this same circuit works but whit this code is asm still not work  Cry. regards...
« Last Edit: October 15, 2008, 07:48:53 19:48 by spurs21 » Logged
sohel
Senior Member
****
Offline Offline

Posts: 437

Thank You
-Given: 140
-Receive: 124



WWW
« Reply #3 on: October 15, 2008, 08:44:47 20:44 »

have u use lcd contrast? see 10k+680R goes to pin3
« Last Edit: October 15, 2008, 08:49:41 20:49 by sohel » Logged

A Thousand Miles Journey Start With a Single Step<br />http://www.youtube.com/user/masud58
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #4 on: October 16, 2008, 02:09:43 02:09 »

16x4 is different from 16x2 see here.
http://www.picbasic.org/forum/showthread.php?t=4285
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
spurs21
Cracking Team
Active Member
****
 Muted
Offline Offline

Posts: 151

Thank You
-Given: 33
-Receive: 50



« Reply #5 on: October 16, 2008, 02:19:27 02:19 »

Hi friends, Sohel i'm not using lcd contrast, but could it be the problem??, and pickit2, i have compiled some programs for 16x2 lcd and those programs works perfectly in my 16x4 lcd, so i don't think that its the problem. regards and thanks for your reply.
Logged
DTiziano
Active Member
***
Offline Offline

Posts: 102

Thank You
-Given: 35
-Receive: 159


« Reply #6 on: October 16, 2008, 08:15:47 08:15 »

That is a typical LCD uninitialized power on.
When the contrast is wrong you do not see nothing.

PS
Normally I control the LCD from Picbasic, while one time I tried in ASM.
At that time (on a 877) I saw a very strage behaviour, the mov to output ports seems not working.
Have you tried too put a oscilloscope probe on the LCD interface control/data pins ?
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #7 on: October 16, 2008, 12:51:42 12:51 »

You need an adjustable contrast, put a 10K pot between power, gnd and pin 3 (pin 3 should not be ground but often just slightly above. it can even be negative on some old LCDs) check the datasheet.
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
spurs21
Cracking Team
Active Member
****
 Muted
Offline Offline

Posts: 151

Thank You
-Given: 33
-Receive: 50



« Reply #8 on: October 16, 2008, 05:26:41 17:26 »

ok friends i'll try today with the adjustabe contrast and i'll tell u what happen. And like u say DTiziano i have written code in PBP and my lcd works great with this conexion that i have. Thanks again for your reply and have a good day, noon or night. Smiley
Logged
sam_des
Active Member
***
Offline Offline

Posts: 221

Thank You
-Given: 47
-Receive: 111


« Reply #9 on: October 17, 2008, 12:32:12 00:32 »

Hi,

If your code works in ISIS & not in actual circuit, most probably your LCD has different timings than what you set in Proteus. Your PBP translated code works, indicates the same thing.
I've gone through your asm code quickly(havn't run it), here are my suggesitions,
1) Make sure on power-up LCD has atleast 30mSec before it's initialization is started.
2) Make sure there is enough delay between two successive data/command bytes.
To be on the safer side use more delays than what datasheet specifies.

Since you can see the pixel-blocks, there is nothing wrong with contrast settings. Such errors mostly happen due incorrect initializations/timings.

Also if you are using 16x4 LCD in place of 16x2, you'll simply miss the 3rd & 4th line display, but in that case also you should see everything on 1st & 2nd line.

Hope that helps. If you still having problems I'll post a example with C which you can easily convert to ASM.

reagrds,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
TomJackson69
V.I.P
Active Member
*****
Offline Offline

Posts: 221

Thank You
-Given: 23
-Receive: 63


« Reply #10 on: October 22, 2008, 09:41:05 21:41 »

Hi,

If your code works in ISIS & not in actual circuit, most probably your LCD has different timings than what you set in Proteus. Your PBP translated code works, indicates the same thing.
I've gone through your asm code quickly(havn't run it), here are my suggesitions,
1) Make sure on power-up LCD has atleast 30mSec before it's initialization is started.
2) Make sure there is enough delay between two successive data/command bytes.
To be on the safer side use more delays than what datasheet specifies.

Since you can see the pixel-blocks, there is nothing wrong with contrast settings. Such errors mostly happen due incorrect initializations/timings.

Also if you are using 16x4 LCD in place of 16x2, you'll simply miss the 3rd & 4th line display, but in that case also you should see everything on 1st & 2nd line.

Hope that helps. If you still having problems I'll post a example with C which you can easily convert to ASM.

reagrds,
sam_des

Hi spurs21 ,

The contrast is fine when you see some thing on the LCD. The problem is the delay. When you initial the LCD, you need to delay long enough so the CMD you write to the LCD get stored.

By look at the LCD initial sub, it call the "retardo". The "retardo" loops through the loop and return. You can change the delay timming by increase one (or all three) variable. Take a look at the "retardo".

retardo               
   movlw 0x01       ; Put 01 in to W reg
   movwf CONTA0      ; move to CONTA0
ret2   
   movlw 0x64      ; Put 64 in to W reg (TRY TO CHANGE 0X64 TO 0XB0 TO SEE)
   movwf CONTA1      ; move to CONTA1   (may be too long)
ret1   
   movlw 0x64      ; Put 64 in to W reg
   movwf CONTA2      ; move to CONTA2
ret0   
   decfsz CONTA2,F      ; This loop will decrease CONTA2 to zero
   goto ret0
   decfsz CONTA1,F      ; This loop will decrease CONTA1 to zero
   goto ret1
   decfsz CONTA0,F      ; This loop will decrease CONTA0 to zero
   goto ret2

   return

; Note: Try to increase CONTA1 to larger number (<255) to increase delay time. Or you can increase
;       CONTA0. Play with those Vars to get delay long enough.

;///////////////////////////////////////////

Remember, Proteus can never subtitude for real hardware, it can be use to test your design in the early stage. However, only real hardware can solve the problem.

The "Ini_LCD" sub look Ok with the CMD. I suggest you to play with the delay until you see some characters.

Tom
« Last Edit: October 22, 2008, 10:58:02 22:58 by TomJackson69 » Logged

Con Rong Chau Tien
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC