DOC PREVIEW
NMT EE 308 - Input and Output Ports

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

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

Unformatted text preview:

EE 308 Spring 2010Input and Output Ports• How do you get data into a computer from the outside?If TRI is active, the switch is closedOUT will be the same as INOUT INOUT INDDDDDDD03456120x00007Read fromSignalsFromOutsideLDAA $00Puts data from outsideinto accumulator A.Data from outside lookslike a memory locationgets signals from outsideAny read from address $0000A Tri−State Buffer acts like a switchOUT INTRIIf TRI is not active, the switch is openOUT will not be driven by INSome other device can drive OUTDDHC12DataLinesSIMPLIFIED INPUT PORT1EE 308 Spring 2010• How do you get data out of computer to the outside?DDDDDDDDD03456712Write toSignalsToOutside0x0001Any write to address $01 latchesdata into flip−flops, so datagoes to external pinsWhen a port is configured as outputand you read from that port, thedata you read is the data which wasLDAA $01MOVB #$AA,$01Accumulator A will have $AA after thiswritten to that port:MOVB #$AA,$01puts $AA on the external pinsHC12DataLinesD QD QD QD QD QD QD QD QSIMPLIFIED OUTPUT PORT2EE 308 Spring 2010• Most I/O p orts on MC9S12 can be configured as either input or output7PAis an output port. Data written toD7DDRARead from Address 0x0000Write to Address 0x0000If Bit 7 of DDRA is 1, the portA read from address 0x0000 reads data on pinthrough tri−state bufferA write to address 0x0000 writes data to the flip−flopDDRA (Data Direction Register A) is located at 0x0002If Bit 7 of DDRA is 0, the portis an input port. Data written tothrough tri−state bufferflip−flop does not get to pin7flip−flop does get to pinD QSIMPLIFIED INPUT/OUTPUT PORT3EE 308 Spring 2010MC9S12DP256B Device User Guide — V02.1321Figure 1-1 MC9S12DP256B Block Diagram256K Byte Flash EEPROM12K Byte RAMEnhanced CaptureRESETEXTALXTALVDD1,2VSS1,2SCI04K Byte EEPROMBKGDR/WMODBXIRQNOACC/XCLKSSystemIntegrationModule(SIM)VDDRCPU12Periodic InterruptCOP WatchdogClock MonitorSingle-wire BackgroundBreakpointsPLLVSSPLLXFCVDDPLLMultiplexed Address/Data BusVDDAVSSAVRHVRLATD0MultiplexedWide BusMultiplexedVDDXVSSXInternal Logic 2.5VNarrow BusPPAGEVDDPLLVSSPLLPLL 2.5VIRQLSTRBECLKMODAPA4PA3PA2PA1PA0PA7PA6PA5TESTADDR12ADDR11ADDR10ADDR9ADDR8ADDR15ADDR14ADDR13DATA12DATA11DATA10DATA9DATA8DATA15DATA14DATA13PB4PB3PB2PB1PB0PB7PB6PB5ADDR4ADDR3ADDR2ADDR1ADDR0ADDR7ADDR6ADDR5DATA4DATA3DATA2DATA1DATA0DATA7DATA6DATA5DATA4DATA3DATA2DATA1DATA0DATA7DATA6DATA5PE3PE4PE5PE6PE7PE0PE1PE2AN2AN6AN0AN7AN1AN3AN4AN5PAD03PAD04PAD05PAD06PAD07PAD00PAD01PAD02IOC2IOC6IOC0IOC7IOC1IOC3IOC4IOC5PT3PT4PT5PT6PT7PT0PT1PT2VRHVRLVDDAVSSAVRHVRLATD1AN2AN6AN0AN7AN1AN3AN4AN5PAD11PAD12PAD13PAD14PAD15PAD08PAD09PAD10VDDAVSSARXDTXDMISOMOSIPS3PS4PS5PS0PS1PS2SCI1RXDTXDPP3PP4PP5PP6PP7PP0PP1PP2PIX2PIX0PIX1PIX3ECSPK3PK7PK0PK1XADDR17ECSXADDR14XADDR15XADDR16SCKSSPS6PS7SPI0IICSDASCLPJ6PJ7CAN0RXCANTXCANPM1PM0CAN1RXCANTXCANPM2PM3CAN2RXCANTXCANPM4PM5CAN3RXCANTXCANPM6PM7KWH2KWH6KWH0KWH7KWH1KWH3KWH4KWH5PH3PH4PH5PH6PH7PH0PH1PH2KWJ0KWJ1PJ0PJ1I/O Driver 5VVDDAVSSAA/D Converter 5V &DDRA DDRBPTA PTBDDREPTEAD1AD0PTKDDRKPTTDDRTPTPDDRPPTSDDRSPTMDDRMPTHDDRHPTJDDRJPK2BDLCRXBTXBClock andResetGenerationModuleVoltage RegulatorVSSRDebug ModuleVDD1,2VSS1,2VREGENVDDRVSSRVoltage Regulator 5V & I/OCAN4RXCANTXCANMISOMOSISCKSSSPI2MISOMOSISCKSSSPI1PIX4PIX5PK4PK5XADDR18XADDR19Voltage Regulator ReferenceKWP2KWP6KWP0KWP7KWP1KWP3KWP4KWP5KWJ6KWJ7Timer(J1850)Signals shown in Bold are not available on the 80 Pin PackageModule to Port RoutingPWM2PWM6PWM0PWM7PWM1PWM3PWM4PWM5PWM4EE 308 Spring 2010Ports on the MC9S12• How do you get data out of computer to the outside?• A Port on the MC9S12 is a device the MC9S12 uses to control somehardware.• Many of the MC9S12 ports are used to communicate with hardwareoutside of the MC9S12.• The MC9S12 ports are accessed by the MC9S12 by reading and writingmemory locations $0000 to $03FF.• Some of the ports we will use in this course are PORTA, PORTB, PTJ andPTP• PORTA is accessed by reading and writing address $0000.– DDRA is accessed by reading and writing address $0002.• PORTB is accessed by reading and writing address $0001.– DDRB is accessed by reading and writing address $0003.• PTJ is accessed by reading and writing address $0268.– DDRJ is accessed by reading and writing address $026A.• PTP is accessed by reading and writing address $0258.– DDRP is accessed by reading and writing address $025A.• On the DRAG ON12-Plus EVB, eight LEDs and four seven-segmentLEDs are connected to PTB.– Before you can use the eight individual LEDs or the seven-segmentLEDs, you need to enable them.– Bit 1 of PTJ must be low to enable the eight individual LEDs– Bits 3-0 of PTP are used to enable the four seven-segment LEDs∗ A low PTP0 enables the left-most (Digit 3) s even-segment LED∗ A low PTP1 enables the sec ond from the left (Digit 2) seven-segment LED5EE 308 Spring 2010∗ A low PTP2 enables the third from the left (Digit 1) seven-segmentLED∗ A low PTP3 enables the right-most (Digit 0) seven-segment LED– To use the eight individual LEDs and turn off the seven-segmentLEDs, write ones to Bits 3-0 of PTP:BSET #$0F,DDRP ; Make PTP3 through PTP0 outputsBSET #$0F,PTP ; Turn off seven-segment LEDs• On the DRAG ON12-Plus EVB, the LCD display is connected to PTK• When you power up or reset the MC9S12, PORTA, PORTB, PTJ and PTPare input ports.• You can make any or all bits of PORTA, PORTB PTP and PTJ outputs bywriting a 1 to the corresponding bits of their Data Direction Registers.– You c an use DBug-12 to manipulate the IO ports on the MC9S12.∗ To make PTB an output, use MM to change the contents of address$0003 (DDRB) to an $FF.∗ You can now use MM to change contents of address $0001 (PORTB),which changes the logic levels on the PORTB pins.∗ If the data direction register makes the port an input, you canuse MD to display the values on the external pins.6EE 308 Spring 2010Port B works the same, except DDRB is at address 0x0003and PORTB is at address 0x0001.DDA7 DDA6 DDA5 DDA4 DDA3 DDA2 DDA1 DDA00 0 0 0 0 0 0 0RESET$0002Using Port A of the 68HC12To make a bit of Port A an output port, writethe corresponding bit of DDRA.On reset, DDRA is set to $00, so Port A is aninput port.For example, to make bits 3−0 of Port A input, andbits 7−4 output, write a 0xf0 to DDRA.To send data to the output pins, write toPORTA (address 0x0000). When you read from PORTAinput pins will return the value of the signals on them(0 => 0V, 1 => 5V); output pins will return the valuewritten to them.RESETPA6 PA5 PA4


View Full Document

NMT EE 308 - Input and Output Ports

Documents in this Course
Load more
Download Input and Output Ports
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 Input and Output Ports 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 Input and Output Ports 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?