450 likes | 810 Views
DIP Switches. The upper four switches of SW1 are used to enable LEDs connected to PORTB/C, PORTA/D, PORTE and PORTF. For example, if the switch for PORTB is OFF, all PORTB LEDs will be turned off
E N D
DIP Switches • The upper four switches of SW1 are used to enable LEDs connected to • PORTB/C, PORTA/D, PORTE and PORTF. For example, if the switch for PORTB is OFF, all PORTB LEDs will be turned off • Switches 5 and 6 of SW1 are used to enable SDO(Serial Data Output) and switches 7 and 8 to enable SDi (Serial Data input). • SW2 • The first two switches of SW2 are used to enable SCK, • switches 3, 4 and 5 are used for enabling CS (Chip Select) lines. • Switches 7 and 8 are used to enable LCD Backlight and GLCD Backight respectively.
Main Features • High-Performance, Modified RISC CPU: • Modified Harvard architecture • C compiler optimized instruction set architecture with flexible addressing modes • 83 base instructions • 24-bit wide instructions, 16-bit wide data path • 48 Kbytes on-chip Flash program space (16K instruction words) • 2 Kbytes of on-chip data RAM • 1 Kbyte of nonvolatile data EEPROM • Up to 30 MIPS operation: • DC to 40 MHz external clock input • 4 MHz-10 MHz oscillator input with PLL active (4x, 8x, 1 6x) • 30 interrupt sources: • 3 external interrupt sources • 8 user-selectable priority levels for each interrupt source • 4 processor trap sources • 16 x 16-bit working register array
Harvard Architecture http://www.ee.nmt.edu/~rison/ee308_spr99/supp/990119/harvard.gif
Data Memory With two address generators Program Memory Program Counter CPU Input/Output Ports Peripherals • Power-on Reset (POR), • Power-up Timer (PWRT) and • Oscillator Start-up Timer (OST) • Brown-out Reset (BOR): • A momentary dip in the power supply to the device has been detected which may result malfunction. • The Controller Area Network (CAN) module is a serial interface, useful for communicating with other CAN modules or digital signal controller devices. • The 10-bit, high-speed Analog-to-Digital Converter (ADC) allows conversion of an analog input signal to a 10-bit digital number. • Input capture is useful for such modes as: • Frequency/Period/Pulse Measurements • Output Compare is useful in applications requiring operational modes, such as: • Generation of Variable Width Output Pulses • Power Factor Correction • The Inter-Integrated Circuit module provides complete hardware support for both Slave and Multi- Master modes of the 120 serial communication standard with a 16-bit interface.
Data Memory With two address generators Program Memory Program Counter CPU Input/Output Ports Peripherals • The Serial Peripheral Interface (SPI) module is a synchronous serial interface. It is useful for communicating with other peripheral devices, such as EEPROMs, shift registers, display drivers and A/D converters, or other microcontrollers. • Timers 5x16 bit timers • The QEI module provides the interface to incremental encoders for obtaining mechanical position data. • PWM. This module simplifies the task of generating multiple, synchronized Pulse-Width Modulated (PWM) outputs. In particular, the following power and motion control applications are supported by the PWM module: • UART. UNIVERSAL ASYNCHRONOUS RECEIVER TRANSMITTER: • Full-Duplex, 8 or 9-bit Data Communication • PSV Program Space Visibility
Traffic Light Control • IntledRed= 13; intledGreen = 11;intledYellow = 12; • void setup(){pinMode(ledRed, OUTPUT); // sets the digital pin as outputpinMode(ledYellow, OUTPUT); // sets the digital pin as outputpinMode(ledGreen, OUTPUT); // sets the digital pin as output} • void loop(){digitalWrite(ledGreen, HIGH); // sets the Green LED on delay(1000); // waits for a seconddigitalWrite(ledGreen, LOW); // sets the Green LED offdigitalWrite(ledYellow,HIGH); // sets the Yellow LED on delay(1000); // waits for a seconddigitalWrite(ledYellow, LOW); // sets the Yellow LED offdigitalWrite(ledRed, HIGH); // sets the Red LED on delay(1000); // waits for a seconddigitalWrite(ledRed, LOW); // sets the Reed LED off}
Button The pushbutton is a component that connects two points in a circuit when you press it. The example turns on an LED when you press the button. We connect three wires to the Arduino board. The first goes from one leg of the pushbutton through a pull-up resistor (here 10 KOhms) to the 5 volt supply. The second goes from the corresponding leg of the pushbutton to ground. The third connects to a digital i/o pin (here pin 2) which reads the button's state. When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to 5 volts (through the pull-up resistor) and we read a HIGH. When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to ground, so that we read a LOW. (The pin is still connected to 5 volts, but the resistor in-between them means that the pin is "closer" to ground.)