H
hbaocr
Guest
Sveiki, visi draugs
PLZ, paskaidrojiet šo kodu zemāk, es nezinu, kā tas darbojas.Ja vairāk nekā divas FIQ pieprasījuma, kā to darbu un kā var CPU kodols pazīt, kas pārtrauc avots ir reaģēt.
skatīties uz manu kodu rinda krāsots sarkanā krāsā,
varētu man paziņot, vairāk nekā divas rindas līdzīgs šim
ex:
anulēts FIQ_Handler (spēkā neesošs) __fiq;anulēts ADC_handler (spēkā neesošs) __fiq;
Un ja es to varu darīt, kā var CPU atpazīt kas FIQ Interrupt regulāras atbildēt par kuru pārtrauc avots, ja tas ir atbildējusiKods:
/************************************************* *** /
/ * Piemēri programma "CP-JR ARM7 USB-LPC2148" * /
/ * Mērķa MCU: Philips ARM7-LPC2148 * /
/ *: X-TAL: 12.00 MHz * /
/ *: Run Speed 60,00 MHz (With PLL) * /
/ *: PLL Setup = M (5), P (2) * /
/ *: VPB Clock = CPU Clock = 60,00 MHz * /
/ * Keil redaktors: uVision3 V3.03a * /
/ * Compiler: Keil CARM V2.50a * /
/ * Create by: Eakachai Makarn (WWW.ETT.CO.TH) * /
/ * Last Update: 17/May/2006 * /
/ * Amats: Piemērs Izmantojiet UART1 Show FIQ (EINT1) * /
/************************************************* *** /
/ / Print Message to (9.600 UART1, N, 8,1)
/ / Lietotas GPIO0.14 Trigger Interrupt (FIQ Vector)
/ / Preses SW-slodze Trigger External Interrup-1# include "LPC214x.H" / / LPC2148 MPU Register
# include <stdio.h> / / For Lietotas Funkcijas printf/ * Pototype nodaļa * /
anulēts init_serial0 (spēkā neesošs); / / Initil UART-0
int putchar (int ch); / / Put Char uz UART-0
int getchar (spēkā neesošs); / / Get Char No UART-0
[color = red] par spēkā neesošu FIQ_Handler (spēkā neesošs) __fiq; [/ color] / / EINT1 (FIQ) Interrupt Serviceint main (anulēts)
(
init_serial0 (); / / Initilial UART0 = 9600, N, 8,1/ / Initial External Interrupt-1 (GPIO0.14)
EXTMODE | = 0x02; / / Select External Interrupt-1 = Edge Izvēlēties Trigger
EXTPOLAR | = 0x02; / / Select External Interrupt-1 = Rising Edge Trigger
PINSEL0 | = 0x20000000; / / Set GPIO0.14 = EXTINT1 Interrupt
Izmiris = 0x00000002; / / Clear External Interrupt1 karogs/ / Initial Interrupt Vector
VICIntSelect = 0x00008000; / / Select Interrupt-15 (External Interrupt1)
VICIntEnable = 0x00008000; / / Enable Interrupt-15 (External Interrupt1)printf ( "CP-JRARM7 USB-LPC2148 ... Piemērs FIQ Interrupt \ n ");// Call Printf Function
printf ( "Interrupt-1 Rising Edge glīts Ar GPIO0.14 \ n"); / / Call Printf Function
printf ( "Press Pāreja slodzi Trigger Interrupt-1 \ n \ n"); / / Call Printf Function
printf ( "Hello From ...... galvenā funkcija \ n"); / / Call Printf Function/ / Loop Here Uzgaidiet Interrupt
while (1);
)/******************************/
/ * Initial UART0 = 9600, N, 8,1 * /
/ * VPB (pclk) = 60,00 MHz * /
/******************************/
anulēts init_serial0 (spēkā neesošs)
(
PINSEL0 & = 0xFFFFFFF0; / / Reset P0.0, P0.1 Pin konfigurācija
PINSEL0 | = 0x00000001; / / Select P0.0 = TxD (UART0)
PINSEL0 | = 0x00000004; / / Select P0.1 = RxD (UART0)U0LCR & = 0xFC; / / Reset Word Select (1:0)
U0LCR | = 0x03; / / Data Bit = 8 biti
U0LCR & = 0xFB; / / Stop Bit = 1 Bit
U0LCR & = 0xF7; / / paritāte = Disable
U0LCR & = 0xBF; / / Disable Break Control
U0LCR | = 0x80; / / Enable programmēšana dalītājs Latches/ / U0DLM: U0DLL = 60,00 MHz / [16 x Baud]
/ / = 60,00 MHz / [16 x 9600]
/ / = 390,6 = 391 = 0187H
U0DLM = 0x01; / / Program dalītājs Latch (391) par 9.600 Baud
U0DLL = 0x87;U0LCR & = 0x7F; / / Disable programmēšana dalītājs LatchesU0FCR | = 0x01; / / FIF0 Enable
U0FCR | = 0x02; / / RX FIFO Reset
U0FCR | = 0x04; / / TX FIFO Reset
U0FCR & = 0x3F;
)/****************************/
/ * Write rakstzīmi UART0 * /
/****************************/
int putchar (int ch)
(
if (ch == '\ n')
(
while (! (U0LSR & 0x20)); / / wait TXD Buffer Empty
U0THR = 0x0D; / / Write CR
)
while (! (U0LSR & 0x20)); / / wait TXD Buffer Empty
return (U0THR = ch); / / Write Character
)/*****************************/
/ * Read Character No UART0 * /
/*****************************/
int getchar (spēkā neesošs)
(
while (! (U0LSR & 0x01)); / / wait RXD Receive Data Ready
return (U0RBR); / / Get Receice Data & Atgriezties
)
/********************************/
/ * External Interrupt-1 Service * /
/********************************/
anulēts FIQ_Handler (spēkā neesošs) __fiq
(
printf ( "Hello From ...... External Interrupt-1 \ n"); / / Call Printf Function
Izmiris = 0x00000002; / / Clear External Interrupt1 karogs
)
PLZ, paskaidrojiet šo kodu zemāk, es nezinu, kā tas darbojas.Ja vairāk nekā divas FIQ pieprasījuma, kā to darbu un kā var CPU kodols pazīt, kas pārtrauc avots ir reaģēt.
skatīties uz manu kodu rinda krāsots sarkanā krāsā,
varētu man paziņot, vairāk nekā divas rindas līdzīgs šim
ex:
anulēts FIQ_Handler (spēkā neesošs) __fiq;anulēts ADC_handler (spēkā neesošs) __fiq;
Un ja es to varu darīt, kā var CPU atpazīt kas FIQ Interrupt regulāras atbildēt par kuru pārtrauc avots, ja tas ir atbildējusiKods:
/************************************************* *** /
/ * Piemēri programma "CP-JR ARM7 USB-LPC2148" * /
/ * Mērķa MCU: Philips ARM7-LPC2148 * /
/ *: X-TAL: 12.00 MHz * /
/ *: Run Speed 60,00 MHz (With PLL) * /
/ *: PLL Setup = M (5), P (2) * /
/ *: VPB Clock = CPU Clock = 60,00 MHz * /
/ * Keil redaktors: uVision3 V3.03a * /
/ * Compiler: Keil CARM V2.50a * /
/ * Create by: Eakachai Makarn (WWW.ETT.CO.TH) * /
/ * Last Update: 17/May/2006 * /
/ * Amats: Piemērs Izmantojiet UART1 Show FIQ (EINT1) * /
/************************************************* *** /
/ / Print Message to (9.600 UART1, N, 8,1)
/ / Lietotas GPIO0.14 Trigger Interrupt (FIQ Vector)
/ / Preses SW-slodze Trigger External Interrup-1# include "LPC214x.H" / / LPC2148 MPU Register
# include <stdio.h> / / For Lietotas Funkcijas printf/ * Pototype nodaļa * /
anulēts init_serial0 (spēkā neesošs); / / Initil UART-0
int putchar (int ch); / / Put Char uz UART-0
int getchar (spēkā neesošs); / / Get Char No UART-0
[color = red] par spēkā neesošu FIQ_Handler (spēkā neesošs) __fiq; [/ color] / / EINT1 (FIQ) Interrupt Serviceint main (anulēts)
(
init_serial0 (); / / Initilial UART0 = 9600, N, 8,1/ / Initial External Interrupt-1 (GPIO0.14)
EXTMODE | = 0x02; / / Select External Interrupt-1 = Edge Izvēlēties Trigger
EXTPOLAR | = 0x02; / / Select External Interrupt-1 = Rising Edge Trigger
PINSEL0 | = 0x20000000; / / Set GPIO0.14 = EXTINT1 Interrupt
Izmiris = 0x00000002; / / Clear External Interrupt1 karogs/ / Initial Interrupt Vector
VICIntSelect = 0x00008000; / / Select Interrupt-15 (External Interrupt1)
VICIntEnable = 0x00008000; / / Enable Interrupt-15 (External Interrupt1)printf ( "CP-JRARM7 USB-LPC2148 ... Piemērs FIQ Interrupt \ n ");// Call Printf Function
printf ( "Interrupt-1 Rising Edge glīts Ar GPIO0.14 \ n"); / / Call Printf Function
printf ( "Press Pāreja slodzi Trigger Interrupt-1 \ n \ n"); / / Call Printf Function
printf ( "Hello From ...... galvenā funkcija \ n"); / / Call Printf Function/ / Loop Here Uzgaidiet Interrupt
while (1);
)/******************************/
/ * Initial UART0 = 9600, N, 8,1 * /
/ * VPB (pclk) = 60,00 MHz * /
/******************************/
anulēts init_serial0 (spēkā neesošs)
(
PINSEL0 & = 0xFFFFFFF0; / / Reset P0.0, P0.1 Pin konfigurācija
PINSEL0 | = 0x00000001; / / Select P0.0 = TxD (UART0)
PINSEL0 | = 0x00000004; / / Select P0.1 = RxD (UART0)U0LCR & = 0xFC; / / Reset Word Select (1:0)
U0LCR | = 0x03; / / Data Bit = 8 biti
U0LCR & = 0xFB; / / Stop Bit = 1 Bit
U0LCR & = 0xF7; / / paritāte = Disable
U0LCR & = 0xBF; / / Disable Break Control
U0LCR | = 0x80; / / Enable programmēšana dalītājs Latches/ / U0DLM: U0DLL = 60,00 MHz / [16 x Baud]
/ / = 60,00 MHz / [16 x 9600]
/ / = 390,6 = 391 = 0187H
U0DLM = 0x01; / / Program dalītājs Latch (391) par 9.600 Baud
U0DLL = 0x87;U0LCR & = 0x7F; / / Disable programmēšana dalītājs LatchesU0FCR | = 0x01; / / FIF0 Enable
U0FCR | = 0x02; / / RX FIFO Reset
U0FCR | = 0x04; / / TX FIFO Reset
U0FCR & = 0x3F;
)/****************************/
/ * Write rakstzīmi UART0 * /
/****************************/
int putchar (int ch)
(
if (ch == '\ n')
(
while (! (U0LSR & 0x20)); / / wait TXD Buffer Empty
U0THR = 0x0D; / / Write CR
)
while (! (U0LSR & 0x20)); / / wait TXD Buffer Empty
return (U0THR = ch); / / Write Character
)/*****************************/
/ * Read Character No UART0 * /
/*****************************/
int getchar (spēkā neesošs)
(
while (! (U0LSR & 0x01)); / / wait RXD Receive Data Ready
return (U0RBR); / / Get Receice Data & Atgriezties
)
/********************************/
/ * External Interrupt-1 Service * /
/********************************/
anulēts FIQ_Handler (spēkā neesošs) __fiq
(
printf ( "Hello From ...... External Interrupt-1 \ n"); / / Call Printf Function
Izmiris = 0x00000002; / / Clear External Interrupt1 karogs
)