How to capture data into variables?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to capture data into variables?

746 Views
marbomb
Contributor I

Hi All,

I am trying to replace an obsolete TSM5055 display. This display basically has a 35bit shift register in it something like the MM5451. I would like to replace this with a hcs08 variant (SE8) and 4 7segment displays. I think i can display the data to the 7segment displays once I capture the data. What I am needing help with is capturing the data that is sent to it. The TSM5055 has an enable line, data line and clock line. I have tried using the clock line to trigger  a KBInterrupt and capture the data pin. I have pieced together pieces of ASM code I have gleaned from other people but the micro keeps resetting in the debugger saying illegal something or other. I am not at my test bench right now. Has anyone done this type of thing before and could share some code. I do not know C and am a beginner in ASM.

Thank you for taking the time to read this,

Dan

Labels (1)
0 Kudos
Reply
3 Replies

566 Views
bigmac
Specialist III

Hello Dan,

Ideally, the device that you select should have a SPI peripheral - unfortunately the 'SE8 device does not.  Therefore, to make use of the 'SE8 (maybe because it has more GPIO available, and is available in a through-hole package), you will need to "bit-bang" the serial interface.  This process is not too complex, but its feasibility will depend on the clock rate generated by the source of the display data, and to some extent, the display refresh rate.  You will need a clock rate that is sufficiently slow to accommodate the bit-bang process.

When a SPI module is available, processing is required every 8 clock cycles, rather than every clock cycle.

I might suggest that you post your current, non-working code so we are not guessing at your problems.  The continual resetting may possibly be due to COP (watchdog) timeout.

Regards,

Mac


0 Kudos
Reply

566 Views
marbomb
Contributor I

Thank you for investing your time to help me.

I do not think it is a COP problem.

I think I have it turned off.

  ; Common initialization of the write once registers

        ; SOPT1: COPT=0,STOPE=0,TPM1PS=0,BKGDPE=1,RSTPE=0

        LDA     #$02

        STA     SOPT1       

Please find below the code I am attempting to make work.

;***************************************************************

;12-18-12 REPLACEMENT OF DISPLAY TSM6055

;Code to read in Display values to Clone module

;Original control used Three Five Systems Display TSM6X55 Series

;These modules had 35 bit serial shift registers in them

;Display sequence consisted of 1 High Start Bit followed by 4 bytes of data

;for 4 digits the bit 33= Upper Colon and bit 34= Lower Colon then one

;more bit to latch registers to output.

;Bit 01 = Digit 4 Segment DP

;Bit 02 = Digit 4 Segment D

;Bit 03 = Digit 4 Segment C

;Bit 04 = Digit 4 Segment G

;Bit 05 = Digit 4 Segment B

;Bit 06 = Digit 4 Segment A

;Bit 07 = Digit 4 Segment F

;Bit 08 = Digit 4 Segment E

;Bit 09 = Digit 3 Segment DP

;Bit 10 = Digit 3 Segment D

;Bit 11 = Digit 3 Segment C

;Bit 12 = Digit 3 Segment G

;Bit 13 = Digit 3 Segment B

;Bit 14 = Digit 3 Segment A

;Bit 15 = Digit 3 Segment F

;Bit 16 = Digit 3 Segment E

;Bit 17 = Digit 2 Segment DP

;Bit 18 = Digit 2 Segment D

;Bit 19 = Digit 2 Segment C

;Bit 20 = Digit 2 Segment G

;Bit 21 = Digit 2 Segment B

;Bit 22 = Digit 2 Segment A

;Bit 23 = Digit 2 Segment F

;Bit 24 = Digit 2 Segment E

;Bit 25 = Digit 1 Segment DP

;Bit 26 = Digit 1 Segment D

;Bit 27 = Digit 1 Segment C

;Bit 28 = Digit 1 Segment G

;Bit 29 = Digit 1 Segment B

;Bit 30 = Digit 1 Segment A

;Bit 31 = Digit 1 Segment F

;Bit 32 = Digit 1 Segment E

;Bit 33 = UPPER COLON

;Bit 34 = LOWER COLON

;This code based on MC14489 replacement using HC08QY1 chip

;by Eng.Gabriel Dubatti (c)2004 info@ingdubatti.com.ar                               ;

;www.ingdubatti.com.ar

;I think the clock line is used in some interupt fashion to capture

;the 32 bits coming in from micro. This is loaded into 4 bytes in this

;case and then every 5 msec the timer overflow would run VECTOR_TIM_OVF:

;which would build the display segments into bytes to send to the

;7Segment Displays and turn on one digit at a time.

;===========================================================

; VECTOR_IRQ:  This is clk line of display.

; In each IRQ reads 1 bit and shifts in "rxbuff"

; After 5 to 10 msec from the last IRQ updates the display

;===========================================================

;BELOW IS MY ATTEMPT TO CAPTURE DATA USING KEYBOARD INTERRUPT

;*************************************************************

;PIN 23 PTA3/KBIP3 CONNECT TO CLK PIN TRIGGERS

