AN2109 Freescale Semiconductor / Motorola, AN2109 Datasheet - Page 43

no-image

AN2109

Manufacturer Part Number
AN2109
Description
MPC555 Interrupts
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
7.3.5.1 Example 5: main.c Code
#include "mpc555.h"
typedef struct{ UINT8* base_pointer;
void init555()
{
}
void initSci()
{
}
main()
{
}
void SCI_Int (void)
{
}
#pragma interrupt Ext_Isr
#pragma section IrqSect RX address=0x500
#pragma use_section IrqSect Ext_Isr
if (QSMCM.SC1SR.B.RDRF == 1)
{
}
else
{ }
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;
Rec_Buf.base_pointer[Rec_Buf.Current_index++]= QSMCM.SC1DR.R ;
if (Rec_Buf.Current_index == Rec_Buf.Buffer_size)
Rec_Buf.Current_index = 0;
} REC_BUF_TYPE
UINT32 Buffer_size;
UINT32 Current_index;
loopctr++;
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 INITIALIZATION
// Initialize SCI for simple operation
// Set baud rate
// Transmitter enable
// Receiver enable
// Initialize buffer variables
// STEP 2: LEVEL ASSIGMENT
// define SCIIRQ at level 5
// STEP 3: ENABLE INTERRUPT
// Enable receive interrupts only
// STEP 4: SET APPROPRIATE SIMASK BITS
// Enable level 5; others disabled
// Perform a simple 555 initialzation
// Iniialize SCI module
// FINAL STEP: SET MSR[EE], MSR[RI] BITS
// Wait for SCI interrupts
// Handle the receive interrupt
// TX interrupt not implemented.
MOTOROLA
43

Related parts for AN2109