芯片复制c8051f320单片机源码
芯片复制单片机源程序如下:
- //-----------------------------------------------------------------------------
- // F32x_External_Interrupts.c
- //-----------------------------------------------------------------------------
- // Copyright 2007 Silicon Laboratories, Inc.
- // Program Description:
- //
- // This software shows the necessary configuration to use External Interrupt 0
- // (/INT0) or External Interrupt 1 (/INT1) as an interrupt source. The code
- // executes the initialization routines and then spins in an infinite while()
- // loop. If the button on P1.6 (on the target board) is pressed, then the
- // edge-triggered /INT0 input on P0.0 will cause an interrupt and toggle the
- // LED.
- //
- // Pinout:
- //
- // P0.0 - /INT0
- // P0.1 - /INT1
- //
- // P2.0 - SW1 (Switch 1)
- // P2.1 - SW2 (Switch 2)
- // P2.2 - LED1
- // P2.3 - LED2
- //
- // How To Test:
- //
- // 1) Compile and download code to a 'F32x target board.
- // 2) On the target board, connect P2.0_SW and P2.1_SW signals on J3 to P0.0
- // for /INT0 and P0.1 for /INT1.
- // 3) Press the switches. Every time a switch is pressed, the P2.2 or P2.3
- // LED should toggle.
- //
- // Target: C8051F32x
- // Tool chain: Keil C51 7.50 / Keil EVAL C51
- // Command Line: None
- //
- //
- // Release 1.0
- // -Initial Revision (TP)
- // -14 JUN 2007
- //
- //-----------------------------------------------------------------------------
- // Include Files
- //-----------------------------------------------------------------------------
- #include <C8051F320.h>
- //-----------------------------------------------------------------------------
- // Global Constants
- //-----------------------------------------------------------------------------
- #define SYSCLK 12000000 // Clock speed in Hz
- sbit SW1 = P2^0; // Push-button switch on board
- sbit SW2 = P2^1; // Push-button switch on board
- sbit LED1 = P2^2; // Green LED
- sbit LED2 = P2^3; // Green LED
- //-----------------------------------------------------------------------------
- // Function Prototypes
- //-----------------------------------------------------------------------------
- void Oscillator_Init (void); // Configure the system clock
- void Port_Init (void); // Configure the Crossbar and GPIO
- void Ext_Interrupt_Init (void); // Configure External Interrupts (/INT0
- // and /INT1)

芯片解密