Programming examples

Latest update : 17 June.

Latest articles

PTM

Monday 17 June 2024, by 63F09 // Programming examples

``` ORG $FFFFFF00 LDMD #$31 LDS #$FFFE0000 LDU #$FFFDF000 * Direct mode: address is built with DS:DP:8 bits offset LDDS #$FFFE LDDP #$F0 * Configure PIA0 (PIA0(0) <= 1). * PIA0(0) is connected to PTM1.G(3) LDA #%00000000 STA <PIA0+1 LDA #%00000001 STA <PIA0 LDA #%00000100 STA <PIA0+1 LDA #%00000001 STA <PIA0 * 1 : source (0 : external) * 2 : mode (0 : 16 bits) (…) Read more »

SPI

Monday 17 June 2024, by 63F09 // Programming examples

``` ORG $FFFFFF00 LDMD #$31 LDS #$FFFF0000 LDU #$FFFEF000 * Direct mode: address is built with DS:DP:8 bits offset LDDS #$FFFF LDDP #$00 * SPI0 * Internal registers: * SPI0+0: data register * SPI0+1: control register
* SPI0 control register * Configure divisor (1’000’000) LDA #%00000001 STA TX_EMPTY = 1 * TST Z=0 => TX_EMPTY = 1 * TST Z=1 => TX_EMPTY = 0 BEQ WAIT RTS
WAIT2: LDW #500 BOUCLE: DECW BNE (…) Read more »

TWI

Friday 14 June 2024, by 63F09 // Programming examples

Example ``` ORG $FFFF0000 LDMD #$31 LDS #$FFFE0000 LDU #$FFFDF000 * Direct mode: address is built with DS:DP:8 bits offset * i2c controller is at $FFFEB000-$FFFEB003 LDDS #$FFFE LDDP #$B0 * TWI0 control register LDA #%00000000 ; polling mode STA <TWI0+2 * Set TWI0 clock divisor LDD #0 STD <TWI0+4 * Set slave address LDD #$50 STD <TWI0+6
* Write into $20 LDA #$20 STA (…) Read more »