AN2109 Freescale Semiconductor / Motorola, AN2109 Datasheet - Page 32

no-image

AN2109

Manufacturer Part Number
AN2109
Description
MPC555 Interrupts
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
7.3.2.1 Example 2: Initialization and Main Routines
#include "mpc555.h"
typedef struct{ UINT8* base_pointer;
void init555()
{
}
void initSci()
{
}
main()
{
}
UINT8 actual_buffer[100];
REC_BUF_TYPE Rec_Buf;
UINT32 loopctr = 0 ;
USIU.SYPCR.R = 0xffffff03;
USIU.PLPRCR.B.MF = 0x009;
while(USIU.PLPRCR.B.SPLS == 0);
UIMB.UMCR.B.HSPEED = 0;
init555();
initSci();
asm(" mtspr EIE, r3");
while(1)
{
}
QSMCM.SCC1R0.B.SC1BR = 40000000/32/9600;
QSMCM.SCC1R1.B.TE = 1;
QSMCM.SCC1R1.B.RE = 1;
Rec_Buf.Current_index =0;
Rec_Buf.Buffer_size = 100;
Rec_Buf.base_pointer = (UINT8 *)&actual_buffer ;
QSMCM.QDSCI_IL.B.ILDSCI = 5;
QSMCM.SCC1R1.B.RIE = 1;
USIU.SIMASK.R = 0x00100000; // Enable level 5; others disabled
} REC_BUF_TYPE
loopctr++;
UINT32 Buffer_size;
UINT32 Current_index;
Freescale Semiconductor, Inc.
For More Information On This Product,
Rev. 0, 26 July 2001
MPC555 Interrupts
;
Go to: www.freescale.com
// Loop counter for main loop
// Simple MPC555 Initialization
// Disable watchdog timer
// Run at 40MHz for 4MHz crystal
// Wait for PLL to lock
// Run IMB at full clock speed
// STEP 1: MODULE SPECIFIC INITIALIZAITON
// Initialize the SCI for simple operation
// Set baud rate
// Transmitter enable
// Receiver enable
// Initialize buffer variables
// STEP 2: LEVEL ASSIGNMENT
// define SCIIRQ at level 5
// STEP 3: ENABLE INTERRUPT
// Enable receive interrupts only
// STEP 4: SET APPROPRIATE SIMASK BITS
// Perform a simple 555 initialzation
// Iniialize SCI module
// FINAL STEP: SET MSR[EE], MSR[RI] BITS
// Wait for SCI interrupts
MOTOROLA
32

Related parts for AN2109