Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/19/02 22:47
Read: times


 
#27536 - RE: IE0 and TF0
I have ISR in other file.

.org 0 ; powerup
ajmp start

.org 0003h ; external Interrupt 0
ajmp keyboard ISR ;keyboard interrupt service programm
;exactly same as philips application


start:

;initializtion


;here I call keypressed subroutine to check
;if there is a key pressed...

MOV RX_POSITION, #RX_BUFFER ; RX_BUFFER IS BUFFER TO SAVE KEY SCAN CODE
main:

lcall keypressed
sjmp main

keypressed:

MOV A, NBYTES ;this variable is set to 1 when key was pressed
JZ MYLOOP ;if not, jump to myloop and return to main

MOV IE, #00 ;disable all the interrupts
MOV A, KEYBUFF ;keybuff is used to save key..
MOV NBYTES, #00H ;after key was saved to buffer, clear NBYTES
MOV R1,RX_POSITION ;save the byte in rx buffer
MOV @R1,A
INC R1
MOV RX_POSITION,R1
MOV IE, #91H ;enable interrupts

MOV TH0,#11 ;50ms timers
MOV TL0,#220
MOV TMOD,#01
SETB TR0
JNB TF0,$

;this part I supposed to do is get key scan code and save,
;waiting 50 ms...
;during the waiting period there is a key pressed, jump to ISR..
;otherwise it will send out char to display
;based on my knowledge, i think INT0 has a higher priority than
;timer0, even if during timer0 counting, when key is pressed,
;it will jump to keyboard ISR, and then return to my timer,
;restarting the timer, ( I have reset the timer in ISR)
;because I have a card reader on my keyboard, it send out
;key stroke.. I want to get all the key strokes and then save
;whole bunch of key strokes in the buffer.. but my buffer always
;contains only one char (last char).. How can I do it?
;the time period between two key strokes are much shorter
;than 50ms. I think only after timer overflow, it will
;display the char, but the result is totally different...
;I think the timer here is no use at all. the program sends out
;every char after he got it. it is strange.


MOV R1, RX_POSITION ;read current RX_POSITION value
MOV R0, #RX_BUFFER ;starting address of buffer
Loop1:
MOV DPTR, #UART ;send out through uart
MOV A, @R0
MOVX @DPTR, A
INC R0
DEC R1
CJNE R1, #RX_BUFFER, Loop1 ;


MOV RX_POSITION, #RX_BUFFER ;reset rx_position

MYLOOP:

RET

Frank


List of 11 messages in thread
TopicAuthorDate
IE0 and TF0            01/01/70 00:00      
RE: IE0 and TF0            01/01/70 00:00      
RE: IE0 and TF0            01/01/70 00:00      
RE: IE0 and TF0            01/01/70 00:00      
RE: IE0 and TF0            01/01/70 00:00      
RE: Alan            01/01/70 00:00      
RE: Alan            01/01/70 00:00      
Hope this works for you.            01/01/70 00:00      
RE: Hope this works for you.            01/01/70 00:00      
RE: IE0 and TF0            01/01/70 00:00      
The problem is solved            01/01/70 00:00      

Back to Subject List