Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 08:20:41 20:20


Login with username, password and session length


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

Posts: 152

Thank You
-Given: 35
-Receive: 50



« on: October 15, 2008, 04:22:29 04: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: 442

Thank You
-Given: 167
-Receive: 149



« Reply #1 on: October 15, 2008, 03:15:52 15: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
spurs21
Cracking Team
Active Member
****
Offline Offline

Posts: 152

Thank You
-Given: 35
-Receive: 50



« Reply #2 on: October 15, 2008, 06:30:04 18: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, 06:48:53 18:48 by spurs21 » Logged
sohel
Senior Member
****
Offline Offline

Posts: 442

Thank You
-Given: 167
-Receive: 149



« Reply #3 on: October 15, 2008, 07:44:47 19:44 »

have u use lcd contrast? see 10k+680R goes to pin3
« Last Edit: October 15, 2008, 07:49:41 19:49 by sohel » Logged
pickit2
Moderator
Hero Member
*****
Online Online

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


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

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

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
spurs21
Cracking Team
Active Member
****
Offline Offline

Posts: 152

Thank You
-Given: 35
-Receive: 50



« Reply #5 on: October 16, 2008, 01:19:27 01: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: 104

Thank You
-Given: 41
-Receive: 168


« Reply #6 on: October 16, 2008, 07:15:47 07: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
*****
Online Online

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #7 on: October 16, 2008, 11:51:42 11: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: I stoped Muteing bad members OK I now put thier account in sleep mode
spurs21
Cracking Team
Active Member
****
Offline Offline

Posts: 152

Thank You
-Given: 35
-Receive: 50



« Reply #8 on: October 16, 2008, 04:26:41 16: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
Senior Member
****
Offline Offline

Posts: 253

Thank You
-Given: 124
-Receive: 146


« Reply #9 on: October 16, 2008, 11:32:12 23: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
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #10 on: October 22, 2008, 08:41:05 20: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, 09:58:02 21: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