Hello,

I try to turn the LCD off and back on - but its not working and I dont know why.
The CALL $000B -Instruction is used for the required delay.
Thank you for your help!


Code:
.nolist
#include "ti83plus.inc"
#define progstart $9D93      
.list

.binarymode TI8X
.org progstart
.db $BB, $6D

    DI
    LD A, $02
    OUT (10), A
    CALL $000B
    LD A, $03
    OUT (10), A
    CALL $000B
    EI
    RET
Why do you think it's not working? I'd expect that since you're sending the "off" command and immediately afterwards sending the "on" command it might look like nothing happens because it's "off" for such a short amount of time.
Tari wrote:
Why do you think it's not working? I'd expect that since you're sending the "off" command and immediately afterwards sending the "on" command it might look like nothing happens because it's "off" for such a short amount of time.

Ah okay Smile
What can I do so that I can see it ?
I tried to put in more of the delays (10 times) but its still not working...
Counting the number of CPU cycles (and by extension the time) it takes to execute each instruction should help you understand how quickly this happens, so here I'll add a comment to each instruction saying how long it takes to run up to that point (assuming our Z80 is running at 6 MHz).

Code:
    OUT (10), A  ; 11 cycles, 1.833 microseconds
    CALL $000B   ; unspecified number of cycles, 11.833 microseconds (10us delay for LCD)
    LD A, $03    ; 7 cycles, 13 microseconds
    OUT (10), A  ; 11 cycles, 14.833 microseconds
    CALL $000B   ; another 10us delay, 24.833 microseconds

So the entire sequence to turn off the LCD and then turn it back on executes in about 25 microseconds; you could do this around 4000 times in the time it takes you to blink your eyes; that's much faster than you can see.

Calling _LCD_BUSY_QUICK ($000B) a few times isn't a terrible way to wait, but at 10 microseconds per call even calling it 10 times only delays for 100 microseconds which is still much too fast to see. Waiting a total of 100ms might be long enough to see, but it would probably be easiest to wait for any key to be pressed before turning it back on so the program will wait as long as you want:

Code:
  ld a, $80
  out (1), a
  nop
  nop
waitkey:
  in a, (1)
  cp $ff
  jr nz, waitkey

(I would normally just loop on the result of GetCSC for this, but since you disabled interrupts the normal key input routines aren't available and we need to directly access the keypad.)
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement