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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/01/06 05:27
Read: times


 
#108856 - Are you using Serail Interrupt
Responding to: ???'s previous message
Dear Abdul,


your initialization code does not show any thing to initialize the interrupt mechanism


1.

HERE:
    JNB RI,HERE  ;poll the Rx flag untill we receive something
    MOV A,SBUF
    acall check  ;interpret the recvd character and take action
    reti         ;interrupt return!!!!!



2.

    ACALL check ;call the interpretation routine routine


but there is no 'RET' instruction to return back , insead you used a SJMP instruction to return this will fill your stack up every time you call check
check:
one:
     cjne A,#'A',two
     cpl P1.0
     CLR RI
     SJMP HERE       ;should be a REt here
two:
     cjne A,#'B',three
     cpl P1.1
     CLR RI
     SJMP HERE
three:
     cjne A,#'C',four
     cpl P1.2
     CLR RI
     SJMP HERE
four:
     cjne A,#'D',one  ; one!!!! why 
     cpl P1.3
     CLR RI
     SJMP HERE 

if it does not matched with all your for cases , how can it match again just by looping as A does not changes inside the loop.
change your code to
HERE: JNB RI,HERE
      MOV A,SBUF
      acall check
      SJMP HERE

check:
      cjne A,#'A',two
      cpl P1.0
      ret
two:
      cjne A,#'B',three
      cpl P1.1
      ret
three:
      cjne A,#'C',four
      cpl P1.2
      ret
four:
      cjne A,#'D',main
      cpl P1.3
main:
      ret




Abhishek

List of 2 messages in thread
TopicAuthorDate
default case to continue serial communic            01/01/70 00:00      
   Are you using Serail Interrupt            01/01/70 00:00      

Back to Subject List