Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

New Articles From Microcontroller Tips

Back
Top