pres
DESCRIPTION
8051 microcontrollerTRANSCRIPT
![Page 1: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/1.jpg)
PDI Studio 5
Dayna Polstein
![Page 2: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/2.jpg)
Main purpose:◦ To run programs on devises
“Mini Computer” – Contains memory space
Devise for embedded control
Use a computer to program
Can download programs from computer
Can output information to computer
Contains input/output ports
![Page 3: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/3.jpg)
Everywhere!◦ Computers
◦ Remote controls
◦ Cell phones
◦ Cars (engine, antilock breaks, cruise control, etc.)
◦ Microwaves
◦ Dishwashers
◦ TVs
◦ DVD Players
◦ Almost every electronic with a user interface
![Page 4: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/4.jpg)
Basic computer skills
C-programming
Some basic circuitry
![Page 5: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/5.jpg)
Computer
C8051 Board
USB Debug Adapter
Power Cord
USB Cable
SiLabs IDE
SecureCRT
![Page 6: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/6.jpg)
1.
![Page 7: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/7.jpg)
2. 3.
4.
![Page 8: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/8.jpg)
Used For◦ Writing Programs
◦ Sending Programs to C8051
Programmed in C
Used For displaying text from:◦ Main Program
◦ Input
![Page 9: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/9.jpg)
Be Careful with circuit◦ Circuit boards are very delecate
Only hold circuits by the edges◦ Do not touch anything metal
Before setting down:◦ Make sure rubber feet are in tact
◦ Make sure area is clean and dust-free
When storing:◦ Use anti-static bag and cushioned packaging
◦ Store at room temperature
![Page 10: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/10.jpg)
To USB Debug Adapter
To Power Cord
LED should light up when powered
![Page 11: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/11.jpg)
USB to Computer
To power outlet
LEDs should light up when in use
![Page 12: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/12.jpg)
1. Open SiLabs IDE
2. Go to File New File
3. Type in C Program Copy Sample Program:
#include <stdio.h>
main ()
{
printf(“PDI Studio 5/n");
}
![Page 13: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/13.jpg)
4. Compile program by pressing the Assemble/Compile button on the toolbar or press Project Assemble/Compile File
5. Build program by pressing the Build/Make button on the toolbar or press Project Build/Make Project
Assemble/Compile Button
Build/Make Button
Note: If your program does not work, it will notify you at steps 4 and 5 and you will have to debug before attempting to connect
![Page 14: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/14.jpg)
6. Go to Options Connection options and choose USB Debug Adapter and then OK
![Page 15: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/15.jpg)
7. Press the Connect button (or alt c)
LEDs on the Debug Adapter should now be on
Connect Button
![Page 16: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/16.jpg)
8. Press the Download code button
Download Code Button
![Page 17: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/17.jpg)
Go to Project Target Build Configuration
Enable automatic connect/download after build and then press build again
![Page 18: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/18.jpg)
Go to C:\SiLabs\MCU\Examples\C8051F02x Click on the “Blinky” folder, and open the c
file in IDE Press on the green “go” button The green led on the board should start
blinking Press the red button for the program to stop Each program has a description of function
and reason for different lines Use these programs as guilds for your
programs
![Page 19: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/19.jpg)
![Page 20: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/20.jpg)
8 ports, 0 through 7
Each port is 1 byte (8 bits) wide
You can address to entire bytes or individual bits
Each port can be assigned as input or output
C8051 will read the ports as◦ 0 volts as false
◦ +3 volts as true
![Page 21: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/21.jpg)
Setting by bit (one of eight bits of the port)◦ To assign b7 of port 0 :
sbit bit7 = P0^7;
bit7 = 1;
![Page 22: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/22.jpg)
Set as Input◦ Port 3 pin 7
P3MDout &= ~0x80;
P3 | = 0x80; *****
Set as Output◦ Port 2 pin 2
P2MOUT |= 0x04
![Page 23: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/23.jpg)
For individual bits, first read entire port, then use masking to determine value of bit
Describe Masking Here
![Page 24: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/24.jpg)
Open Secure CRT
![Page 25: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/25.jpg)
Change settings and connect (try different com numbers) **
![Page 26: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/26.jpg)
Right click on Serial-COM3 and select “Session Options…”
![Page 27: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/27.jpg)
Click on emulation, change the scrollbackbuffer to 32000, and press ok.
![Page 28: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/28.jpg)
Make a new project and file in IDE (save as 384test.c
Copy this program:
#include "c8051.h"
int main(){
Sys_Init();printf("\n\n\ntesting...\n");printf("done for now...\n");while(1);
}
![Page 29: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/29.jpg)
Compile and build the code
Connect and download code
Start the code
Text should display on Secure CRT window ***
![Page 30: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/30.jpg)
Embedded Control Course Materials http://litec.rpi.edu/course.php
IDE Software: http://litec.rpi.edu/Postings/UsingSiLabsIDE.html
C8051 User Guide http://litec.rpi.edu/Postings/C51_User_Guide.pdf
C8051 Manual: http://litec.rpi.edu/Postings/C8051F02xRev1_4.pdf
![Page 31: Pres](https://reader035.vdocuments.us/reader035/viewer/2022081401/559d3e8b1a28ab00598b4573/html5/thumbnails/31.jpg)
Timers
A/D Converter
C programming?