DOC PREVIEW
NMT EE 308 - Review for Exam 2

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

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 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 16 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 16 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 16 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 16 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EE 308 Spring 2009Review 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 20094. 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 2009Asynchronous 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 with a specical 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 timesS0xD6110101103EE 308 Spring 2009Asynchronous Data Transfer• The reciever 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 se e 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 B aud 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 timesS0xD6110101104EE 308 Spring 2009Asynchronous Serial Proctocols• 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.5EE 308 Spring 2009Parity in Ascyncronous Serial Transfers• The HCS12 can use a parity bit for e rror 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 will alwayshave an odd number of ones.– The HCS12 can tranmit either 8 bits or 9 bits on a single transfer, depending onthe state of M bit of SCI0CR1.– With 8 data bits and parity disabled, all eight bits of the byte will be sent.– With 8 data bits and parity enabled, the seven least significant bits of the byteare sent; the MSB is replaced with a parity bit.– With 9 data bits and parity disabled, all eight bits of the byte will be sent, andan additional bit can be sent in the sixth bit of SCI0DRH.∗ It usually does not make sense to use 9 bit mode without parity.– With 9 data bits and parity enabled, all eight bits of the byte are sent; the ninthbit is the parity bit, which is put into the MSB of SCI0DRH in the receiver.6EE 308 Spring 2009Asynchronous Data Transfer• The HCS12 has two asynchronous serial interfaces, called the SCI0 and SCI1 (SCIstands for Serial Communications Interface)• SCI0 is used by D-Bug12 to communicate with the host PC• When using D-Bug12 you normally cannot independe ntly operate SCI0 (or you willlose your communications link with the host PC)• The D-Bug12 printf() function sends data to the host PC over SCI0• The SCI0 TxD pin is bit 1 of Port S; the SCI1 TxD pin is bit 3 of Port S.• The SCI0 RxD pin is bit 0 of Port S; the SCI1 RxD pin is bit 2 of Port S.• In asynchronous data transfer, serial data is transmitted by shifting out of a transmitshift register into a receive shift registerTxD Shift Reg RxD Shift RegRxD Shift Reg TxD Shift RegTxDRxD TxDRxDPS1


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?