| 0+16 | 16+16 | 32+32 | 64+32 | 96+16 |!! ==> Chip 4 starts at 96 0 1 2 3 4
#! CHIP SIZE! STARTING VALUE! ! 512! 256! 128! 64! 32! 16! 80! 16! ! 0! ! ! 0! 0! 0! 0*! 0*! 0*! | X1! 16! ! 16! ! ! 0! 0 ! 0! 0*! 0*! 1*! | X2! 32! ! 32! ! ! 0! 0! 0! 0*! 1*! | X! X3! 32! ! 64! ! ! 0! 0! 0! 1*! 0*! | X! X4! 16! ! 96! ! ! 0! 0! 0! 1*! 1*! 0! | X
| 0+64 | 64+16 | 256+256 | 512+8 | 576+64 | 640+64 | 704+64 |! ==> Chip 6 starts at 704 0 1 2 3 4 5 6
#! CHIP SIZE! STARTING VALUE! ! 512! 256! 128! 64! 32! 16! 80! 64! ! 0! ! ! 0*! 0*! 0! 0*! | X! X! X1! 16! ! 64! ! ! 0*! 0* ! 0! 1*! 0! 0! | X2! 256! ! 256! ! ! 0! 1*! | X! X! X! X! X3! 8! ! 512! ! ! 1*! 0! 0*! 0*! 0! 0! 04! 64! ! 576! ! ! 1*! 0! 0*! 1*! | X! X! X5! 64! ! 640! ! ! 1*! 0! 1*! 0*! | X! X! X6! 64! ! 704! ! ! 1*! 0! 1*! 1*! | X! X! X
IF SELECTED A2 A1 A0 /Y0/Y1/Y2/Y3/Y4/Y5/Y6/Y7 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 IF NOT SELECTED x x x 1 1 1 1 1 1 1 1
CHIP SELECT INPUTS:! IF NOT 1,0,0 - NO OUTPUTS! IF 1,0,0 - SEE TABLE
*In an! OR gate:! ! ! = 1,! ! = 0! AND gate:! ! ! = 0, ! ! = 1
11xx 010x!! OPTIONS:! 1111 = F! ! OPTIONS:! 0101 = 5! ! ! 1101 = D! ! ! ! 0100 = 4! ! ! 1110 = E! ! ! 1100 = C
*Cross compiler = Creates code for ! processor, then runs it*Flash = Holds code instruction for a ! chip*Not on MC9S12:! Temperature Sensor! Electric Buzzer! D --> A converter
( WE - WRITE ENABLE )
( OE - OUTPUT ENABLE )
LSTRB# = 1R/W# = 1PORT B = 0x3F --> 0011 111[1]
! ADDR[0] = 1
1 1 1 = 16-bit read of an odd address (using table)
A0 on HIGH --> Big EndianA0 on LOW --> Little Endian
a) 8!! D = A13!! (2^13) / (2^10) = 8!b.) Chip 0 contains HIGH order bytes! HIGH b/c F = D8 and G = D15
c.) Starting Address:! A = A18!! B = A17
! 0110 0000 0000 0000 0000!! ! A17! ! A18! ! = 0x60000
d.) Ending Address: (use A13) (after A13, all 1s)
! 0110 0011 1111 1111 1111
! ! ! A13!! = 0x63FFF
e.) Little Endian
-Normal Expanded Narrow, BDM Allowed
-Normal Expanded Wide! C = 1! B = 1! A = 1
-Normal Single Chip Mode ! C = 1! B = 0! A = 0
0xF80000 -->! 1111 1 0 00 0000 0000 00000xFFFFF -->! 1111 1 1 11 1111 1111 1111
output a low -->!1111 1xxx xxxx xxxx xxxx
*Other Possibilities*! 0! 1! ! ! 0! 0
! ! ! 0!!
PIFn = In order to know which pin an interrupt has occurred on, this register must be read.RDRn = This register can be used to limit the amount of current supplied to a circuit connected to the corresponding port.DDRn = Which register needs to be configured before ever outputting a value to a certain port pin.PERn = Connect resistor from port pin to either Vcc or Vdd.PTIn = Detects overloads and shorts.PPSn = This register can determine whether the pull resistor is pull-up or pull-down.
DDRH = Output -or- Inverse InputPERH = Pull Device EnabledPIEH = Interrupt EnabledPPSH = Pull DownRDRH = Reduce Drive
DDRH = bits 0 3 5 -->!! 0010 1001 = 29! ! ! ! ! *OUTPUT so keep the same**if DDRH is input:! 0111 0111 ==> 1000 1000 = 88*
PERH = bits 6 7 -->! ! 1100 0000 = C0
PIEH = bits 1 2 4 -->! ! 0001 0110 = 16
PPSH = bits (none) -->! ! 0000 0000 = 0
RDRH = bits 0 5 -->! ! 0010 0001 = 21
! 1101 0001 --> 0xD1! ! PTH | 0xD1
! 0101 0110 --> 0x56! ! PTH & ~ 0x56
Default state of the input to Port H is 1
How many input capture channels are there on the 9s12?! --> 8
When does TOF get set?! --> When free running counter goes from FFFF to 0.
Give a C instruction to reset the interrupt flag of Pin 1 Port H! --> PIFH = | 0x02
When __ bit of CCQ is 0 --> Non-maskable is enabled
CORE CLOCK = 2 x BUS CLOCK DIVISOR = 1024 x 2^(high bit - 1) x (low bit + 1)
Counter Value = CORE CLOCK x 10^6__________________ x mS
DIVISOR x 1000
RTICTL = 0x12
! HIGH BIT --> 1! LOW BIT --> 2
*Round up to next whole number*
CORE CLOCK = 2 x BUS CLOCK DIVISOR = 1024 x 2^(high bit - 1) x (low bit + 1)
RTICTL = 0x57
! HIGH BIT --> 5! LOW BIT --> 7
COUNTER VALUE x DIVISOR x 1000_______________________________
CORE CLOCK x 10^6
mS =
COUNTER VALUE
DIVISOR__________________
CORE CLOCK x 10^6
! ! * If answer wants micro-seconds dont use 10^6 *
Seconds =
CORE FREQUENCY_______________________
(RTI FREQUENCY) x (1024)
2^(y-1) x (y+1) =
0x2D --> 0010 1101
! PIN 1
0 1 1 0 1 1 0 0
HIGHEST = 0xFFFF
* CHECK PIN NUMBERS *! PIN 0 -- 3 --> TCTL2! PIN 4 -- 7 --> TCTL1
TCTL4 = 0x1E --> 0001 1110! ! !! ! PIN 1
1 1 0 0 0 1 1 0
BUS CLOCK 2 ^ 16___________ __________
2 ^ PRE sec=
BUS CLOCK = CORE CLOCK____________
2PRE
ms = (2 ^ 16) x (2 ^ PRE)________________
BUS CLOCK
x 1000
* CHECK PIN NUMBERS *! PIN 0 -- 3 --> TCTL4! PIN 4 -- 7 --> TCTL3
PRE
BUS CLOCK = CORE CLOCK____________
2
Count =Period x (TCNT Rate)_________________
2
TCNT Rate = BUS CLOCK__________
2 ^ PRE
PRE
COUNT
OVERFLOW
COUNT =PERIOD! ! CORE CLOCK_______! ! _______________________
2! ! 2 x (2 ^ PRE) x OVERFLOWx
CORE CLOCK = BUS CLOCK x 2
PERIOD = COUNT x 2 x (2 ^ PRE) x OVERFLOW x 2__________________________________
! CORE CLOCk x (10 ^ 6)
PRE
TIMER CLOCK FREQUENCY = CORE CLOCK ! BUS CLOCK____________! __________
2 x (2 ^ PRE)! (2 ^ PRE)
=
PRE* Units Cancel *
1! ! ! ! ! BUS CLOCK_______! ! ! ! ! __________! !PERIOD! ! ! ! ! (2 ^ PRE)
= TIMER CLOCK FREQUENCY =
COUNT =
PERIOD x [ ( BUS CLOCK x 10^6 ) / (2 ^ PRE) ]_______________________________________
! ! 2
BUS CLOCK = CORE CLOCK____________
2
Solve for PRE and COUNT:
* Plug in whole numbers until answer isnt a whole number. The last whole number is the PRESCALE value and the result is the COUNT. *
CFORC = 0x40 --> ! 0 1 0 0 0 0 0 0
DELAY COUNT = BUS CLOCK x PULSE
DELAY COUNT < 256 --> ROUND UP256 < DELAY COUNT < 1024 --> ROUND DOWN?DELAY COUNT >> 1024 --> 0
OC7M = 0111 0111 --> 0x77OC7D = 0011 0011 --> 0x33
* For OC7M Clears and Sets are set to 1s ** For OC7D only Sets are set to 1s *
PTT = 0x9C --> ! ! 1 0 0 1 1 1 0 0OC7M = 0x4D -->! ! 0 1 0 0 1 1 0 1OC7D = 0x61 --> !! 0 1 1 0 0 0 0 1
! ! ! 1 1 0 1 0 0 0 1
0 0! 1! 10 1! 0! 1
PTT! 0! 1
BIT 7:! ! 0! ! 0! ! 1! ! 0
! Opposite PTT! PTT