input 9 bytes from PORTC and store them using strobed I/O.

Status
Not open for further replies.

tinkyminky

New Member
I can't figure out solution.I try but ı can't solve this.Here my code and question.Thanks for your help.Ouch, I almost forgot, I live in a third world country and we use 68hc11 for academic education (bs).

Code:
LDX     #REGBAS    %MY CODE
              CLR      DDRC,X       ; configure PORTC as input
              LDAA   #$02            ; configure PIOC register
              LDAB   #$09            ; initialize byte counter poll STAF bit to detect the rising edge in STRA signal
              STAA   PIOC,X          ;active STRA is rising edge
              LDY     #PTR             ; initialize storage pointer
LOOP          BRCLR PIOC,X $80 LOOP
              LDAA PORTCL,X     ;read PORTCL to get the input when STRA was detected
              STAA $00,Y               ;store it
              INY                              ;repeat 9 times
              DECB
              BNE LOOP
FINISH  BRA FINISH

Code:
LDX     #REGBAS  %question
              CLR      DDRC,X
              LDAA   #$02
              LDAB   #$09
              STAA   PIOC,X
              LDY     #PTR
LOOP   ...
              ...
              LDAA PORTCL,X
              STAA $00,Y
              INY
              DECB
              BNE LOOP
FINISH  BRA FINISH
 
Last edited:
From a quick look, you need to add another loop (immediately before "BNE LOOP") after reading and storing the data, to wait until the data strobe signal goes low before starting to check for it going high.

As it is, the strobe will still be high when you loop back and you could store up to nine copies of the same (first) input data, before the first strobe pulse ends.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…