;DATA CAPTURE FROM TSM6055 MODULE MICRO

;*************************************************************

Init_PinIRQ:                         ; INIT FOR KEYBOARD INTERRUPT

                                            ; Called once in startup

  bclr    KBISC_KBIE,KBISC   ; mask interrupts

;USE ONE OR OTHER BUT NOT BOTH BELOW

;  BSET    KBIES_KBEDG3,KBIES ; SELECT RISING EDGE/HIGH LEVEL

  BCLR    KBIES_KBEDG3,KBIES ; SELECT FALLING EDGE/LOW LEVEL

;CONFIGURE PULLUP ENABLE BITS IN PTxPE

  BSET    PTAPE_PTAPE3,PTAPE  ;SET ENABLE PULLUP

;ENABLE KBI PINS BY SETTING KBIPEn BITS IN KBIPE 

  BSET    KBIPE_KBIPE3,KBIPE ; ENABLE PIN FOR KBI

  bset    KBISC_KBACK,KBISC     ; clear any false interrupts

  bclr    KeyPad,Flag     ; clear flag MAY NOT NEED

  bset    KBISC_KBIE,KBISC      ; ENABLE KBI clear the mask

  rts

Kpad_Isr:

  bset    KeyPad,Flag     ; set the flag

  bset    KBISC_KBACK,KBISC     ; clear interrupt

  BRSET   PTCD_PTCD2,PTCD,KpadEXT  ; CHK DISPLAY ENABLE IS LOW

                                                                ; EEPROM ALSO ADDRESSED IN DEVICE

  NOP     ;SOME DELAY ???? BEFORE READ DATA ON PIN

  NOP

  NOP            

; ORIGINAL CODE USED THIS LABEL - VECTOR_IRQ: 

  inc   rxnbits           ;inc the number of bits received

  bne   _ElseIfTimer17

  dec   rxnbits                 ;

_ElseIfTimer17:

 

  mov  #2,rxtimer         ;reset detected sending end

; BELOW CAPTURES DATA PIN AND LOADS 5BYTES 35or 36 BITS ETC

 

  brclr 1,PTCD,_ElseIfTimer18 ;CHANGE TO CORRECT DATA PIN

_ElseIfTimer18:

  rol   rxbuff+4

  rol   rxbuff+3           ;input shift

  rol   rxbuff+2                 

  rol   rxbuff+1                 

  rol   rxbuff+0                 

;FROM ORIGINAL CODE    bset 2,INTSCR    ;force in case of IRQ ACK

;WHAT DID ABOVE DO IN QY1 CHIP??????????? CLEAR INTERRUPT

  bset    KBISC_KBACK,KBISC     ; clear interrupt

KpadEXT

  rti

; Subroutine to display DATA CAPTURED SCI.

DisprxbuffHex

LDHX #BigBuf ;Point to & build Display buffer

LDA rxbuff+4

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+3

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+2

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+1

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+0

JSR Put1Hex  ;Convert and enter into buffer

        lda  #EOS

        sta ,X

LDHX #BigBuf ;Point to start of buffer

JSR OUTSTRG   ;Send it

RTS

                            

Here is the fault that I get in the debugger.

Illegal Address Reset

óóõ bõoåkå5 xxåÄ

0 Kudos
Reply

566 Views
marbomb
Contributor I

Thank you for investing your time to help me.

I do not think it is a COP problem.

I think I have it turned off.

  ; Common initialization of the write once registers

        ; SOPT1: COPT=0,STOPE=0,TPM1PS=0,BKGDPE=1,RSTPE=0

        LDA     #$02

        STA     SOPT1       

Please find below the code I am attempting to make work.

;***************************************************************

;12-18-12 REPLACEMENT OF DISPLAY TSM6055

;Code to read in Display values to Clone module

;Original control used Three Five Systems Display TSM6X55 Series

;These modules had 35 bit serial shift registers in them

;Display sequence consisted of 1 High Start Bit followed by 4 bytes of data

;for 4 digits the bit 33= Upper Colon and bit 34= Lower Colon then one

;more bit to latch registers to output.

;Bit 01 = Digit 4 Segment DP

;Bit 02 = Digit 4 Segment D

;Bit 03 = Digit 4 Segment C

;Bit 04 = Digit 4 Segment G

;Bit 05 = Digit 4 Segment B

;Bit 06 = Digit 4 Segment A

;Bit 07 = Digit 4 Segment F

;Bit 08 = Digit 4 Segment E

;Bit 09 = Digit 3 Segment DP

;Bit 10 = Digit 3 Segment D

;Bit 11 = Digit 3 Segment C

;Bit 12 = Digit 3 Segment G

;Bit 13 = Digit 3 Segment B

;Bit 14 = Digit 3 Segment A

;Bit 15 = Digit 3 Segment F

;Bit 16 = Digit 3 Segment E

;Bit 17 = Digit 2 Segment DP

;Bit 18 = Digit 2 Segment D

;Bit 19 = Digit 2 Segment C

;Bit 20 = Digit 2 Segment G

;Bit 21 = Digit 2 Segment B

