Understanding Serial Communication, Conversions, and Voltage

Serial Peripheral Interface (SPI)

  • [40HZ 18.75HZ 75000]
  • 8 bit × 75000 samples/sec = 600000 bits/sec
  • 24 × 10^6 / 6 × 10^5 = 40
  • SPPR = 4, SPR = 2 => (4 +1) × 2^(2+1) = 40

SPPR (3bit) = 100 SPPR (3bit) = 010

  • 100010
  • 0100 0010 ⇒ $42


Communication Circuit Programming

  • [baud rate = 19200 9bit = 8 + 1 …… ]
  • (24 × 10^6) / (16 × 19200) = 78 = $004E
  • 00,1 4E,1
  • 13, 1
  • 00011101

x+7cCZyu0IZsQAAAABJRU5ErkJggg==

Conversions

  • [1 Mega byte]

1MB =2^20 × 8bits= 8388608 bits

  • [Binary 00100101 to decimal]

1×2^5 + 1×2^2 + 1×2^0 = 37

  • [Hex $A23C to 16 Binary]

A-> 1010 2-> 0010 3->0011 C-> 1100

1010 0010 0011 1100


Serial Communication Interface (SCI) System

  • [-12V +12V 0 -12V ASCII 100 character 200 Baud]

11000010 (graph)

  • Flip: %01000011

%0100 0011 = $43 => C

  • Movb #$00, SC1CR1 (only ONE VERSION)
  • 200 baud = 200b/s => T=1/200 = 0.005s;

1char= 10 bits => 0.05s;

100 char=> 0.05×100= 5s

  • [-12V +12V 0 -12V HEX]

00110001 (graph)

  • Flip: 10001100

Invert 0111=> 7 0011=>3

= $73


  • Stack
  • [on chip] all the above
  • [11 bit 8-bit] 2^11 2048 => 2KB
  • [track of address] Program counter
  • [9S12 turned on] from a fixed memory location
  • [bytes reserved dc.b $16 ] 1 byte
  • [bytes reserved dc.b $16,$32 ] 2 bytes
  • [9S12 peripheral asynch] SCI
  • [9S12 peripheral half-dup] IIC
  • [execution movb #$FC, $1020] not affected
  • [execution adda #$00] not affected
  • [jmp label] overridden by the jump target
  • [branch label] branch offset
  • [Direct addressing mode] 1 byte to specify the address
  • [Direct addressing mode] sum of index
  • [2 8 16] 2^1 => 1024 Bytes
  • [CPU bus 20 address lines and 8 data lines] 2^20 = 2^10 x 2^10=1024 K
  • [E-clocks necessary 32-bit 4 E-clocks] 32 / 8 = 4 => 4 x 4 => 16 E-clocks
  • [98us 1MHZ] 2 E-clk+93 E-clk x Y= 98 E-clk => Y=32


  • [Decimal representation of 4k] => 4096
  • [Binary representation of 4k] => 1 0000 0000 0000
  • [Accumulator A register X by 6] => staa -6,x
  • [$2500, $2501 $2502 $50 $40 and $30 ldx #$2501 1,x+] => 40
  • [$2401, $2402 $2403 $04 $06 and $38 ldx #$2403 1,-x 1,-x] => A= $06+$04 = $0A
  • [$3000, $3001 $3002 $30 $20 and $10 ldaa 2, -SP] => $30
  • [Consider EEPROM 9S12 1K×8] $0800 => 0000 1000 0000 0000 0000 1111 1111 1111 => $0FFF
  • [Decimal 297 to BCD] 2=> 0010 9=> 1001 7=>0111 0010 1001 0111
  • [location address space $2000-$22FF] $22FF-$2000+1= 768
  • [constant of memory location $1010 $19 $47] = $19+$47$+06 => $66
  • [variable cnt $76 0 8 …. ]= 0111 0110 0011 1011 7 6 => $5
  • [m,n,k $1000, $1005, $1010 11 33 m+n-5]=> WwP9nDfxfbbJ3lPdjIdAAAAAASUVORK5CYII=


Voltage Questions

  • [Consider ADC n=10 bits 3.1V 28mV ADC (b) binary 0.22V]

(a) (3100-28)/ Δ= (2^10)/1

3072/ Δ =1024

Δ = 3mV -> minimum voltage

(b) (3100-28)/(220-28)= (2^10)/N

3072/192=1024/N

N= 1024 × 192/3072

N=64

Result of conversion= 0100 000

  • [Calculate resolution n ADC 5.17V 0.05V output 2.5mv]

n= log2 [(5.17 – 0.05)/0.0025

n = 11 bit

  • [8 bit A to D 2.56 V 0V $2A]

(2.56 × $2A)/2^8 = (2.56 × 42)/256 = 0.42

Input = 420 mV

  • [Calculate resolution ADC 2.56V 0V output 2.5mv]

2.56/2^n = 0.0025 => 2^n = 2.56/ 0.0025= 1024 => n =10

= 10 bits