Home
Lab Exercise
Contents
1. Print_header Print Header while 1 Read temp temp data SysCtlDelay 6000000 for i 0 i lt 10 i UARTCharPut UARTO BASE temp data i void Print_header Print Header at start of program int i 0 general counter for i 0 i lt 29 i Print Header at start of program UARTCharPut UARTO BASE start screen i void Read temp unsigned char data Read Temperature sensor unsigned char temp 2 storage for data I2CMasterControl I2CO BASE I2C MASTER CMD BURST RECEIVE START SysCtlDelay 20000 Delay temp 0 I2CMasterDataGet I2CO BASE char SysCtlDelay 20000 Delay I2CMasterControl I2CO BASE I2C MASTER CMD BURST RECEIVE CONT SysCtlDelay 20000 Delay temp 1 I2CMasterDataGet I2CO BASE char I2CMasterControl I2CO BASE I2C MASTER CMD BURST RECEIVE FINISH data 0 temp 0 10 0x30 convert 10 place to ASCII data 1 temp 0 temp 0 10 10 0x30 ASCII if temp 1 0x80 Test for 5 accuracy data 3 0x35 else data 3 0x30 13 Read Data from Temp Sensor Delay Loop to print out data string Start condition Read first Push second Char Read second Stop Condition Convert 1 s place to lab activity Attachment 3 Block Diagram of the Pins Used in Projects 2t 2 2 402 24 21 7 Pin Number 7 6 5 3 2 1 O CORE Hex Binany 0 000 00 OQ 0
2. TI ARM Lab 7 National Temperature Sensor Science Foundation Funded in part by a grant from the National Science Foundation DUE 1068182 Acknowledgements Developed by Craig Kief Brian Zufelt and Jacy Bitsoie at the Configurable Space Microsystems Innovations amp Applications Center COSMIAC Co Developers are Bassam Matar from Chandler Gilbert and Karl Henry from Drake State Funded by the National Science Foundation NSF Lab Summary This lab introduces the concepts of the sampling and data passing on the ARM processor Lab Goal The goal of this lab is to continue to build upon the skills learned from previous labs This lab helps the student to continue to gain new skills and insight on the C code syntax and how it is used in the TT implementation of the ARM processor Each of these labs will add upon the previous labs and it is the intention of the authors that students will build with each lab a better understanding of the ARM processor and basic C code syntax and the new pieces of hardware that make up this system Even though these labs or tutorials assume the student has not entered with a knowledge of C code it is the desire that by the time the student completes the entire series of tutorials that they will have a sufficient knowledge of C code so as to be able to accomplish useful projects on the ARM processor Learning Objectives The student should begin to become familiar with the concept of the temperature sensor and
3. AK A AK AE A A OK AK AK AR RK AK A AK AK AK KK OK SysCtlClockSet SYSCTL SYSDIV 1 SYSCTL USE OSC SYSCTL OSC MAIN SYSCTL XTAL 16MHZ setup clock SysCtlPeripheralEnable SYSCTL PERIPH 12C0 Enable I2C hardware SysCtlPeripheralEnable SYSCTL PERIPH GPIOB Enable Pin hardware GPIOPinConfigure GPIO PB3 I2COSDA Configure GPIO pin for I2C Data line GPIOPinConfigure GPIO PB2 I2COSCL Configure GPIO Pin for I2C clock line GPIOPinTypel2C GPIO PORTB BASE GPIO PIN 2 GPIO PIN 3 Set Pin Type GPlOPadConfigSet GPIO PORTB BASE GPIO PIN 2 GPIO STRENGTH 2MA GPIO PIN TYPE STD SDA MUST BE STD GPlOPadConfigSet GPIO PORTB BASE GPIO PIN 3 GPIO STRENGTH 2MA GPIO PIN TYPE OD SCL MUST BE OPEN DRAIN I2CMasterlnitExpCIk I2CO BASE SysCtlClockGet false The False sets the controller to 100kHz communication I2CMasterSlaveAddrSet I2CO BASE TEMP ADDR true false means transmit FF a EOEOROR TESKORSEOEORGKOROROROKORSESKORSKORGKSKORGEHRSEOR E SEORSECTEORGKOROEOROKGROEOKOKSKOR AKOKORGEHROKOK GESEOROROR HSSIKONGEOROKOROEOKORIKORSROKOROEORSKOR AE AKORSECTORGKORKOKORGEOROROKORIROR AROKOR AROR SEO HENEORSECTOKOKORGEOROEORORHKORIKORARBKORSRAR Joe KKK OK Setup the UART see lab 6 DEAK AKA AE EK RAK AK AK A AK AK A A A A AK AE A OK AK A AK A AE A AK OK AK A A A A AE OK AK AK A A AK AE A AK A AK A A AE A A A A A AE AK AK A AK KE A KK AK A OK AE A A OK AK A A A OK A A A AK AK A AK AK A A A AK A AE KK AK A AK AK AE A OK AK A
4. PAT Port A Pin 7 Taenergize send 0x80 PA ORX IN CIRCUIT O DEBUGGER GPIO A AERE ICD Ab ORBIT SW 2 LLL ORBITSW1 Ke GPIO B PB ORBIT LED 4 vec DX 3DA PBS L ss PB TEMP ACCEL SENSOR Device ID Device ID Ox1D GPIO C ORBIT LED 1 OxAf WR Ox3A PC7 ORBITLED 2 RD 0x3B GPIO D PD6 ORBITLED 3 ORBIT PD2 ORBITBIN 1 PEO GPIO E ORBIT BTN 2 PFO Tiva Launch pad BTN 2 PFI Tiva Launchpad LED RED PF2 Tiva Launchpad LED BLUE PF3 Tiva Launchpad LED GREEN Fr 4 Tiva Launchpad BTN 1 14 15 lab activity G lab activity Attachment 4 ASCII Table Table ASCII m O Pee ee H H C Un 5 Ww O Device control 1 Device control 2 Device control 3 Device control 4 Neg acknowledge Synchronous idle i ue End trans block Cancel i C mg Ot a MM a End of mecdium a b e d L d h i J K l In n o P d 3 t u v Ww x Y z Bo c oe od b at C e U d yo U Qo zo mBDwOH tReet eo tc 5 c t Record separator L1 Unit separator 16
5. ways to continue to accomplish simple projects One idea could be an entertainment center in your home It might have been poorly designed As the super sharp designer you might want to attach a fan but only have it come on when the temperature is really hot Your handy ARM processor could be used to do just that Microchip Technology Inc s TCN75A digital temperature sensor like the one on the ORBIT board converts temperatures between 40 C and 125 C to a digital word with 1 C typical accuracy The TCN75A product comes with user programmable registers that provide flexibility for temperature sensing applications The chip is the small eight pin device on the Orbit board that has an IC4 under it Some typical Applications include Personal Computers and Servers Hard Disk Drives and Other PC Peripherals e Entertainment Systems Office Equipment Data Communication Equipment General Purpose Temperature Monitoring The key to remember is that I C is nothing new It was used in Lab 7 for the accelerometer I C is an amazing bus architecture that all individuals that work with microcontrollers or microprocessors need to have a working knowledge of It is possible to hang hundreds of small sensors off the same pair of wires and to address them individually only by the use of their unique address shown in their datasheets This lab involves introductions to the temperature sensor and then the utilization of the UART to display th
6. A AK AE A A OK AK AK A AK EK AK AK AK AK KK OK 10 lab activity SysCtlPeripheralEnable SYSCTL PERIPH UARTO Enable UART hardware SysCtlPeripheralEnable SYSCTL PERIPH GPIOA Enable Pin hardware GPlIOPinConfigure GPIO PAO UORX Configure GPIO pin for UART RX line GPlIOPinConfigure GPIO PA1 UOTX Configure GPIO Pin for UART TX line GPIOPinTypeUART GPIO PORTA BASE GPIO PIN 0 GPIO PIN 1 Set Pins for UART UARTConfigSetExpCIKk UARTO BASE SysCtlClockGet 115200 UART CONFIG WLEN 8 UART CONFIG STOP ONE UART CONFIG PAR NONE Configure UART to 8N1 at 115200bps eerelekokokekoekokolekokokokokokoelolokololelolokolelololokokolololololelolololololololelolololololololololololololololololololololololololololololololotolololetololokolotokololololololololotololololololololololololololokololololololokololololokololotolololelotokok kokeokeoeexkkokk Print header Print Header while 1 1 Read temp temp data SysCtlDelay 6000000 Delay FISISESISIGEOPAOTOREHROEOROESKOKEORORHROR EORGKEOKOKSEGRAROR AESEOIOBGTORGKOROROROKOK OR SEOK RSE HEOKORGEOEOROR AORGIOEOTORSKOKORORGKORESESKSI OR The value of the temperature sensor is placed in the array temp data Printout this string using a FOR loop ey void Print header Print Header at start of program int i 0 general counter for i 0 i lt 29 i Print Header at start of program UARTCharPut UARTO BASE start screen i voi
7. E 3 2 SLAVE ADDRESS TCN75A ft fo fo a x x x Note X User selectable address is shown by X Figure 6 Temperature Sensor Datasheet Excerpt The portion of the datasheet copied for Figure 6 shows the address for connecting the temperature sensor to the system The very first line of code is a define Zdefine TEMP ADDR Ox4F This is how you create the address in the project to link the IC pieces to the main project This is also a good place to introduce global versus local variables In the code below there are four variables declared The first two are character char strings start screen and log The 29 designates them as a character string that is 29 bytes long The first two are done before and outside of the main function that runs the project These are called global variables and can be seen by any function in the project The second two are declared within the main function temp data and i These are local variables and can only lab activity be seen from within the main function From a design perspective always use local variables when possible It will reduce the debugging time later unsigned char start screen 29 n n r ATE Lab 8 Temp Sensor WW 29 bytes long unsigned char log 18 nW Temp reading 18 bytes long two function headers that will be defined later void Print header Prints Header void Read temp unsigned char data Read Temperature sensor start of main pr
8. O PA1 U TX Configure GPIO Pin for UART TX line GPIOPinTypeUART GPIO PORTA BASE GPIO PIN GPIO PIN 1 Set Pins for UART UARTConfigSetExpClk UARTO BASE SysCtlClockGet 115200 Configure UART to 8N1 at 115200bps UART CONFIG WLEN _ 8 UART CONFIG STOP _ ONE UART_ CONFIG_PAR _NONE Figure 9 Enabling and Configuring the UART The next set of code that is shown above is the UART code This sets the normal variables that designer are used to seeing with a UART 115200 8 none 1 Once again each of these functions can be found in the driver user guide Take the time to compare the two sets of code above Look at how similar the first four lines of each section are These four lines are mandatory for any time there is a desire to use a peripheral The first two lines enable the peripheral The second two lines configure the GPIO pins void Print header 1 Print Header at start of program int i 0 general counter for i 0 i lt 29 i Print Header at start of program UARTCharPut UARTO BASE start screen i Print to UART here The next set of code shown above is nothing more than a print function It takes the global variable called start screen that was declared as a global variable at the top of the program and sends it out to the UART screen void Read temp unsigned char data Read Temperature sensor unsigned char temp 2 storage for data I2CMasterControl I2CO0 MASTER BASE I2C MASTER CMD BU
9. RST RECEIVE START Start condition SysCtlDelay 20000 Delay temp 0 I2CMasterDataGet I2CO MASTER BASE Read first char SysCtlDelay 20000 Delay I2CMasterControl I2CO0 MASTER BASE I2C MASTER CMD BURST RECEIVE CONT Push second Char SysCtlDelay 20000 Delay lab activity temp 1 I2CMasterDataGet I2CO0 MASTER BASE Read second char I2CMasterControl I2CO0 MASTER BASE I2C MASTER CMD BURST RECEIVE FINISH Stop Condition data 0 temp 0 10 0x30 convert 10 place to ASCII data 1 temp 0 temp 0 10 10 0x30 Convert 1 s place to ASCII if temp 1 Ox80 1 Test for 5 accuracy data 3 0x35 else data 3 0x30 The final set of code is shown above This code is designed to read temperature from the temperature sensor and format it the right way The BURST_RECEIVE_START and BURST_RECEIVE_FINISH are constants that are used to identify the START and END conditions on the IC line For the displayed temperature values the plan is xx x where the xx is a whole number the decimal point is a fixed value and the final x is a value that is either 5 or 0 Templ 0 is the value on the left side of the decimal point and temp 1 is the value on the right hand side of the decimal point The assignment of the data 0 1 and 3 are done next The crazy looking code there is to convert the information from HEX to ASCII Data 0 and 1 are the left two positions numbers Data 2 is the fixe
10. Type GPlOPadConfigSet GPIO PORTB BASE GPIO PIN 2 GPIO STRENGTH 2MA GPIO PIN TYPE STD SDA MUST BE STD GPlOPadConfigSet GPIO PORTB BASE GPIO PIN 3 GPIO STRENGTH 2MA GPIO PIN TYPE OD SCL MUST BE OPEN DRAIN I2CMasterlnitExpCIk I2CO BASE SysCtlClockGet false The False sets the controller to 100kHz communication I2CMasterSlaveAddrSet I2CO BASE TEMP ADDR true false means transmit PERRO EECA AA AAA AAA AA AAA AAA AAA AA AA AAA AAA AAA A AA AA AA AAA A AAR AA AA AA AA AA AA AAA AAA AA AAA AAA AA Setup the UART see lab 6 Joke eb b epe bebe AK AK A A A AK AE E KE AK A AK OK EK AE AK AK A A OE A AE OK AK AK AK A KE A AK A AK A KK AK A A AK A AK AK PK PE A A PK AK A PE PE PE A AK A A AE OK AK A AR RK A A AK AK AK A IK AK A PESE AK A AK PK PK PE A AK PK EAE PE PK PE EK EE AK OK AK AK AR SE EK AR AK AK AK KK OK 12 SysCtlPeripheralEnable SYSCTL PERIPH UARTO SysCtlPeripheralEnable SYSCTL PERIPH GPIOA GPlOPinConfigure GPIO PAO UORX GPlIOPinConfigure GPIO PA1 UOTX GPIOPinTypeUART GPIO PORTA BASE GPIO PIN 0 GPIO PIN 1 UARTConfigSetExpCIKk UARTO BASE SysCtlClockGet 115200 lab activity Enable UART hardware Enable Pin hardware Configure GPIO pin for UART RX line Configure GPIO Pin for UART TX line Set Pins for UART Configure UART to 8N1 at 115200bps UART CONFIG WLEN 8 UART CONFIG STOP ONE UART CONFIG PAR NONE AR
11. d Read_temp unsigned char data Read Temperature sensor unsigned char temp 2 storage for data i ik a a ka a a a a a a a a a a a a THESE The Temperature sensor provides 2 bytes that are the C degrees Create code to read these bytes and place them in temp 0 amp temp 1 i i a a a aN a a a E T data 0 temp 0 10 0x30 convert 10 place to ASCII data 1 temp 0 temp 0 10 10 0x30 ASCII if temp 1 0x80 Test for 5 accuracy data 3 0x35 else data 3 0x30 11 Read Data from Temp Sensor Convert 1 s place to lab activity Attachment 2 main c file solution JT EEHREGEGORUBSSORURORISOIORUNSESURISOEUETUETRORUESEGEUR NONE E B EEEE REEE EREEREER Project Orbit Lab 7 ATE Temp With UART Version 1 0 Date 2 20 2013 Author Brian Zufelt Craig Kief Company COSMIAC UNM Comments This Lab will pull data from the temperature sensor found on the Orbit board and output the data through the UART to be read from a terminal program DEAK AK AK EK OK AAA AK AK OK AK AK A A AK A AE AK AK A AK A EK OK eer A EK AK AK AK AK AK KK AK AK AK AK AK Chip type ARM TM4C123GH6PM Program type Firmware Core Clock frequency 80 000000 MHz ORBSEOROROTORSKORSKORORGEOROROEGIORSEORSEONOROKORDEORGROROROKGRORORGEAK RUE AGRO ERRER KEER KEE define TEMP ADDR Ox4F Address for Temp Sensor Define needed for pin map h define PART TM4C123GH6PM include lt stdboo
12. d decimal point and data 3 is the value on the right hand side of the decimal point 0 or 5 The next part is dependent on if you have the word file or the pdf in a classroom If you are doing this as part of the workshop you should now look at main c If you are part of the workshop you will now see parts that need to be typed in All of the final code is shown in Attachment 2 When all the final code is typed in click on the debug icon bug as shown in Figure 10 wr CCS Edit ATE LAB amp main c Code Composer File Edit View WNavigate Project Run Sc r3 T a w ie E L3 Project Explorer 23 ATE LAB i ATE LAB 3 SOLUTION Figure 10 Debug Window ri we DE mW lio Device Debugging rface CORTEX M4 0 Running Figure 11 Run and Stop Click on the green angle to load the program and then on the red square to exit debug mode It is important to exit the debug mode to allow Putty and the UART to work correctly by freeing up the port Start Putty lab activity Category Session Basic options for your PuTTY session m meii Specify the destination you want to connect to Temina Serial line Keyboard Bell COM10 Features Connection type Window Raw Telnet Rlogin SSH arance Ve ERES Load save or delete a stored session Translation Saved Sessions Selection Colours Default Settings Connection aac Data Proxy Telnet Rlogin SSH Serial Close window on exit Always Never O
13. e temperature on the computer Grading Criteria N A lab activity G Time Required Approximately one hour Lab Preparation It is highly recommended that the student read through this entire procedure once before actually using it as a tutorial Itis also recommended that the tutorial software was run first to preload compiler options and source files as well as to load many of the main c files Equipment and Materials It is assumed that the student has already completed prior labs and the software is installed properly Software needed Install the tutorial framework from the autoinstaller located at http cosmiac org thrust areas academic programs and design services education and workforce development community portal The designer will also want Putty or similar RS 232 terminal program for viewing the UART output Hardware needed The hardware required is the TI Tiva LaunchPad Kit and the Digilent Orbit board Additional References The Evaluation Board user s manual is on this web site http datasheet octopart com EK TM4C123GXL Texas Instruments datasheet 15542121 pdf and the manuals for the Digilent orbit board are located at http digilentinc com Products Detail cfm NavPath 2 396 1181 amp Prod ORBIT BOOSTER Here is the datasheet for the temperature sensor http ww1 microchip com downloads en DeviceDoc 21935a pdf Here is the place to find and download putty www putty org COSMIAC tutorials found a
14. ity the source code is provided at the end of the tutorial In Lab 8 open main c Then either type in all the code from attachment 2 or copy and paste in the code from Attachement 2 into main c Once again it is easy to just copy and paste in all the code but what is learned is very minimal The true power is typing in the code and dealing with the errors that you will create lab activity Just as with the accelerometer the temperature sensor has an IC interface Remember that it is possible to hang hundreds of items onto this bus and only deal with them individually through their unique addresses This is shown in Figure 5 and is very similar to the one showed in Tutorial 7 I C has two wires SDA and SCL PIC Microcontroller I O Ports m Figure 5 Temperature Sensor Overview Many parts can share the IC bus Think of it as many grapes hanging on the grapevine The difference is that you must have a scheme for knowing when each of the pieces is communicated with This is done with addresses Each device has a different 7 bit address which is how it is identified In the case of this temperature sensor the address is shown below in Figure 6 3 6 Address Pins A2 A1 AQ A2 A1 and AO are device or slave address input pins The address pins are the Least Significant bits LSb of the device address bits The Most Significant bits MSb A6 A5 A4 A3 are factory set to lt 1001 gt This is illustrated in Table 3 2 TABL
15. l h gt include lt stdint h gt include inc tm4c123gh6pm h include inc hw memmap h include inc hw types h include driverlib gpio h include driverlib pin map h include driverlib sysctl h include driverlib uart h include inc hw i2c h include driverlib i2c h include inc hw ints h include driverlib interrupt h include driverlib timer h unsigned char start screen 29 n n r ATE Lab 8 Temp Sensor n n r unsigned char log 18 n n r Temp reading void Print_header Prints Header void Read_temp unsigned char data Read Temperature sensor void main void unsigned char temp data 10 00 0 C n n r Temp format to be edited by read unsigned short int i 0 general counter Setup the I2C see lab 7 DE AKAIKE EK OK AAR AK AK A OK AK A A A AK A AE A OK AK A AK A EA EK AK A A A A A OK AK AK A e bk AK AK A A AK A AE A AK A A AK AE A bo e A AK A AK A AK AK A A A AK A AE A AK A A AK AK EA OK AK AK A AE ke A OK AK A AR eek SysCtlClockSet SYSCTL SYSDIV 1 SYSCTL USE OSC SYSCTL OSC MAIN SYSCTL XTAL 16MHZ setup clock SysCtlPeripheralEnable SYSCTL PERIPH 12C0 Enable I2C hardware SysCtlPeripheralEnable SYSCTL PERIPH GPIOB Enable Pin hardware GPIOPinConfigure GPIO PB3 I2COSDA Configure GPIO pin for I2C Data line GPIOPinConfigure GPIO PB2 I2COSCL Configure GPIO Pin for I2C clock line GPIOPinTypel2C GPIO PORTB BASE GPIO PIN 2 GPIO PIN 3 Set Pin
16. nfig void SysCtlPeripheralClockGating bool bEnable void SysCtlPeripheralDeepSleepDisable uint32 t ui32Peripheral void SysCtlPeripheralDeepSleepEnable uint32 t ui32Peripheral void SysCtlPeripheralDisable uint32 t ui32Peripheral void SysCtlPeripheralEnable uint32 t ui32Peripheral April 11 2013 Figure 7 Hyperlink for Drivers The key to remember is just how powerful this ARM processor is If you glance through this document s table of contents then it is clear to see just how powerful it is There are functions for using ADC CAN lC UART USB For the purposes of this tutorial and the other tutorials the projects are being reduced to the bare minimum lab activity i Setup the I2C see lab 7 ee Se eS SS SS SD SS SS SS SS SS cic cde cic cic cie cic cie cie cic cc cde cic cic cic cic cic cic cie cie cic cc cde cic cic cic cic cic cic cie cie cic ce cde cic cic cic cie cic cic cie cie cie cc cde cic aic cic cic clie cie cic cie cc cde cde cic cic aic cic cic cie cie cie cc cde cde aic cic cic cic cie cic cie cie cc cde cde aic cic cic cic cic cic cic cie cie cic cde cic cic cic cic cie ce oie oie oe oe oe oL SysCtlClockSet SYSCTL SYSDIV 1 SYSCTL USE OSC SYSCTL OSC MAIN SYSCTL XTAL 16MHZ setup clock SysCtlPeripheralEnable SYSCTL PERIPH I2C0 Enable I2C hardware SysCtlPeripheralEnable SYSCTL PERIPH GPIOB Enable Pin hardware GPIOPinConfigure GPIO PB3 I2C0SDA Configure GPIO pin for I2C Data line GPIOPinC
17. nly on clean exit Open Canca Figure 12 Putty Configuration Launch the Putty program with the configuration settings shown above in Figure 12 Note that your comm port will most likely be different than this one You will have to go to your Device Manager to ensure you have the correct comm port for your computer DX fts 38 t Items sted Items 2 k E mail Inbox 3 sentEmail box Feeds rch Folders we L6 m us cosmiacorg om 7 t Items Bp ny Figure 13 Temperature Output dL C om x As shown on Figure 13 once the program is running the designer can visualize the output on Putty The temperature is displayed Now by putting your finger on the ICA chip on the Orbit board it is possible to raise the temperature This same system could be used to control fans or other items in a house based on specific temperatures By pressing the reset button on the Tiva board it is possible to restart the program and see the ATE Lab line Challenge Change the text that is displayed remove the decimal point turn on LEDs at certain times lab activity Attachment 1 main c file starting file a EREE EEEE a a INEO ds Project Orbit Lab 7 ATE Temp With UART Version 1 0 Date 2 20 2013 Author Brian Zufelt Craig Kief Company COSMIAC UNM Comments This lab will extend the concepts from LAB 7 This Lab will pull data from the temperature sensor found on the Orbit board and output the data
18. ogram void main void 1 unsigned char temp data 10 00 0 C n n r Temp format to be edited by read unsigned short int i 0 The next section sets up the IC There is nothing different here than was used in the last lab This section must be included any time there is a desire to use IC The informational part here is to explain where these functions come from By googling tivaware device driver users guide you will be taken to this page as an option http www ti com tool sw tm4c Open this file TivaWare Peripheral Driver Library for C Series User s Guide It is actually a driver library According to this document the Texas Instruments Tiva Peripheral Driver Library is a set of drivers for accessing the peripherals found on the Tiva family of ARM Cortex M based microcontrollers While they are not drivers in the pure operating system sense that is they do not have a common interface and do not connect into a global device driver infrastructure they do provide a mechanism that makes it easy to use the device s peripherals As an example when this pdf is opened if the designer searches for SysCtlPeripheralEnable then they will be taken to the page shown in Figure 7 void SysCtlintDisable uint32 t ui32lInts void SysCtlIntEnable uint32 t ui32Ints void SysCtlIntRegister void pfnHandler void uint32 t SysCtllntStatus bool bMasked void SysCtlIntUnregister void void SysCtIMOSCConfigSet uint32 t ui32Co
19. onfigure GPIO PB2 I2C6SCL Configure GPIO Pin for I2C clock line GPIOPinTypelI2C GPIO PORTB BASE GPIO PIN 2 GPIO PIN 3 Set Pin Type GPIOPadConfigSet GPIO PORTB BASE GPIO PIN 2 GPIO STRENGTH 2MA GPIO PIN TYPE STD SDA MUST BE STD GPIOPadConfigSet GPIO PORTB BASE GPIO PIN 3 GPIO STRENGTH 2MA GPIO PIN TYPE OD SCL MUST BE OPEN DRAIN I2CMasterInitExpClk I2C BASE SysCt1ClockGet false The False sets the controller to 100kHz communication I2CMasterSlaveAddrSet I2C0 _ BASE TEMP ADDR true false means transmit Figure 8 Enabling and Configuring Ports and Pins As shown above in Figure 8 first the peripherals are enabled Next the General Purpose IO pins are configured The final line is where the IC address is assigned through the variable TEMP ADDR j h 1 b 4 Setup the UART see lab 6 SysCtlPeripheralEnable SYSCTL PERIPH UARTO Enable UART hardware SysCtlPeripheralEnable SYSCTL PERIPH GPIOA Enable Pin hardware GPIOPinConfigure GPIO PAG U RX Configure GPIO pin for UART RX line GPIOPinConfigure GPI
20. t http cosmiac org thrust areas academic programs and design services education and workforce development microcontrollers ate developed material lab activity Lab Procedure Figure 1 ARM and ORBIT Combination This picture of the correct way to mate the Tiva LaunchPad and the Digilent Orbit boards together Please do so at this point and connect them as shown in Figure 1 M 7 Ode GOITIDOSerm Figure 2 Code Composer Icon Launch Code Composer and where prompted chose the workspaces location to store your project as shown in Figure 3 lab activity Select a workspace Code Composer Studio stores your projects in a folder called a workspace Choose a workspace folder to use for this session Browse Use this as the default and do not ask again Figure 3 Workspace Selection Since the installer for the workshop has been run prior to this the user will be presented with the following view Figure 4 where all lab projects exist File Edit View Navigate Project Scri Civ GiGi ttvie viet i Project Explorer 23 E 5 i Lab 2 gt i Lab 3 i Lab 4 Active Debug gt S Lab 5 gt i Lab 6 gt i Lab 7 i Lab 8 gt i Lab 9 Figure 4 CCS Starting Point The laboratory material is created to have the students type in a lot of the code Only by typing the code and then debugging the errors will a user ever really understand how to do projects For the sake of this activ
21. through the UART to be read from a terminal program DEAK AK AK EK OK KAKA AK A OK AK AK A A AK A AE A AK AK A AK A EK AK OK A AK A gb kk Chip type ARM TM4C123GH6PM Program type Firmware Core Clock frequency 80 000000 MHz JORHEROKOTORKORSKORHEGKORGKOIEROROROKORSEORAROK KOROROKORORSKORSKOROROKOKSEHROROROKORORSETTNSSKOROROKaKoRS define TEMP ADDR Ox4F Address for Temp Sensor Define needed for pin map h define PART TM4C123GH6PM include lt stdbool h gt include lt stdint h gt include inc tm4c123gh6pm h include inc hw memmap h include inc hw types h 7Z include driverlib gpio h include driverlib pin map h include driverlib sysctl h include driverlib uart h include inc hw i2c h include driverlib i2c h include inc hw ints h include driverlib interrupt h include driverlib timer h unsigned char start screen 29 n n r ATE Lab 8 Temp Sensor n n r unsigned char log 18 n n r Temp reading void Print headerY Prints Header void Read temp unsigned char data Read Temperature sensor void main void unsigned char temp data 10 00 0 C n n r Temp format to be edited by read unsigned short int i 0 general counter Setup the I2C see lab 7 DE AKA AK bebe AKA AK A OK AK AK A A AK AK EK OK AK A AK OK EA AE OK OK A A OK EAE OK AK AK AK l e tek AK AK A A A A AE A KA A A FE AE A EK A A AK exe bb ke A AK A AK AR OK AK A A A AK A AE AK A A AK FE EA KK
Download Pdf Manuals
Related Search
Related Contents
Hibbett lab protocols for DNA isolation, PCR, and DNA sequencing. あなたの3Doodlerの知識を高めましょう 3Doodlerは常に風通しの良い Our Barista Training Guide Sigma Pharmaceuticals Plc Electronic Transmission (ET) User Manual WAVRE - Pronav.be 無床診療所自主点検の手引き(根拠法令解説)(PDF形式 Manual de instruções e catálogo de peças WMY 111444 LB1 Plně automatická pračka Uživatel Manuální herunterladen Copyright © All rights reserved.
Failed to retrieve file