DOC PREVIEW
NMT EE 308 - Review for Exam 2

This preview shows page 1-2-3-4-5-6 out of 17 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EE 308 Spring 2010Review for Exam 21. C Programming(a) Setting and clearing bits in registers• PORTA = PORTA | 0x02;• PORTA = PORTA & ~0x0C;(b) Using pointers to access specific memory location or port.• * (unsigned char *) 0x0400 = 0xaa;• #define PORTX (* (unsigned char *) 0x400)PORTX = 0xaa;2. Interrupts(a) Interrupt Vectors (and reset vector)• How to set interrupt vectors in C(b) How to enable interrupts (specific mask and general mask)(c) What happens to stack when you receive an enabled interrupt(d) What happens when you leave ISR with RTI instruction?(e) What setup do you need to do bef ore enabling interrupts?(f) What do you need to do in interrupt service routine (clear source of interrupt, exitwith RTI instruction)?(g) How long (approximately) does it take to service an interrupt?3. Timer/Counter Subsystem(a) Enable Timer(b) Timer Prescaler• How to set• How it affects frequency of timer clock(c) Timer Overflow Interrupt(d) Input Capture(e) Output Compare(f) How to enable interrupts in the timer subsystem(g) How to clear flags in the timer subsystem(h) Be able to look at registers and determine timer is set up• Which channels are being used• Which are being used for Input Capture, which for Output Compare• How to time differences from Timer count registers1EE 308 Spring 20104. Real Time Interrupt(a) How to enable(b) How to change rate(c) How to enable interrupt(d) How to clear flag5. Pulse Width Modulation(a) How to get into 8-bit, left-aligned high-polarity mode(b) How to set PWM period (frequency)• Using Clock Mode 0• Using Clock Mode 1(c) How to set PWM duty cycle(d) How to enable PWM channel(e) Be able to look at PWM registers and determine PWM frequency and duty cycle2EE 308 Spring 2010Dallas Semiconductor DS1307 Real Time Clock• The DS 1307 is a real-time clo ck with 56 bytes of NV (non-volatile) RAM• It uses the IIC bus, with address 11010002• It stores date and time– Data are stored in BCD format• It uses a 32.768 kHz crystal to keep time• It can generate a square wave output– Frequency of square wave can be 1 Hz, 4.096 kHz, 8.192 kHz or 32.768 kHz• It uses a battery to hold the date and time when your board is not poweredUsing the Dallas Semiconductor DS1307 Real Time Clock• Set up the IIC bus– Find the SCL frequency, SDA hold time, Start and Stop hold times– Determine the value to write to IBFD to meet those times• To set the time,– Send the Start condition– Write address of clock (with R/W low)– Write a 0 (to select seconds register),– Write second, minute, hour, day of week, day of month, month, year, control∗ Control determines whether or not to enable square wave, and selects frequency– Send the Stop condition• To read the clock,– Send the Start condition– Write the address of the clock (with R/W low), then write a 0 (to select secondsregister).– Send the Stop condition– Send the Start condition– Write the address of the clock (with R/W high)– Read the time registers.– Send the Stop condition• If you want to store some data which will remain between power cycles, you can writeit to the 56 bytes of NV RAM3EE 308 Spring 2010Asynchronous Data Transfer• In asynchronous data transfer, there is no clock line between the two devices• Both devices use internal clocks with the same frequency• Both devices agree on how many data bits are in one data transfer (usually 8, sometimes9)• A device sends data over an TxD line, and receives data over an RxD line– The transmitting device transmits a special bit (the start bit) to indicate the startof a transfer– The transmitting device sends the requisite number of data bits– The transmitting device ends the data transfer w ith a special bit (the stop bit)• The start bit and the stop bit are used to synchronize the data transferVTIdleStartLB0110101 1IdleStopAsynchronous Serial CommunicationsRxD TxDRxDTxDOne byte requires 10 bit timesS0xD6110101104EE 308 Spring 2010Asynchronous Data Transfer• The receiver knows when new data is coming by looking for the start bit (digital 0 onthe RxD line).• After receiving the start bit, the receiver looks for 8 data bits, followed by a stop bit(digital high on the RxD line).• If the receiver does not see a stop bit at the correct time, it sets the Framing Error bitin the status register.• Transmitter and receiver use the same internal clock rate, called the Baud Rate.• At 9600 baud (the speed used by D-Bug12), it takes 1/9600 second for one bit, 10/9600second, or 1.04 ms, for one byte.VTIdleStartLB0110101 1IdleStopAsynchronous Serial CommunicationsRxD TxDRxDTxDOne byte requires 10 bit timesS0xD6110101105EE 308 Spring 2010Asynchronous Serial Protocols• The SCI interface on the MC9S12 uses voltage levels of 0 V and +5 V. The RS-232standard uses voltage levels of +12 V and -12 V.– The Dragon12-Plus board uses a Maxim MAX232A chip to shift the TTL levelsfrom the MC9S12 to the RS-232 levels necessary for connecting to a standard serialport. 0 V from the SCI is converted to +12 V on the DB-9 connector and +5 Vfrom the SCI is converted to -12 V on the DB-9 connector.– The RS-232 standard can work on cables up to a length of 50 feet.• Another asynchronous standard is RS-485. Dragon12-Plus board can use SCI1 in RS-485 mode– RS-485 is a two-wire differential asynchronous protocol– Multiple devices can connect to the same two wires– Only one device on the RS-485 bus can transmit; all the other devices are in receivemode– The Dragon12-Plus DS75176 differential-to-single ended converter to convert thesingle-ended SCI1 data to differential RS-485 data– Bit 0 of Port J determines if the RS-485 should be in receive mode or transmitmode– RS-485 can work with cables up to a length of 1,000 feet.6EE 308 Spring 2010Parity in Asynchronous Serial Transfers• The HCS12 can use a parity bit f or error detection.– When enabled in SCI0CR1, the parity function uses the most significant bit forparity.– There are two types of parity – even parity and odd parity∗ With even parity, and even number of ones in the data clears the parity bit;an odd number of ones sets the parity bit. The data transmitted will alwayshave an even number of ones.∗ With odd parity, and odd number of ones in the data clears the parity bit;an even number of ones sets the parity bit. The data transmitted w ill alwayshave an odd number of ones.– The HCS12 can transmit either 8 bits or 9 bits on a single transfer,


View Full Document

NMT EE 308 - Review for Exam 2

Documents in this Course
Load more
Download Review for Exam 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Review for Exam 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Review for Exam 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?