;Bit 22 = Digit 2 Segment A

;Bit 23 = Digit 2 Segment F

;Bit 24 = Digit 2 Segment E

;Bit 25 = Digit 1 Segment DP

;Bit 26 = Digit 1 Segment D

;Bit 27 = Digit 1 Segment C

;Bit 28 = Digit 1 Segment G

;Bit 29 = Digit 1 Segment B

;Bit 30 = Digit 1 Segment A

;Bit 31 = Digit 1 Segment F

;Bit 32 = Digit 1 Segment E

;Bit 33 = UPPER COLON

;Bit 34 = LOWER COLON

;This code based on MC14489 replacement using HC08QY1 chip

;by Eng.Gabriel Dubatti (c)2004 info@ingdubatti.com.ar                               ;

;www.ingdubatti.com.ar

;I think the clock line is used in some interupt fashion to capture

;the 32 bits coming in from micro. This is loaded into 4 bytes in this

;case and then every 5 msec the timer overflow would run VECTOR_TIM_OVF:

;which would build the display segments into bytes to send to the

;7Segment Displays and turn on one digit at a time.

;===========================================================

; VECTOR_IRQ:  This is clk line of display.

; In each IRQ reads 1 bit and shifts in "rxbuff"

; After 5 to 10 msec from the last IRQ updates the display

;===========================================================

;BELOW IS MY ATTEMPT TO CAPTURE DATA USING KEYBOARD INTERRUPT

;*************************************************************

;PIN 23 PTA3/KBIP3 CONNECT TO CLK PIN TRIGGERS

;DATA CAPTURE FROM TSM6055 MODULE MICRO

;*************************************************************

Init_PinIRQ:                         ; INIT FOR KEYBOARD INTERRUPT

                                            ; Called once in startup

  bclr    KBISC_KBIE,KBISC   ; mask interrupts

;USE ONE OR OTHER BUT NOT BOTH BELOW

;  BSET    KBIES_KBEDG3,KBIES ; SELECT RISING EDGE/HIGH LEVEL

  BCLR    KBIES_KBEDG3,KBIES ; SELECT FALLING EDGE/LOW LEVEL

;CONFIGURE PULLUP ENABLE BITS IN PTxPE

  BSET    PTAPE_PTAPE3,PTAPE  ;SET ENABLE PULLUP

;ENABLE KBI PINS BY SETTING KBIPEn BITS IN KBIPE 

  BSET    KBIPE_KBIPE3,KBIPE ; ENABLE PIN FOR KBI

  bset    KBISC_KBACK,KBISC     ; clear any false interrupts

  bclr    KeyPad,Flag     ; clear flag MAY NOT NEED

  bset    KBISC_KBIE,KBISC      ; ENABLE KBI clear the mask

  rts

Kpad_Isr:

  bset    KeyPad,Flag     ; set the flag

  bset    KBISC_KBACK,KBISC     ; clear interrupt

  BRSET   PTCD_PTCD2,PTCD,KpadEXT  ; CHK DISPLAY ENABLE IS LOW

                                                                ; EEPROM ALSO ADDRESSED IN DEVICE

  NOP     ;SOME DELAY ???? BEFORE READ DATA ON PIN

  NOP

  NOP            

; ORIGINAL CODE USED THIS LABEL - VECTOR_IRQ: 

  inc   rxnbits           ;inc the number of bits received

  bne   _ElseIfTimer17

  dec   rxnbits                 ;

_ElseIfTimer17:

 

  mov  #2,rxtimer         ;reset detected sending end

; BELOW CAPTURES DATA PIN AND LOADS 5BYTES 35or 36 BITS ETC

 

  brclr 1,PTCD,_ElseIfTimer18 ;CHANGE TO CORRECT DATA PIN

_ElseIfTimer18:

  rol   rxbuff+4

  rol   rxbuff+3           ;input shift

  rol   rxbuff+2                 

  rol   rxbuff+1                 

  rol   rxbuff+0                 

;FROM ORIGINAL CODE    bset 2,INTSCR    ;force in case of IRQ ACK

;WHAT DID ABOVE DO IN QY1 CHIP??????????? CLEAR INTERRUPT

  bset    KBISC_KBACK,KBISC     ; clear interrupt

KpadEXT

  rti

; Subroutine to display DATA CAPTURED SCI.

DisprxbuffHex

LDHX #BigBuf ;Point to & build Display buffer

LDA rxbuff+4

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+3

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+2

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+1

JSR Put1Hex  ;Convert and enter into buffer

LDA #SPACE    ;Blank character

STA ,X        ;Put it in the buffer

AIX #1        ;Increment the pointer

LDA rxbuff+0

JSR Put1Hex  ;Convert and enter into buffer

        lda  #EOS

        sta ,X

LDHX #BigBuf ;Point to start of buffer

JSR OUTSTRG   ;Send it

RTS

                            

Here is the fault that I get in the debugger.

Illegal Address Reset

óóõ bõoåkå5 xxåÄ

Thank You, Dan

0 Kudos
Reply