The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
BÀI 1: CẤU TRÚC VI ĐIỀU KHIỂN 1.1
GIỚ I THIỆU
1.1.1. Sơ lượ c về vi xử lý: Trong những thậ p niên cuối th ế k ỉ XX, từ sự ra đờ i của công nghệ bán dẫn, k ĩ thuật điện tử đã có s ự phát triển v ượ t bậc. Các thiết bị điện tử sau đó đã đượ c tích hợ p vớ i mật độ cao và r ất cao trong các diện tích nhỏ, nhờ vậy các thiết b ị điện tử nhỏ hơ n và nhiều chức năng hơ n. n. Các thiết b ị điện tử ngày càng nhiều chức năng trong khi giá thành ngày càng r ẻ hơ n, n, chính vì vậy điện tử có mặt khắ p mọi nơ i. i.
Bướ c đột đột phá mớ mớ i trong công nghệ ngh ệ điện tử t ử, công ty tr ẻ tuổ tuổi Intel cho ra đờ i bộ b ộ vi xử x ử lý đầu đầu ết cấ u logic mà có th ể thay đổ i chứ c nă ng tiên. Đột Đột phá ở ch ở chỗỗ: " Đó là một k ế ng của nó bằ ng ng chươ ng ng trình ngoài ch ứ không phát tri ể n theo hướ ng ng t ạo một c ấ u trúc ph ần c ứ ng ng chỉ thự c hiện theo một số ướ c đ ây từ dòng 17 đến đến 19, trang 3, 'K ĩ thu ĩ thuậật VI XỬ XỬ LÝ LÝ và lậ lậ p chứ c n ă ng ng nhấ t t định như tr ướ ây" (trích từ
trình ASSEMBLY cho hệ hệ vi xử xử lý', tác giả giả Đỗ Xuân Tiế Tiến, nhà xuấ xuất bả bản Khoa họ học và k ĩ thu ĩ thuậật). Tứ Tức là phầ phần cứ c ứng chỉ chỉ đóng vai trò thứ th ứ yếu, phầ phần mềm (chươ (chươ ng ng trình) đóng vai trò chủ ch ủ đạo đạo đối đối vớ i các chứ chức nă năng cầ cần thự thực hiệ hiện. Nhờ Nhờ vvậy vi xử xử lý có sự sự mềm dẻ dẻo hóa trong các chứ ch ức nă năng củ của mình. Ngày nay vi xử xử lý có tố t ốc độ tính toán r ất cao và khả kh ả năng xử xử lý r ất lớ lớ n. n. Vi xử lý có các khố kh ối chứ chức năng cần thiế thiết để lấy dữ liệ liệu, xử lý dữ liệ liệu và xuấ xuất dữ liệ liệu ra ngoài sau khi đã xử lý. Và chứ chức năng chính củ c ủa Vi xử xử lý chính là xử x ử lý dữ liệ liệu, chẳ chẳng hạn như như cộng, tr ừ, nhân, chia, so sánh.v.v..... Vi x ử lý không có khả kh ả năng giao tiế ti ế p tr ực tiế tiế p vớ vớ i các thiế thiết bị bị ngoạ ngoại vi, nó chỉ ch ỉ có khả khả năng nhậ nhận và xử xử lý dữ dữ liệ liệu mà thôi. Để vi xử x ử lý hoạ hoạt động động cầ c ần có chươ chươ ng ng trình kèm theo, các chươ ch ươ ng ng trình này điều khiể khiển các mạch logic và từ t ừ đó vi xử xử lý xử x ử lý các dữ dữ liệ liệu cầ c ần thiế thiết theo yêu cầ c ầu. Chươ Chươ ng ng trình là tậ t ậ p hợ h ợ p các lệnh để xử lý dữ dữ liệ liệu thự th ực hiệ hi ện từ t ừng lệ l ệnh đượ c lư l ưu tr ữ trong bộ bộ nhớ nhớ , công việ vi ệc thự th ực hành lệ lệnh bao gồm: nhậ nhận lệ lệnh từ từ bộ nhớ nhớ , giả giải mã lệ lệnh và thự thực hiệ hiện lệ lệnh sau khi đã giả giải mã. Để thự thực hiệ hiện các công việ việc vớ i các thiế thi ết bị cuố cuối cùng, chẳ ch ẳng hạ h ạn điều khiể khiển động động cơ c ơ , hiể hiển thị thị kí tự t ự trên màn hình .... đòi hỏi phả phải k ết hợ p vi xử xử lý vớ i các mạ mạch điện giao tiế ti ế p vớ i bên ngoài đượ c gọi là các thiế thi ết bị I/O (nhậ (nhậ p/xuấ p/xuất) hay còn gọ gọi là các thiế thi ết bị bị ngoạ ngoại vi. Bả Bản thân các vi xử x ử lý khi đứng đứng mộ một mình không có nhiềều hiệ nhi hiệu quả quả sử dụng, như nhưng khi là mộ m ột phầ phần củ của mộ một máy tính, thì hiệ hi ệu quả quả ứng dụ dụng củ của Vi xử xử lý là r ất lớ lớ n. n. Vi xử xử lý k ết hợ hợ p vớ vớ i các thiế thiết bị bị khác đượ c sử sử trong các hệ h ệ thố thống lớ lớ n, n, phứ phức tạ tạ p đòi hỏ hỏi phả phải xử xử lý mộ một lượ lượ ng ng lớ lớ n các phép tính phứ ph ức tạ tạ p, có tố tốc độ nhanh. Chẳ Chẳng hạ hạn như như các hệ hệ thố thống sả sản xuấ xuất tự động động trong công nghiệ nghi ệ p, các tổ tổng đài điện thoạ thoại, hoặ hoặc ở các robot có khả kh ả năng hoạ hoạt động động phứ phức tạ tạ p v.v...
1.1.2. Từ Vi xử lý đến Vi điều khiển Bộ Vi x ử lý có khả năng v ượ t b ậc so vớ i các hệ thống khác về khả năng tính toán, x ử lý, và thay đổi ch ươ ng ng trình linh hoạt theo mục đích ngườ i dùng, đặc bi ệt hi ệu qu ả đối v ớ i các bài toán và hệ thống lớ n. n. Tuy nhiên đối vớ i các ứng dụng nhỏ, tầm tính toán không đòi hỏi khả năng tính toán
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
đòi hỏi ngườ i thiết k ế phải hi ểu biết tinh tườ ng ng về các thành phần vi xử lý, bộ nhớ , các thiết b ị ngoại vi. Hệ thống đượ c tạo ra khá phức tạ p, chiếm nhiều không gian, mạch in phức t ạ p và vấn đề chính là trình độ ngườ i thiết k ế. K ết qu ả là giá thành sản ph ẩm cu ối cùng r ất cao, không phù hợ p để áp d ụng cho các hệ thống nhỏ.
Vì mộ một số số nhượ nhượ c điểm trên nên các nhà chế ch ế tạo tích hợ hợ p mộ một ít bộ bộ nhớ nhớ và và mộ một số số mạch giao tiế tiế p ngoạ ngoại vi cùng vớ v ớ i vi xử xử lý vào mộ một IC duy nhấ nh ất đượ c gọ g ọi là Microcontroller-Vi điều khiể khiển. Vi điều khiể khiển có khả khả năng tươ ng ng tự như như khả khả năng của vi xử xử lý, như nhưng cấu trúc phầ ph ần cứng dành cho ngườ ngườ i dùng đơ n giả giản hơ n nhiề nhiều. Vi điều khiể khiển ra đờ i mang lạ lại sự tiệ tiện lợ i đối đối vớ i ngườ ngườ i dùng, họ họ không cầ cần nắ nắm vữ vững mộ một khố khối lượ lượ ng ng kiế kiến thứ thức quá lớ lớ n như như ngườ ngườ i dùng vi xử x ử lý, k ết cấ cấu mạ mạch điện dành cho ngườ ng ườ i dùng cũ cũng tr ở ở nên đơ n giả giản hơ n nhiề nhiều và có khả kh ả năng giao tiế ti ế p tr ực tiế tiế p vớ i các thiế thiết bị bên ngoài. Vi điều khiể khiển tuy đượ c xây dự dựng vớ i phầ phần cứng dành cho ngườ ng ườ i sử dụng đơ n giả giản hơ hơ n, n, như nhưng thay vào lợ l ợ i điểm này là khả kh ả năng xử xử lý bị bị giớ giớ i hạ hạn (tố (tốc độ xử lý chậ chậm hơ hơ n và khả kh ả năng tính toán ít hơ h ơ n, n, dung lượ l ượ ng ng chươ chươ ng ng trình bị b ị giớ giớ i hạn). Thay vào đó, Vi điều khiể khiển có giá thành r ẻ hơ n nhiề nhiều so vớ vớ i vi xử xử lý, việ việc sử dụng đơ n giả giản, do đó nó đượ c ứng dụng r ộng rãi vào nhiềều ứng dụ nhi dụng có chứ chức nă năng đơ n giả giản, không đòi hỏ hỏi tính toán phứ ph ức tạ tạ p. Vi điều khiể khiển đượ c ứng dụ dụng trong các dây chuyề chuy ền tự tự động động loạ loại nhỏ nhỏ, các robot có chứ ch ức nă năng đơ n giả giản, trong máy giặ gi ặt, ôtô v.v... Nă Năm 1976 Intel giớ gi ớ i thiệ thiệu bộ vi điều khiể khiển (microcontroller) 8748, mộ m ột chip tươ tươ ng ng tự như như các bộ bộ vi xử x ử lý và là chip đầu đầu tiên trong họ h ọ MCS-48. Độ phứ phức tạ t ạ p, kích thướ thướ c và khả khả năng củ c ủa Vi điều khiể khiển tăng thêm mộ một bậc quan tr ọng vào nă năm 1980 khi intel tung ra chip 8051, b ộ Vi điều khiểển đầu khi đầu tiên củ của họ họ MCS-51 và là chuẩ chu ẩn công nghệ ngh ệ cho nhiề nhiều họ họ Vi điều khiể khiển đượ c sả sản xuấ xuất sau này. Sau đó r ất nhiề nhiều họ Vi điều khiể khiển của nhiề nhiều nhà chế ch ế tạo khác nhau lầ l ần lượ t đượ c đưa đưa ra thị thị tr ườ ườ ng ng vớ vớ i tính nă năng đượ c cả cải tiế tiến ngày càng mạ m ạnh.
1.1.3. Họ MSC-51 Hiệ Hiện nay có r ất nhiề nhiều họ họ Vi điều khiể khiển trên thị thị tr ườ ườ ng ng vớ vớ i nhiề nhiều ứng dụ dụng khác nhau, trong đó họ họ Vi điều khiể khiển họ họ MCS-51 đượ c sử sử dụng r ất r ộng rãi trên thế th ế giớ giớ i và ở Vi ở Việệt nam. Vào nă năm 1980 Intel công bố b ố chíp 8051(80C51), bộ b ộ vi điều khiể khiển đầu đầu tiên củ c ủa họ vi điều khiểển MCS-51. Nó bao gồ khi g ồm 4KB ROM, 128 byte RAM, 32 đườ ng ng xuấ xuất nhậ nh ậ p, 1 port nố nối tiế ti ế p và 2 bộ bộ định định thờ thờ i 16 bit. Tiế Ti ế p theo sau đó là sự sự ra đờ i củ của chip 8052,8053,8055 vớ v ớ i nhiề nhiều tính nă n ăng đượ c cải tiế tiến Hiệ Hiện nay Intel không còn cung c ấ p các loạ loại Vi điều khiể khiển họ họ MCS-51 nữ nữa, thay vào đó các nhà sả sản xuấ xuất khác như nh ư Atmel, Philips/signetics, AMD, Siemens, Matra&Dallas, Semiconductors đượ c cấ cấ p phép làm nhà cung c ấ p thứ thứ hai cho các chip củ c ủa họ họ MSC-51. Chip Vi điều khiể khiển đượ c sử sử dụng r ộng rãi trên thế th ế giớ giớ i cũng như như ở Việ Việt Nam hiệ hiện nay là Vi điều khiể khiển của hãng Atmel vớ v ớ i nhiềều chủ nhi chủng loạ loại vi điều khiể khiển khác nhau. Hãng Atmel có các chip Vi điều khiể khiển có tính nă n ăng tươ t ươ ng ng tự t ự như như chip Vi điều khiể khiển MCSố đổ ấ ố ể
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Bảng 1 89C51 89C52 89C53 89C55
Dung l ượ ng RAM ượ ng 128 byte 128 byte 128 byte 128 byte
Dung l ượ ng ROM ượ ng 4 Kbyte 8 Kbyte 12 Kbyte 20 Kbyte
Chế độ ế độ nạ p song song song song song song song song
Sau khoả khoảng thờ thờ i gian cả cải tiế tiến và phát triể tri ển, hãng Atmel tung ra thị th ị tr ườ ườ ng ng dòng Vi điều khiểển mang số khi số hiệ hiệu 89Sxx vớ vớ i nhiề nhiều cả cải tiế tiến và đặc đặc biệ biệt là có thêm khả kh ả năng nạ nạ p chươ chươ ng ng trình theo chế chế độ nối tiế tiế p r ất đơ n giả giản và tiệ tiện lợ lợ i cho ngườ ngườ i sử sử dụng. Bảng 2 89S51 89S52 89S53 89S55
Dung l ượ ng RAM ượ ng 128 byte 128 byte 128 byte 128 byte
Dung l ượ ng ROM ượ ng 4 Kbyte 8 Kbyte 12 Kbyte 20 Kbyte
Chế độ ế độ nạ p n ối tiế tiế p n ối tiế tiế p n ối tiế tiế p n ối tiế tiế p
Tất cả cả các Vi điều khiể khiển trên đều đều có đặc đặc tính cơ cơ bbản giố giống nhau về về phầ phần mề mềm (các tậ tậ p lệ lệnh lậ p trình như như nhau), còn phầ ph ần cứ c ứng đượ c bổ b ổ sung vớ vớ i chip có mã số s ố ở hai ở hai số số cuố cuối cao hơ hơ n, n, các Vi điều khiể khiển sau này có nhiề nhi ều tính nă năng vượ v ượ t tr ội hơ h ơ n Vi điều khiể khiển thế th ế hệ tr ướ ướ c. c. Các Vi điều khiể khiển 89Cxx như như trong bả bảng 1 có cấ cấu tạ tạo ROM và RAM như nh ư 98Sxx trong bả bảng 2, tuy nhiên 98Sxx đượ c bổ bổ sung mộ một số số tính nă năng và có thêm chế ch ế độ nạ p nố nối tiế tiế p. Trên thị thị tr ườ ườ ng ng hiệ hiện nay có r ất nhiề nhiều loạ loại sách hướ h ướ ng ng dẫn về Vi điều khiể khiển vớ i nhiề nhiều loạ loại khác nhau như nh ư 8051, 89C51, 89S8252, 89S52 v.v... các sách này đều đều hướ ng ng dẫn cụ thể thể về phầ phần cứng cũ cũng như như cách thứ thức lậ lậ p trình. Chươ Ch ươ ng ng trình phầ ph ần mề mềm dành cho các Vi điều khiể khiển này là như nh ư nhau, vì vậ v ậy bạ bạn có thể th ể tham khả khảo thêm về về Vi điều khiể khiển ở các ở các sách này. Các phầ phần thự thực hành trên phầ ph ần cứ cứng thự thực tế tế, chúng tôi sẽ s ẽ cùng các bạ bạn thự thực hành vớ v ớ i Vi điều khiểển 89S52 (Mã đầy khi đầy đủ:AT89S52; đủ:AT89S52; AT là viế vi ết tắ tắt củ của nhà sả sản xuấ xuất ATMEL) vì :
Các Vi điều khiể khiển 89Sxx đượ c cả cải tiế tiến từ từ dòng 89Cxx Chươ Chươ ng ng trình viế vi ết dành cho 89Cxx đều đều chạ chạy đượ c vớ vớ i 89Sxx 89Sxx r ẻ hơ n 89Cxx 89Sxx có chế ch ế độ nạ p nố nối tiế tiế p vớ vớ i mạ mạch nạ nạ p đơ n giả giản có khả kh ả năng nạ nạ p ngay trên bo mạ m ạch mà không cầ c ần tháo chip vi điều khiể khiển sang mạ mạch khác để nạ p chươ chươ ng ng trình và nhiề nhiều tính năng cả cải tiế tiến khác.
1.1.4. Các lo ại vi điều khiển khác
Vi điều khiể khiển AVR Vi điều khiể khiển PIC Vi điều khiể khiển MCUs củ của Philips
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Có 4/8/12/20 Kbyte bộ b ộ nhớ nhớ FLASH ROM bên trong để lưu chươ chươ ng ng trình. Nhờ Nhờ vậy Vi điều khiể khiển có khả khả năng nạ nạ p xoá chươ ch ươ ng ng trình bằ bằng điện đến đến 10.000 lầ lần 128 Byte RAM nộ n ội 4 Port xuấ xuất/nh t/nhậậ p 8 bit Từ 2 đến đến 3 bộ bộ định định thờ thờ i 16-bit Có khả khả năng giao tiế ti ế p truyề truy ền dữ dữ liệ liệu nố nối tiế tiế p Có thể thể mở r ở r ộng không gian nhớ nh ớ ch chươ ươ ng ng trình ngoài 64KByte (bộ (b ộ nhớ nhớ ROM ROM ngoạ ngoại): khi chươ ng ng trình do ng ườ ng l ớ ng bộ nhớ ROM ườ i l ậ p trình vi ế t ra có dung l ượ ượ ng ớn hơ n dung l ượ ượ ng nội, để l ư ng trình này c ần b ộ nhớ ROM l ớ n, cách gi ải quyế t là k ế ưu đượ c ch ươ ng ớn h ơ n, ế t n ố i ừ bên ngoài (hay còn g ọi là ROM ngo ại). Dung l ượ ượ ng Vi đ iề u khiể n vớ i bộ nhớ ROM t ừ ng bộ nhớ ROM ngoại l ớ ớn nhấ t mà Vi đ iề u khiể n có thể k ế ết nố i là 64Kbyte
Có thể thể mở r ở r ộng không gian nhớ nh ớ ddữ liệ liệu ngoài 64KByte (bộ (b ộ nhớ nhớ RAM RAM ngoạ ngoại) Bộ xử lí bit (thao tác trên các bit riêng r ẽ r ẽ) 210 bit có thể th ể truy xuấ xuất đến đến từ từng bit
ơ đồ đồ chân 1.2.1. Khảo sát sơ Mặc dù các thành viên củ c ủa họ họ MSC-51 có nhiề nhiều kiể kiểu đóng vỏ vỏ khác nhau, chẳ ch ẳng hạ hạn như như hai hàng chân DIP (Dual In-line Pakage) dạ d ạng vỏ dẹt vuông QFP (Quad Flat Pakage) và d ạng chíp không có chân đỡ LLC (Leadless Chip Carrier) và đều đều có 40 chân cho các chứ ch ức năng khác nhau như như vào ra I/0, đọc, đọc, ghi, địa địa chỉ chỉ, dữ dữ liệ liệu và ngắ ngắt. Tuy nhiên, vì hầ h ầu hế hết các nhà phát triể tri ển chính dùng chíp đóng vỏ vỏ 40 chân vớ v ớ i hai hàng chân DIP, nên chúng ta cùng kh ảo sát Vi điều khiể khiển vớ vớ i 40 chân dạng DIP.
Hình 1.1 - Chân VCC : Chân số số 40 là VCC cấ cấ p điện áp nguồ ngu ồn cho Vi điều khiể khiển. Nguồ Nguồn điện cấ c ấ p là +5V±0.5. - Chân GND: GND: Chân số số 20 nố n ối GND(hay nố nối Mass). Khi thiế t k ế ế cần s ử d ụng m ột mạch ổ n
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Chứ Chức năng là bus dữ dữ liệ liệu và bus địa địa chỉ chỉ (AD7-AD0) : 8 chân này (ho ặ c Port 0) còn làm nhiệm vụ l ấ ấ y d ữ ữ liệu t ừ ừ ROM hoặ c RAM ngoại (nế u có k ế ế t nố i v ớ i b ộ nhớ ngoài), đồng thờ i Port 0 để định địa chỉ của bộ nhớ ngoài. còn đượ c dùng để đị
- Port 1 (P1) Port 1 gồ gồm 8 chân (từ (t ừ chân 1 đến đến chân 8), chỉ ch ỉ có chứ chức năng làm các đườ ng ng xuấ xuất/nh t/nhậậ p, không có chứ ch ức nă năng khác. - Port 2 (P2) Port 2 gồ gồm 8 chân (từ (từ chân 21 đến đến chân 28) có hai chứ ch ức nă năng: Chứ Chức nă năng xuấ xuất/nh t/nhậậ p Chứ Chức nă năng là bus địa địa chỉ chỉ cao (A8-A15): khi k ết nố nối vớ vớ i bộ bộ nhớ nhớ ngoài ngoài có dung lượ l ượ ng ng lớ lớ n, n, cầ cần 2 byte để định định địa địa chỉ chỉ của bộ bộ nhớ nhớ , byte thấ thấ p do P0 đảm đảm nhậ nhận, byte cao do P2 này đảm đảm nhậ nhận. - Port 3 (P3) Port 3 gồ gồm 8 chân (từ (từ chân 10 đến đến 17): Chứ Chức nă năng xuấ xuất/nh t/nhậậ p Vớ i mỗ mỗi chân có mộ m ột chứ chức nă năng riêng thứ thứ hai như như trong bả bảng sau
Bit P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 P1.0 P1.1
Tên RxD TxD INT0 INT1 T0 T1 WR RD T2 T2X
Chứ c năng Ngõ vào nhậ nh ận dữ dữ liệ liệu nố nối tiế tiế p Ngõ xuấ xuất dữ dữ liệ liệu nố nối tiế tiế p Ngõ vào ngắ ngắt cứ cứng thứ thứ 0 Ngõ vào ngắ ngắt cứ cứng thứ thứ 1 Ngõ vào của Timer/Counter thứ th ứ 0 Ngõ vào của Timer/Counter thứ th ứ 1 Ngõ điều khiể khiển ghi dữ dữ liệ liệu lên bộ b ộ nhớ nhớ ngoài ngoài Ngõ điều khiể khiển đọc đọc dữ dữ liệ liệu từ từ bộ nhớ nhớ bên bên ngoài Ngõ vào của Timer/Counter thứ th ứ 2 Ngõ nạ p lạ lại/thu nhậ nhận củ của Timer/Counter thứ th ứ 2
- Chân RESET (RST) Ngõ (RST) Ngõ vào RST ở chân ở chân 9 là ngõ vào Reset dùng để thiế thiết lậ l ậ p tr ạng thái ban đầu đầu cho vi điều khiể khiển. Hệ Hệ thố thống sẽ sẽ đượ c thiế thiết lậ lậ p lạ lại các giá tr ị ban đầu đầu nế nếu ngõ này ở m ở mức 1 tố tối thiể thiểu 2 chu kì máy. - Chân XTAL1 và XTAL2 Hai chân này có vị v ị trí chân là 18 và 19 đượ c sử dụng để nhậ nhận nguồ nguồn xung clock từ t ừ bên ngoài để hoạ hoạt động, động, thườ thườ ng ng đượ c ghép nố nối vớ v ớ i thạ th ạch anh và các tụ t ụ để tạo nguồ nguồn xung clock ổ clock ổn định. định. - Chân cho phép bộ nhớ chươ ng ng trình PSEN (Program PSEN (Program Store Enable) tín hiệ hi ệu đượ c xuấ xuất ra ở chân 29 dùng để truy xuấ xuất bộ nhớ nhớ ch chươ ươ ng ng trình ngoài. Chân này th ườ ng ng đượ c nối vớ i chân OE (output enable) củ c ủa ROM ngoài. Khi vi điều khiể khiển làm việ việc vớ i bộ nhớ nhớ chươ chươ ng ng trình ngoài, chân này phát ra tín hi ệu kích hoạ hoạt ở m ở mức thấ thấ p và đượ c kích hoạ hoạt 2 lầ lần trong mộ một chu kì máy. Khi thự thực thi mộ một chươ chươ ng ng trình ở ROM nộ nội, chân này đượ c duy trì ở mức logic không tích cực (logic (logic 1) (Không cần k ết nố nối chân này khi không sử s ử dụng đến) đến) - Chân ALE (chân ch ốt địa địa chỉ ch ỉ-chân 30) có chứ ch ức năng là bus dữ d ữ liệ liệu do đó phả phải ALE (chân cho phép chố tách các đườ ng ng dữ dữ liệ liệu và địa địa chỉ chỉ. Tín hiệ hiệ ở chân ở chân ALE dùng làm tín hiệ hi ệ điều khiể khiể để giả giải đa hợ hợ
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
- Chân EA Chân EA dùng để xác định chươ ng ng trình thực hiện đượ c lấy từ ROM nội hay ROM ngoại.
Khi EA nố nối vớ vớ i logic 1(+5V) thì Vi điều khiể khiển thự thực hiệ hiện chươ chươ ng ng trình lấ lấy từ từ bộ nhớ nhớ nnội Khi EA nố nối vớ vớ i logic 0(0V) thì Vi điều khiể khiển thự thực hiệ hiện chươ chươ ng ng trình lấ lấy từ từ bộ nhớ nhớ ngo ngoạại
1.2.2 K ết nối phần cứ ng ng 1. K ết nối trên hai chân XTAL1 và XTAL2. Mạch dao động động đượ c đưa đưa vào hai chân này thông th thườ ườ ng ng đượ c k ết nố nối vớ vớ i dao động động thạ thạch anh như như sau:
Hình 1.2
Hình 1.3
Ghi chú: C1,C2= 30pF±10pF (thườ (th ườ ng ng đượ c sử dụng vớ i C1,C2 là tụ t ụ 33pF) dùng ổn định định dao động động cho thạ thạch anh. Hoặ Hoặc có thể thể cấ p tín hiệ hiệu xung clock lấ l ấy từ từ một mạ mạch tạ tạo dao động động nào đó và đưa đưa vào Vi điều khiể khiển theo hình 1.3. Trong đó NC: để tr ống, chân XTAL2 để tr ống
2. Chu kì máy Gọi f zat là tầ tần số số dao động động củ của thạch anh. Đối Đối vớ vớ i 89Sxx có thể th ể sử dụng thạ thạch anh có tầ t ần số số đến 33MHz. f zat từ 2MHz đến Chu kì máy là khoả kho ảng thờ thờ i gian cầ c ần thiế thiết đượ c qui định định để Vi điều khiể khiển thự thực hiệ hiện hoàn thành mộ một lệ lệnh cơ cơ bbản. Mộ Một chu kì máy bằ b ằng 12 lầ lần chu kì dao động động củ của nguồ nguồn xung dao động động cấ cấ p cho nó. Tck = 12.Toc Vớ i:i: Tck là chu kì máy c ủa nguồ nguồn xung dao động động cấ cấ p cho Vi điều khiể khiển Toc là chu kì củ
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
3. K ết nối chân RESET-chân 9 Khi bị bị cúp điện, hoặ hoặc đang hoạ hoạt động động mà hệ hệ thố thống bị lỗi cần tác động động cho Vi điều khiể khiển hoạ hoạt động động tr ở l ở lại, hoặ hoặc do ngườ ngườ i sử s ử dụng muố muốn quay về về tr ạng thái hoạ ho ạt động động ban đầu. đầu. Vì vậ vậy chân RESET đượ c k ết nố nối như như sau: Vớ i Vi điều khiể khiển sử sử dụng thạ thạch anh có tầ t ần số số f zat = 12MHz sử sử dụng C=10µF và R=10K Ω.
Hình 1.4
4. K ết nối các Port vớ i Led. Các Port khi xuấ xu ất tín hiệ hiệu ở mức logic 1 thườ th ườ ng ng không đạt đạt đến đến 5V mà dao động động trong khoả khoảng từ từ 3.5V đến đến 4.9V và dòng xuấ xu ất ra r ất nhỏ nhỏ dướ i 5mA ( P0,P2 P0,P2 dòng xu ấ t khoảng 1mA; P1,P3 vậy dòng xuấ xuất này không đủ để có thể thể làm led sáng dòng xuấ t ra khoảng 1mA đế n 5mA) vì vậ Tuy nhiên khi các Port xu ất tín hiệu ở mức logic 0 dòng điện cho phép đi qua lớ n hơ n r ất nhiều:
Chân Vi điều khiể khiển khi ở m ở mức 0: ớn nhấ t qua P0 : -25mA Dòng l ớ ớn nhấ t qua P1,P2,P3 : -15mA Dòng l ớ
Do đó khi k ết nố nối vớ vớ i led hoặ hoặc các thiế thiết bị bị khác Vi điều khiể khiển sẽ sẽ gặ p tr ở ng ở ngạại là nế nếu tác động động làm led sáng khi Vi điều khiể khiển xuấ xuất ở m ở mức 1, lúc này dòng và áp ra không đủ để led có thể thể sáng rõ (led đỏ sáng ở đ ở điện áp 1.6V-2.2V và dòng trong khoả kho ảng 10mA). Khắ Khắc phụ phục bằ bằng cách sau:
a. Cho led sáng khi Vi đ i iề ề u khi ể ển ở mứ c 0: Px.x thay cho các chân xu ất củ của các Port. Ví dụ d ụ: Chân P1.1, P2.0, v.v... Khi Px.x ở ức 1 led không sáng
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Tuỳ Tuỳ từng tr ườ ườ ng ng hợ hợ p mà chọ chọn R2 để dòng và áp phù hợ h ợ p vớ vớ i thiế thiết bị bị nhậ nhận. Khi Px.x ở m ở mức 0, có sự sự chênh lệ lệch áp giữ gi ữa nguồ nguồn VCC và chân Px.x - dòng điện đi từ từ VCC qua R2 và Px.x về v ề Mass, do đó hiệ hiệu điện thế thế giữ giữa hai chân led gầ g ần như như bằng 0, led không sáng. Khi Px.x ở m ở mức 1 (+5V), dòng điện không chạ chạy qua chân Vi điều khiể khiển để về mass đượ c, c, có sự lệch áp giữ giữa hai chân led, dòng điện trong tr ườ ườ ng ng hợ hợ p này qua led về về Mass do đó led sáng. R2 thườ thườ ng ng đượ c sử s ử dụng vớ v ớ i giá tr ị từ 4.7K Ω đến đến 10K Ω. Nếu tất cả c ả các chân trong 1 Port đều đều k ết nố n ối để tác động động ở m ở mức cao thì điện tr ở R2 ở R2 có thể thể thay bằ bằng điện tr ở thanh ở thanh 9 chân vì nó có hình dáng và sử s ử dụng dễ dễ hơ n khi làm mạ m ạch điện. c. Ngoài c. Ngoài cách s ử d ụng đ i i ệ việc sử sử dụng cổ ng dụng thay đổi đổi ng đệm cũng có tác dụ ện tr ở ở treo, treo, việ cườ ng ng độ dòng điện xuấ xuất ra khi ngõ ra ở m ở mức 1, cổ cổng đệm đệm xuấ xuất ra tín hiệ hiệu ở m ở mức 1 vớ vớ i áp và dòng lớ n khi có tín hiệ hi ệu mứ mức 1 đặt đặt ở ngõ ở ngõ vào. Tùy theo yêu cầ c ầu củ của ngườ ngườ i thiế thiết k ế về dòng và áp cầ c ần thiế thiết mà chọ chọn IC đệm đệm cho phù hợ h ợ p. Chẳ Ch ẳng hạ hạn từ từ một ngõ ra P0.0 làm nhiề nhi ều led sáng cùng lúc thì việ việc sử sử dụng IC đệm đệm đượ c ưu tiên hơ hơ n. n. Có thể thể sử dụng 74HC244 hoặ ho ặc 74HC245, tuy nhiên 74HC245 đượ c cả cải tiế tiến từ từ 74HC244 nên việ việc sử sử dụng 74HC245 dễ dễ dàng hơ hơ n trong thiế thi ết k ế mạch.
Hình 1.7
1.3
CẤU TRÚC BÊN TRONG C ỦA VI ĐIỀU KHIỂN
1.3.1 Bộ nhớ chươ ng ng trình - bộ nhớ ROM Bộ nhớ nhớ ROM ROM dùng để lưu chươ ch ươ ng ng trình do ngườ ng ườ i viế vi ết chươ ch ươ ng ng trình viế vi ết ra. Chươ Chươ ng ng trình là tậ p hợ p các câu lệ lệnh thể thể hiệ hiện các thuậ thuật toán để giả giải quyế quyết các công việ vi ệc cụ thể thể, chươ chươ ng ng trình do
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
ROM, chươ chươ ng ng trình đượ c lưu sẽ bị mất khi địa địa chỉ chỉ lưu vượ t qua vùng này. Ví dụ d ụ: AT89S52 có 8KByte bộ bộ nhớ nhớ ROM ROM nộ nội, địa địa chỉ chỉ lớ n nhấ nhất là 1FFFH, nế n ếu chươ chươ ng ng trình viế vi ết ra có dung lượ l ượ ng ng lớ l ớ n hơ n 8KByte các byte trong các địa địa chỉ chỉ lớ n hơ hơ n 1FFFH sẽ sẽ bị mất. Ngoài ra Vi điều khiể khiển còn có khả kh ả năng mở mở r r ộng bộ bộ nhớ nhớ ROM ROM vớ vớ i việ việc giao tiế tiế p vớ vớ i bộ bộ nhớ nhớ ROM bên ngoài lên đến đến 64Kbyte (đị ( địaa chỉ chỉ từ 0000H đến đến FFFFH).
1.3.2 Bộ nhớ dữ liệu- bộ nhớ RAM Bộ nhớ nhớ RAM RAM dùng làm môi tr ườ ườ ng ng xử xử lý thông tin, lư l ưu tr ữ các k ết quả quả trung gian và k ết quả quả cuố cuối cùng củ của các phép toán, xử x ử lí thông tin. Nó cũ c ũng dùng để tổ chứ chức các vùng đệm đệm dữ dữ liệ liệu, trong các thao tác thu phát, chuy ển đổi đổi dữ dữ liệ liệu. RAM nộ nội trong Vi điều khiể khiển đượ c tổ tổ chứ chức như như sau:
Các vị trí trên RAM đượ c định địa chỉ theo từng Byte bằng các số thậ p lục phân (số Hex)
Các bank thanh ghi có địa địa chỉ chỉ 00H đến đến 1FH 210 vị vị trí đượ c định định địa địa chỉ chỉ bit các vị vị trí RAM bình thườ thườ ng ng Các thanh ghi có chứ ch ức nă năng đặc đặc biệ biệt có địa địa chỉ chỉ từ 80H đến đến FFH.
Các byte RAM 8 bit củ c ủa vi điều khiể khiển đượ c gọ gọi là " ô nhớ " nếu các ô nhớ nh ớ có có chứ chức nă năng đặc đặc ", nế biệ biệt thườ thườ ng ng đượ c gọ gọi là " thanh thanh ghi " nếu là bit thì đượ c gọ gọi là "bit nhớ ". " , nế
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
CẤU TRÚC BỘ NHỚ RAM BÊN TRONG VI ĐIỀU KHIỂN Địa chỉ byte
Địa chỉ bit
7F 30
Vùng RAM bình thườ ng ng
2F 2E 2D 2C 2B 2A 29 28 27 26 25 24
7F 77 6F 67 5F 57 4F 47 3F 37 2F
7E 76 6E 66 5E 56 4E 46 3E 36 2E
7D 75 6D 65 5D 55 4D 45 3D 35 2D
7C 74 6C 64 5C 54 4C 44 3C 34 2C
7B 73 6B 63 5B 53 4B 43 3B 33 2B
7A 72 6A 62 5A 52 4A 42 3A 32 2A
Địa chỉ Địa chỉ bit byte FF F0 F7 F6 F5 F4 F3 F2 F1 F0
79 71 69 61 59 51 49 41 39 31 29
78 70 68 60 58 50 48 40 38 30 28
Ký hiệu B
E0
E7 E6 E5 E4 E3 E2 E1 E0
ACC
D0
D7 D6 D5 D4 D3 D2 D1 D0
PSW
B8
-
-
-
BC BB BA B9 B8
IP
B0
B7 B6 B5 B4 B3 B2 B1 B0
P3
A8
AF
AC AB AA A9 A8
IE
A0
A7 A6 A5 A4 A3 A2 A1 A0
P2
23 22
27 26 25 24 23 22 21 20 1F 1E 1D 1C 1B 1A 19 18 17 16 15 14 13 12 11 10
99 98
21
0F 0E 0D 0C 0B 0A 09
90
P1
20
07 06 05 04 03 02 01 00 8D
TH1
8C
TH0
18
8B
TL1
17
8A
TL0
89 88 87
TMOD TCON PCON
1F Bank 3
10
Bank 2
08
97
96
95 94
93
92 91
90
8F 8E 8D 8C 8B 8A 89 88
SBUF SCON
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
1. Các bank thanh ghi Các bank thanh ghi có địa địa chỉ ch ỉ byte từ từ 00H÷1FH, có 8 thanh ghi trong mỗ m ỗi bank, các thanh ghi đượ c đặt đặt tên từ t ừ R0÷R7, các thanh ghi này đượ c đặt đặt mặ mặc định định trong bank 1. Có 4 bank thanh ghi và tạ tại mỗ mỗi thờ thờ i điểm chỉ chỉ có mộ một bank thanh ghi đượ c truy xuấ xuất vớ vớ i các thanh ghi từ t ừ R0÷R7, để thay đổi đổi việ việc truy xuấ xuất các thanh ghi trên các bank thanh ghi, ng ườ i dùng phả phải thay đổi đổi giá tr ị các bit chọ chọn bank trong thanh ghi tr ạ tr ạng thái PSW bằ b ằng các câu lệ l ệnh trong chươ chươ ng ng trình. Các lệ lệnh dùng các thanh ghi từ t ừ R0 ÷ R7 mấ mất khoả khoảng không gian lư l ưu tr ữ ít hơ h ơ n và thờ thờ i gian thự thực hiệ hiện nhanh hơ hơ n so vớ vớ i các lệ lệnh dùng các ô nhớ nh ớ RAM RAM khác, ngoài ra các thanh ghi này còn có thêm mộ một số s ố chứ chức nă n ăng đặc đặc biệ bi ệt khác, vì lí do này các dữ d ữ liệ liệu sử s ử dụng thườ thườ ng ng thườ thườ ng ng đượ c ngườ ng ườ i viế viết chươ chươ ng ng trình đưa đưa vào lư lưu trong các thanh ghi này. Ngoài ra, có thể th ể truy xuấ xuất thanh ghi trên các bank thanh ghi nh ư vớ i các ô nhớ nh ớ bình bình thườ thườ ng ng khác. Ví dụ dụ: nguờ nguờ i dùng có thể th ể truy xuấ xuất đến đến thanh ghi R7 bằ b ằng ô nhớ nhớ 07H. 07H.
2. Vùng RAM truy xu ất từ ng ng bit Trên RAM nội có 210 ô nhớ bit đượ c định địa chỉ và có thể truy xuất đến từng bit, các bit nhớ này cũng đượ c định địa chỉ bằng các số thậ p l ục phân- số Hex. Trong đó có 128 bit nằm trong các ô nhớ có địa chỉ byte từ 20H đến 2FH, các bit nhớ còn lại ch ứa trong nhóm thanh ghi có chức năng đặc biệt.
M ặ ng s ố Hex, tuy nhiên chúng s ẽ đượ ặc dù các bit nh ớ và ô nhớ (byte) cùng đượ c định b ằ ng ẽ đượ c ươ ng nhận d ạng là địa ch ỉ bit hay địa ch ỉ byte thông qua các câu l ệnh t ươ ng ứ ng ng dành cho các bit nh ớ hoặ c các ô nh ớ này.
Ví dụ dụ: mov 05H,#10111111B 05H,#10111111B 05H,nhan01
; >>> l ệnh này thiế thi ết lậ lậ p giá tr ị cho ô nhớ có địa địa chỉ chỉ là 05H l nh này liên quan đế ng thái c địa địa ch
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
c. Thanh ghi B Thanh ghi B ở đị ở địaa chỉ ch ỉ F0H, đượ c dùng vớ vớ i thanh ghi A để thự thực hiệ hi ện các phép toán số s ố học. Khi thự thực hiệ hiện lệ lệnh chia vớ vớ i thanh ghi A, số s ố dư đượ c lư lưu tr ữ ở thanh ở thanh ghi B. Ngoài ra thanh ghi B còn đượ c dùng như như một thanh ghi đệm đệm có nhiề nhiều chứ chức nă năng. địa chỉ chỉ 81H 5. Con trỏ ngăn xếp SP: địa Con tr ỏ ngă ngăn xế p SP là mộ một thanh ghi có địa địa chỉ chỉ 81H, giá tr ị của nó đượ c tăng, giả giảm tự động động khi thự thực hiệ hiện các lệ lệnh PUSH, CALL, POP con tr ỏ SP dùng quả qu ản lí và xử x ử lí các nhóm dữ d ữ liệ liệu liên tụ tục.Giá tr ị mặc định định củ của SP là 07H.
6. Con trỏ dữ liệu DPTR. Con tr ỏ dữ liệ liệu DPTR là thanh ghi 16 bit duy nh ất củ c ủa Vi điều khiể khiển đượ c tạ t ạo thành từ t ừ hai thanh ghi DPL (byte thấ th ấ p-đị p-địaa chỉ chỉ byte 82H) và DPH (byte cao-đị cao- địaa chỉ chỉ byte 83H). Hai thanh ghi DPL và DPT có thể th ể truy xuấ xuất độc độc lậ p bở i ngườ ngườ i sử dụng. Con tr ỏ dữ liệ liệu DPTR thườ thườ ng ng đượ c sử dụng khi truy xuấ xu ất dữ dữ liệ liệu từ từ bộ nhớ nhớ ROM ROM hoặ hoặc bộ bộ nhớ nhớ ttừ bên ngoài. địa chỉ chỉ byte D0H) 7. Thanh ghi tr ạng thái chươ ng ng trình PSW (địa
BIT ĐỊA CHỈ BIT KÍ HIỆU PSW.7 D7H C hoặ hoặc Cy PSW.6 D6H AC PSW.5 D5H F0 PSW.4 D4H RS1 PSW.3 D3H RS0 PSW.2
D2H
0V
CHỨ C NĂNG ờ nhớ C ờ ờ nhớ phụ C ờ ờ 0 hay cờ Zero C ờ ựa chọn dãy thanh ghi Bit l ự ựa chọn dãy thanh ghi Bit l ự ờ tràn vớ i phép tính liên quan đế n số nhị phân có C ờ d ấ ấu ế ế để ế để
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Các bit ch ọn bank thanh ghi:
Hai bit RS1 và RS2 dùng để xác lậ lậ p bank thanh ghi đượ c sử sử dụng, mặ mặc định định RS1=0 và RS2=0
RS1
RS2
0 0 1 1
0 1 0 1
Bank thank ghi đượ c sử dụng Bank 0 Bank 1 Bank 2 Bank 3
ờ tràn OV C ờ
Đượ c sử s ử dụng trong các phép toán cộ c ộng có dấ dấu, vớ v ớ i các phép toán cộ c ộng không dấ dấu cờ c ờ tràn tràn OV đượ c bỏ bỏ qua, không cầ cần quan tâm đến đến OV. Nế Nếu: Phép cộ cộng hai số số có dấ dấu lớ lớ n hơ hơ n +127 thì OV=1 Hoặ Hoặc phép tr ừ hai số số có dấ dấu nhỏ nhỏ hơ n -127 thì OV=1 Các tr ườ ườ ng ng hợ hợ p còn lạ lại OV=0 ờ chẵ n l ẻ C ờ
Cờ ch ờ chẵẵn lẻ l ẻ P tự t ự động động đượ c đặt đặt bằ b ằng 1 hoặ hoặc 0 sao cho tổ t ổng số s ố bit mang giá tr ị 1 trên thanh ghi A vớ vớ i cờ cờ P P luôn là mộ một số số chẵ chẵn. Cờ Cờ ch chẵẵn lẻ lẻ đượ c dùng để xử lí dữ dữ liệ liệu tr ướ ướ c khi truyề truy ền đi theo kiể kiểu nối tiế tiế p hoặ hoặc xử lí dữ d ữ liệ liệu tr ướ ướ c khi nhậ nhận vào theo kiể ki ểu nối tiế tiế p (hạ (hạn chế chế lỗi phát sinh trong quá trình truyề truy ền).
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
BÀI 2: LẬP TRÌNH CHO VI ĐIỀU KHIỂN 2.1
GIỚ I THIỆU
Vi điều khiể khiển là mộ một IC lậ lậ p trình, vì vậ v ậy Vi điều khiể khiển cầ cần đượ c lậ lậ p trình tr ướ ướ c khi sử sử dụng. Mỗi phầ phần cứ cứng nhấ nhất định định phả phải có chươ chươ ng ng trình phù hợ h ợ p kèm theo, do đó tr ướ ướ c khi viế viết chươ chươ ng ng trình đòi hỏi ngườ ngườ i viế viết phả phải nắm bắt đượ c cấu tạo phầ phần cứng và các yêu cầ c ầu mà mạ mạch điện cần thự thực hiệ hiện. Chươ Chươ ng ng trình là tậ t ậ p hợ hợ p các lệ lệnh đượ c tổ tổ chứ chức theo mộ một trình tự tự hợ p lí để giả giải quyế quyết các yêu cầu củ c ủa ngườ ng ườ i lậ l ậ p trình. Tậ Tậ p hợ h ợ p tấ t ất cả c ả các lệ lệnh gọ g ọi là tậ tậ p lệ l ệnh. Họ Họ Vi điều khiể khiển MSC-51 đều đều có chung mộ một tậ p lệnh, các Vi điều khiể khiển đượ c cải tiế tiến sau này thườ thườ ng ng ít thay đổi đổi hoặ hoặc mở r ộng tậ p lệnh mà chú tr ọng phát triể tri ển phầ phần cứ cứng. Lệnh củ c ủa Vi điều khiể khiển là các số số nhị nhị phân 8 bit hay còn gọ g ọi là mã máy. Các lệ l ệnh mang mã 00000000b đến đến 11111111b. Các mã lệ l ệnh này đượ c đưa đưa vào lư lưu tr ữ trong ROM, khi thự th ực hiệ hiện chươ chươ ng ng trình Vi điều khiể khiển đọc đọc các mã lệ l ệnh này, giả gi ải mã, và thự th ực hiệ hiện lệ lệnh. Vì các lệ lệnh củ c ủa Vi điều khiể khiển có dạ dạng số s ố nhị nhị phân quá dài và khó nh ớ , hơ h ơ n nữ nữa việ vi ệc gỡ gỡ llỗi khi chươ chươ ng ng trình phát sinh lỗ l ỗi r ất phứ phức tạ tạ p và khó khă khăn. Khó khă khăn này đượ c giả giải quyế quyết vớ vớ i sự sự hỗ tr ợ ợ của máy vi tính, ngườ ng ườ i viế vi ết chươ ch ươ ng ng trình có thể th ể viế viết chươ ch ươ ng ng trình cho vi điều khiể khiển bằ b ằng các ngôn ngữ ngữ lậ p trình cấ cấ p cao, sau khi việ việc viế viết chươ chươ ng ng trình đượ c hoàn tấ tất, các trình biên dị d ịch sẽ chuyể chuyển các câu lệ l ệnh cấ cấ p cao thành mã máy mộ một cách tự t ự động. động. Các mã máy này sau đó đượ c đưa đưa (nạ (nạ p) vào bộ bộ nhớ nhớ ROM củ của Vi điều khiể khiển, Vi điều khiể khiển sẽ tìm đến đến đọc đọc các lệ lệnh từ ROM để thự thực hiệ hiện chươ chươ ng ng trình. Bả Bản thân máy tính không thể th ể thự thực hiệ hiện các mã máy này vì chúng không phù h ợ p vớ vớ i phầ phần cứ cứng máy tính, muố mu ốn thự thực hiệ hiện phả phải có các chươ chươ ng ng trình mô phỏ ph ỏng dành riêng.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
2.3
MỘT SỐ QUI ƯỚ C KHI LẬP TRÌNH VỚ I HỢ P NGỮ ASSEMBLER
1. Khi giớ giớ i thiệ thiệu các câu lệ l ệnh viế viết bằ b ằng hợ h ợ p ngữ ngữ, các câu lệ l ệnh cầ cần đượ c bao quát tấ t ất cả c ả các tr ườ ườ ng ng hợ hợ p do đó có mộ một số số qui ướ c khi thiế thiết lậ lậ p cú pháp các lệ l ệnh như như sau:
Tên qui ướ c Rn
#data
direct
@Ri
Tên qui ướ c đại diện cho
Ví dụ Lệnh sử dụng tên qui ướ c
Ví dụ khi sử dụng
Các thanh ghi ở các ở các Bank thanh ghi Khi sử sử dụng thay n bằ bằng các số s ố từ 0 đến đến 7: Mov A,Rn R0, R1, R2, R3, R4, R5, R6, R7 Dữ liệ liệu 8 bit, khi s ử dụng data có thể th ể viế viết dướ i dạ dạng : số nhị nhị phân (Vd: #00110011b) Mov A,#data số thậ thậ p lụ lục phân (Vd: #0A6H) số thậ thậ p phân (Vd: #21) Ô nhớ có đị a chỉ là direct , direct đượ c thay bằ bằng địa địa chỉ chỉ từ 00H đến đến FFH khi viế viết Mov A,direct chươ chươ ng ng trình.
Mov A,#20H
Ô nhớ có đị a chỉ gián ti ế p , đây là địa địa chỉ chỉ ế p, của mộ một ô nhớ nhớ , địa địa chỉ chỉ này đượ c xác định định gián tiế tiế p bằ bằng giá tr ị của thanh ghi R0 hoặ ho ặc Mov A,@Ri R1 (chỉ (chỉ đượ c sử sử dụng hai thanh ghi R0 hoặ ho ặc R1 để lưu giá tr ị này)
Mov A,@R1
Mov A,R2
Mov A,30H
thiết lậ p trong mộ một ô nhớ nhớ , data đượ c ghi trong chươ ch ươ ng ng trình assembly #data: là giá tr ị cần thiế vớ i qui định định về v ề cách viế viết số như như ở bên ở bên dướ dướ i,i, các số số này sau đó đượ c trình biên dị d ịch chuyể chuyển thành các số số nhị nhị phân t ứ
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
riêng cho mộ một công việ vi ệc nào đó, việ việc ghi nhớ nhớ bbằng số số nhị nhị phân r ất r ắc r ối và khó nhớ nhớ , khi đó số số hex đượ c sử sử dụng, vì số s ố hex là cách viế vi ết ngắ ngắn gọ gọn củ của số số nhị nhị phân.
Ví dụ: 69H, 0A3H Số Decimal (số (số thậ thậ p phân): Số Số thậ thậ p phân khi viế viết không cầ c ần cầ c ần thêm kí tự t ự hoặ hoặc thêm sau giá tr ị bằng kí tự tự "D". Khi tính toán: cộ c ộng tr ừ nhân chia, nế n ếu sử s ử dụng số s ố nhị nhị phân hoặ hoặc số hex sẽ sẽ gây khó khă khăn cho ngườ ngườ i viế viết chươ chươ ng ng trình, trong tr ườ ườ ng ng hợ hợ p này số số thậ thậ p phân đượ c sử sử dụng
Ví dụ: 45, 27, 68D Chú ý: địa địa chỉ chỉ của các ô nhớ nh ớ , củ của các bit nhớ nh ớ , địa địa chỉ chỉ của ROM luôn đượ c viế viết bằ bằng số số thậ thậ p lục phân và cũ c ũng tuân theo qui tắ t ắc viế viết số số như như phía trên. Để hiể hiểu thêm về về các loạ loại số số này và các cách chuyể chuy ển đổi đổi có thể th ể xem thêm trong giáo trình k ĩ thuậật số thu s ố tại địa địa chỉ ch ỉ http://www.codientu.info/ki_thuat_cdt/dien_tu/vi_mach_so/ hoặ hoặc các tài liệ li ệu về về k ĩ thu ĩ thuậật số số khác.
3. K ết thúc chươ ng ng trình. Sau khi chươ chươ ng ng trình hoàn tấ t ất phả ph ải k ết thúc bằ bằng câu lệ lệnh END nh END.. Các câu lệ lệnh này báo cho trình biên dị dịch biế biết phầ ph ầ k ết thúc củ củ ch ng trình, trình biên dị d ịch bỏ qua tấ tất ả các câu lệ l ệnh sau
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
2. Lệnh chuyển dữ liệu từ ô nhớ có địa chỉ direct vào thanh ghi A: Cú pháp: Mov A,direct Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 2 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: chuyể chuyển dữ dữ liệ liệu củ của ô nhớ nhớ có có địa địa chỉ chỉ bằng direct vào thanh ghi A. Ví dụ dụ: Giả Giả sử thanh ghi có địa địa chỉ chỉ 33H mang dữ dữ liệ liệu vớ vớ i giá tr ị là 09H (00001001B) Lệnh Mov A,33H Sau khi lệ lệnh đượ c thự thực hiệ hiện A mang dữ d ữ liệ liệu giá tr ị 09H
3. Lệnh chuyển dữ liệu từ ô nhớ có địa chỉ gián tiếp vào thanh ghi A: Cú pháp: Mov A,@Ri Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 1 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: chuyể chuyển dữ dữ liệ liệu củ của ô nhớ nhớ 'có 'có địa địa chỉ chỉ bằng giá tr ị của thanh ghi Ri' vào thanh ghi A. Ví dụ dụ: Giả Giả sử tr ướ ướ c khi thự thực hiệ hiện lệ lệnh ô nhớ nhớ có có địa địa chỉ chỉ 33H mang dữ dữ liệ liệu vớ vớ i giá tr ị là 09H (00001001B) và thanh ghi R1 đượ c thiế thiết lậ lậ p giá tr ị là 33H.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: chuyể chuyển dữ dữ liệ liệu củ của ô nhớ nhớ có có địa địa chỉ chỉ direct vào thanh ghi Rn (n=0-7) Ví dụ dụ: giả giả sử ô nhớ nhớ 55H 55H mang dữ dữ liệ liệu có giá tr ị là A3H Mov R4,55H Sau khi các lệ l ệnh đượ c thự thực hiệ hiện R4 mang giá tr ị là A3H
7. Thiết đặt dữ liệu cho thanh ghi Rn Cú pháp: Mov Rn,#data Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 2 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: thiế thiết đặt đặt dữ dữ liệ liệu cho thanh ghi Rn Ví dụ dụ: Muố Muốn thanh ghi Rn mang dữ d ữ liệ liệu có giá tr ị là 37H ta thự th ực hiệ hiện lệ lệnh Mov A,#37H Sau khi lệ lệnh đượ c thự thực hiệ hiện A mang giá tr ị là 37H
8. Lệnh chuyển dữ liệu từ thanh ghi A vào m ột ô nhớ có địa chỉ direct Cú pháp:
Mov
direct,A
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
11. Lệnh đư a dữ liệu vào ô nh ớ có địa chỉ direct Cú pháp: Mov direct,#data Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 3 Byte Thờ Thờ i gian thự thực hiệ hiện: 2 chu kì máy Công dụ dụng: thiế thiết lậ lậ p dữ dữ liệ liệu cho ô nhớ nh ớ có có địa địa chỉ chỉ direct Ví dụ dụ: Mov 52H,#43H Sau khi các lệ l ệnh đượ c thự thực hiệ hiện ô nhớ nhớ 52H 52H mang giá tr ị là 43H
12. Lệnh chuyển dữ liệu từ một ô nhớ có địa chỉ gián tiếp vào ô nh ớ có địa chỉ direct Cú pháp: Mov direct,@Ri Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 2 Byte Thờ Thờ i gian thự thực hiệ hiện: 2 chu kì máy Công dụ dụng: Chuyể Chuyển dữ dữ liệ liệu củ của ô nhớ nhớ có có địa địa chỉ chỉ bằng giá tr ị của thanh ghi Ri vào ô nh ớ có ớ có địa địa chỉ chỉ direct Ví dụ dụ: Mov 30H,#46H
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 2 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: Thiế Thiết đặt đặt dữ dữ liệ liệu cho ô nhớ nh ớ có có địa địa chỉ chỉ bằng giá tr ị của thanh ghi Ri Ví dụ dụ: Mov R0,#3BH Mov @R0,#27H Sau khi lệ lệnh đượ c thự thực hiệ hiện ô nhớ nhớ 3BH 3BH mang giá tr ị là 27H
16. Lệnh đư a dữ liệu vào con tr ỏ dữ liệu DPTR Cú pháp: Mov DPTR,#data16 Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 3 Byte Thờ Thờ i gian thự thực hiệ hiện: 2 chu kì máy Công dụ dụng: Thiế Thiết đặt đặt dữ dữ liệ liệu cho con tr ỏ dữ liệ liệu vớ vớ i dữ dữ liệ liệu 16 bit, thự th ực chấ ch ất dữ dữ liệ liệu đượ c lưu ở hai ở hai thanh ghi DPL (byte thấ th ấ p-đị p-địaa chỉ chỉ byte 82H) và DPH (byte cao-đị cao- địaa chỉ chỉ byte 83H). Ví dụ: Mov DPTR,#3A5FH Sau khi lệ lệnh đượ c thự thực hiệ hiện DPTR mang giá tr ị là 3A5FH DPL mang giá tr ị 5FH và DPL mang giá tr ị 3AH
17. Lệnh trao đổi dữ liệu giữ a ô nhớ có địa chỉ direct vớ i thanh ghi A
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: Trao đổi đổi dữ dữ liệ liệu củ của 4 bit thấ th ấ p ở thanh ở thanh ghi A vớ vớ i dữ dữ liệ liệu củ của 4 bit thấ th ấ p ở ô ở ô nhớ nhớ có địa địa chỉ chỉ bằng giá tr ị lưu giữ giữ trong thanh ghi Ri
21. Lệnh truy xu ất dữ liệu từ ROM nội Cú pháp: MovC A,@A+DPTR Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 1 Byte Thờ Thờ i gian thự thực hiệ hiện: 2 chu kì máy Công dụ dụng: Chuyể Chuyển dữ d ữ liệ liệu từ t ừ bộ nhớ nhớ ROM ROM có địa địa chỉ ch ỉ bằng giá tr ị của A cộng vớ v ớ i DPTR vào thanh ghi A
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Số tr ừ Số bị tr ừ K ết quả quả Cờ nh ờ nhớ ớ C C Số tr ừ Số bị tr ừ K ết quả quả Cờ nh ờ nhớ ớ C C
9FH -6CH 33H 0 6CH -9FH CDH 1
159 108 51
10011111b 01101100b 00110011b 0
10 1 08 159 -51
01101100b 10011111b 11001101b 1 -phép tr ừ trên có số số mu muợ ợ n
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
3. Lệnh cộng dữ liệu trên thanh ghi A v ớ i dữ liệu của ô nhớ có địa chỉ gián tiếp: Cú pháp: Add A,@Ri Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 1 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: Cộ Cộng giá tr ị dữ liệ liệu trên thanh ghi A vớ v ớ i giá tr ị dữ liệ liệu của ô nhớ nhớ có địa địa chỉ chỉ bằ bằng giá tr ị của thanh ghi Ri, sau khi th ực hiệ hi ện lệ l ệnh k ết quả qu ả đượ c lư l ưu ở thanh ở thanh ghi A. Lệ L ệnh này có ảnh hưở hưở ng ng đến đến thanh thanh tr ạng thái PSW. Ví dụ dụ: AC = 1 ;cờ ;cờ C C đang mang giá tr ị 1
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
ớ ở ở cờ C: 6. Lệnh cộng dữ liệu trên thanh ghi A v ớ i dữ liệu ở ô nhớ có địa chỉ direct và giá tr ị số nhớ
Cú pháp: AddC A,direct Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 2 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: Cộ Cộng giá tr ị dữ liệ liệu trên thanh ghi A vớ v ớ i giá tr ị dữ liệ liệu của ô nhớ nhớ có địa địa chỉ chỉ direct và cộ c ộng thêm giá tr ị của số s ố nhớ nhớ trên trên cờ cờ C, C, sau khi thự th ực hiệ hi ện lệ l ệnh k ết quả qu ả đượ c lư l ưu ở thanh ghi A. Lệ L ệnh này có ảnh hưở hưở ng ng đến đến thanh thanh tr ạng thái PSW Ví dụ dụ: C=0 Mov A,#0A5h
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 1 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: Tr ừ giá tr ị dữ liệ liệu trên thanh ghi A vớ v ớ i giá tr ị dữ liệ liệu trên thanh ghi Rn và tr ừ tr ừ cho giá tr ị nhớ nhớ trên trên cờ cờ C, C, sau khi thự thực hiệ hi ện lệ l ệnh k ết quả qu ả đượ c lư l ưu ở thanh ở thanh ghi A. Lệ L ệnh này có ảnh hưở hưở ng ng đến đến thanh thanh tr ạng thái PSW Ví dụ dụ: C= 1 Mov A,#0E5h Mov R3,#9Fh Subb A,R3
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy Công dụ dụng: Tr ừ giá tr ị dữ liệ liệu trên thanh ghi A vớ v ớ i giá tr ị xác định định và tr ừ thêm giá tr ị nhớ nhớ
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Công dụ dụng: Tă Tăng giá tr ị dữ liệ liệu ở ô ở ô nhớ nh ớ có có địa địa chỉ ch ỉ bằng giá tr ị dữ liệ liệu trên Ri lên 1 đơ n vị v ị, không ảnh hưở hưở ng ng đến đến các cờ cờ nh nhớ ớ trên trên PSW
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Ví dụ dụ:
Mov 7Fh,#0 Dec 7Fh
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
24. Lệnh hiệu chỉnh thập phân nội dung của thanh ghi A đối vớ i phép cộng:
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Lệnh này chiế chi ếm dung lượ lượ ng ng bộ bộ nhớ nhớ ROM ROM là 1 Byte Thờ Thờ i gian thự thực hiệ hiện: 1 chu kì máy
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Mov Mov Djnz Djnz
R7,#0FFH R6,#0FFH R6,Kt1 R7,Kt2
;===>>>> gan R7=#0FFH, 1 chu ki may Kt2: ;===>>>> gan R6=#0FFH, 1 chu ki may Kt1: ;===>>>> giam R6 xuong 1, R6 khac 0-> giam tiep ;===>>>> giam R7 xuong 1, R6 khac 0-> ve Kt2 Ret ;===>>>> ket thuc chuong trinh con ;______________________________________________________________________________ End ;===>>>> ket thuc chuong trinh Cách 2: Để led sáng lầ l ần lượ lượ t,t, cầ cần làm cho tín hiệ hi ệu xuấ xuất ra giá tr ị 1 mộ một khoả khoảng thờ thờ i gian để có thể thể nhậ nhận biế bi ết đượ c. c. Đầu Đầu tiên cho P1 tắ t ắt, sau đó làm cho bit A.0 lên 1, s ử dụng lệ lệnh xoay trái dữ dữ liệ liệu trên thanh Ram A, mỗ m ỗi lầ lần xoay giá tr ị 1 sẽ sẽ chuyể chuyển lầ lần lượ lượ t qua A.1 - A.2 - A.3 -A.4 - A.5 -A.6 - A.7 - A.0, mỗ mỗi lầ lần xoay xuấ xuất tín hiệ hiệu ra P1 sẽ sẽ thấ thấy led sáng lầ l ần lượ lượ t từ từ led 1 đến đến led 8.
Chươ Chươ ng ng trình: ;****************************************************************************** ;**************/////--;********** ****/////--- LED SANG LAN LUOT ---\\\\\\ ********************** ******************************* ********* ;**------------------------------------------------------------------------------------------------------------------;**////////////////___led sang lan luot tu led 1 den led 8___________\\\\\\\\\\\\\\\\\\\\\\\\\\\ ;**///////////////___ sang o muc 1 va tat o muc 0_________________\\\\\\\\\\\\\\\\\\\\\\\\\ ;**//////////////____lap di lap lai khong gioi han_________________\\\\\\\\\\\\\\\\\\\\\ ;**<<<<<<<<<<<<<<<<<<<---------------------------------------------->>>>>>>>>>>>>> ;** \\\\\\\\\\\\------\\\\\\\\\\\\------- nap thanh Ram A=#00000001B------------------------------/////////////// A=#00000001B------------------------------///////////////// ;**\\\\\\\\\\\\\--------ket ;**\\\\\\ \\\\\\\--------ket hop xoay phai thanh Ram A va xuat du lieu---------------//////// lieu------------- --//////////////// //////// ;******************************************************************************
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Xuat:
Sjmp
Mov LCall RL Xuat
P1,A Delay A
;===>>>> xuat du lieu A ra P1 dieu khien led ;===>>>>goi chuong trinh con Delay ;===>>>> nhay ve thuc hien tu dau
;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> delay <<<<<<<<<<<<<<<<<<<<<<<<<<<< Delay: Mov R7,#0FFH Kt2: Mov R6,#0FFH Kt1: Djnz R6,Kt1 Djnz R7,Kt2 Ret ;______________________________________________________________________________ End ;===>>>> ket thuc chuong trinh Giả Giải thích: ORG 000H là lệ lệnh chỉ chỉ dẫn: chươ chươ ng ng trình này đượ c lư lưu vào ROM bắ bắt đầu đầu từ từ địa địa chỉ chỉ 000H. Khi mớ mớ i bắ bắt đầu đầu chươ chươ ng ng trình, Mov P1,#0 làm tấ tất cả cả các led đều đều tắ tắt, LCall Delay làm cho thờ thờ i gian tắ tắt đủ để mắt ngườ ng ườ i nhậ nh ận ra. Mov A,#00000001B làm cho bit A.0 củ c ủa thanh ghi A đượ c set lên 1, các bit còn l ại ở giá ở giá tr ị 0. Tiế Tiế p theo trong chươ chươ ng ng trình là nhãn Xuat Xuat:: vị trí tr ở v ở về, trên lư lưu đồ giả giải thuậ thuật là điểm mũi tên tr ở v ở về. Mov P1,A xuấ xuất tín hiệ hiệu ra P1, lúc này led 1 sáng lên. Ti ế p theo là lệnh gọ gọi chươ chươ ng ng trình con LCall Delay. Delay. Câu lệ lệnh RL A làm tr ạng thái các bit dị d ịch sang trái 1 bit, tr ướ tr ướ c đó chỉ chỉ có A.0 ở giá ở giá tr ị 1, sau câu lệ lệnh A.1 mang giá tr ị 1, còn bit A.0 bây giờ gi ờ mang mang giá tr ị 0 do bit A.7 có giá tr ị 0 chuyể chuyển sang. Sjmp Xuat chươ chươ ng ng trình nhả nhảy đến đến đoạn chươ chươ ng ng trình đượ c đánh dấ dấu bằng nhãn Xuat,, nên nhớ Xuat nhớ r ằng chươ chươ ng ng lệnh gọi Sjmp chỉ chỉ nhả nhảy đượ c đến đến vị trí cách lệ l ệnh gọi không quá 128 byte, nế nếu vượ v ượ t qua giớ giớ i hạ h ạn này chươ chươ ng ng trình dị d ịch sẽ s ẽ báo lỗ lỗi, khi đó cầ c ần thay Sjmp bằng Ljmp vì Ljmp có thể thể nhả nhảy đến đến vị vị trí bấ bất kì trên ROM. Lúc này chươ ch ươ ng ng trình bắ b ắt đầu đầu từ nhãn Xuat: Sau nhãn Xuat: là câu lệ lệnh Mov P1,A tín hiệ hiệu đượ c xuấ xu ất ra P1, lúc này P1.1 lên giá tr ị 1, led thứ thứ hai sáng, các led còn l ại không sáng. Câu lệnh RL A làm tr ạng thái các bit dị d ịch sang trái 1 bit: A.2 lên 1, các bit khác mang giá tr ị tr ị 0. Các quá trình trên đượ c lặ l ặ p lạ l ại liên tụ t ục (vớ (vớ i câu lệ lệnh Sjmp Xuat và nhãn Xuat: ). K ết quả qu ả cuố cuối cùng như như trên hình minh họ h ọa phía trên. Bài 6: "sáng l ần l ượ t" ượ t" Phần cứng: 32 led nối vớ i Port 0,1,2,3, đượ c định vị trí như sau: led 1 nối vớ i P0.0, lần lượ t cho ng trình để các led nối vớ i đến led 32 (nối vớ i P3.7). Biết led sáng khi tín hiệu xuất ở giá tr ị 1.Viết chươ ng Port 0,1,2,3 sáng lần l t từng led từ led 1 đến led 32. Các quá trình đượ c lặ p l i không giớ i h
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Cách 1: Cách này cũ cũng như như cách 1 trong bài 5, làm cho các led sáng b ằng cách thiế thi ết đặt đặt các giá tr ị thích hợ hợ p cho các Port để làm led sáng theo từ t ừng tr ạng thái, cách này đơ n giả giản như nhưng cầ cần viế viết dài và tố tốn dung lượ l ượ ng ng bộ bộ nhớ nhớ Rom. Rom. ;******************************************************************************* ;**************///// ;********* *****/////----- 32 LED SANG LAN LUOT- CACH DON GIAN ---\\\\\\**** ---\\\\\\************** ********** ;**------------------------------------------------------------------------------------------------------------------;**////////////////___ led sang lan luot tu led 1 den led 32___________\\\\\\\\\\\\\\\\\\\\\\\\\\\ ;**///////////////___ sang o muc 1 va tat o muc 0__________________\\\\\\\\\\\\\\\\\\\\\\\\\ ;**//////////////____ lap di lap lai khong gioi han____________________\\\\\\\\\\\\\\\\\\\\\ ;**<<<<<<<<<<<<<<<<<<<----------------------------------------------------->>>>>>>>>>>>>> ;** \\\\\\\\\ \\\\\\\\\\\\------\\\------- nap gia tr ị cho tung tung trang thai ------------------------------------------------/////////// -----------//////////////// ///// ;****************************************************************************** ORG 000H ; khai bao dia chi de bat dau chuong trinh tren Rom Mov P0,#0 ;===>>>> ||| Mov P1,#0 ;===>>>> ||| cac led deu tat Mov P2,#0 ;===>>>> ||| Mov P3,#0 ;===>>>> ||| LCall Delay ;===>>>>goi chuong trinh con Delay Xuat: ;**>>>>>>>>>>>>>>>>>>> ;**>>>>>>>>>>>>>> >>>>> lam led P0 sang <<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<< <<<<<< Mov P0,#00000001B P0,#000000 01B ;===>>>> lam led 1 sang LCall Delay ;===>>>>goi chuong trinh con Delay Mov P0,#00000010B P0,#000000 10B ;===>>>> lam led 2 sang LCall Delay Mov P0,#00000100B P0,#000001 00B ;===>>>> lam led 3 sang LCall Delay Mov P0,#00001000B P0,#000010 00B ;===>>>> lam led 4 sang LCall Delay Mov P0,#00010000B P0,#000100 00B ;===>>>> lam led 5 sang LCall Delay Mov P0,#00100000B P0,#001000 00B ;===>>>> lam led 6 sang LCall Delay Mov P0,#01000000B P0,#010000 00B ;===>>>> lam led 7 sang LCall Delay Mov P0,#10000000B P0,#100000 00B ;===>>>> lam led 8 sang LCall Delay ;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>lam led P1 sang <<<<<<<<<<<<<<<<<<< Mov P0,#00000000B P0,#000000 00B ;===>>>> lam P0 tat Mov P1,#00000001B P1,#000000 01B ;===>>>> lam led 1 sang LCall Delay Mov P1,#00000010B P1,#000000 10B ;===>>>> lam led 2 sang LCall Delay
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Mov P1,#00010000B P1,#000100 00B ;===>>>> lam led 5 sang LCall Delay Mov P1,#00100000B P1,#001000 00B ;===>>>> lam led 6 sang LCall Delay Mov P1,#01000000B P1,#010000 00B ;===>>>> lam led 7 sang LCall Delay Mov P1,#10000000B P1,#100000 00B ;===>>>> lam led 8 sang LCall Delay ;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> lam led P2 sang <<<<<<<<<<<<<<<<<< Mov P1,#00000000B P1,#00000000 B ;===>>>> lam P1 tat Mov P2,#00000001B P2,#000000 01B ;===>>>> lam led 1 sang LCall Delay Mov P2,#00000010B P2,#000000 10B ;===>>>> lam led 2 sang LCall Delay Mov P2,#00000100B P2,#000001 00B ;===>>>> lam led 3 sang LCall Delay Mov P2,#00001000B P2,#000010 00B ;===>>>> lam led 4 sang LCall Delay Mov P2,#00010000B P2,#000100 00B ;===>>>> lam led 5 sang LCall Delay Mov P2,#00100000B P2,#001000 00B ;===>>>> lam led 6 sang LCall Delay Mov P2,#01000000B P2,#010000 00B ;===>>>> lam led 7 sang LCall Delay Mov P2,#10000000B P2,#100000 00B ;===>>>> lam led 8 sang LCall Delay ;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>lam led P1 sang <<<<<<<<<<<<<<<<<<< Mov P2,#00000000B P2,#000000 00B ;===>>>> lam P2 tat Mov P3,#00000001B P3,#000000 01B ;===>>>> lam led 1 sang LCall Delay Mov P3,#00000010B P3,#000000 10B ;===>>>> lam led 2 sang LCall Delay Mov P3,#00000100B P3,#000001 00B ;===>>>> lam led 3 sang LCall Delay Mov P3,#00001000B P3,#000010 00B ;===>>>> lam led 4 sang LCall Delay Mov P3,#00010000B P3,#000100 00B ;===>>>> lam led 5 sang LCall Delay Mov P3,#00100000B P3,#001000 00B ;===>>>> lam led 6 sang LCall Delay
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
LCall Delay Mov P3,#00000000B P3,#000000 00B ;***---------------------------------------Ljmp Xuat
;===>>>> lam led P3 tat ; ===>>>> nhay ve thuc hien tu dau
;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> delay <<<<<<<<<<<<<<<<<<<<<<<<<<<< Delay: Mov Mov Djnz Djnz
R7,#0FFH R6,#0FFH R6,Kt1 R7,Kt2
;===>>>> gan R7=#0FFH, 1 chu ki may Kt2: ;===>>>> gan R6=#0FFH, 1 chu ki may Kt1: ;===>>>> giam R6 xuong 1, R6 khac 0-> giam tiep ;===>>>> giam R7 xuong 1, R6 khac 0-> ve Kt2 Ret ;===>>>> ket thuc chuong trinh con ;______________________________________________________________________________ End ;===>>>> ket thuc chuong trinh Câu lệ lệnh cuố cuối quay tr ở ở về đầu đầu phả phải dùng Ljmp Xuat chứ chứ không sử sử dụng Sjmp vì khoả khoảng cách từ từ vị trí chươ chươ ng ng trình bắ bắt đầu đầu đến đến câu lệ lệnh gọ gọi tr ở v ở về lớ n 128byte. Cách 2: K ết hợ hợ p các lệ lệnh xoay và di chuyể chuy ển dữ dữ liệ liệu để chươ chươ ng ng trình viế vi ết ngắ ngắn gọ gọn hơ hơ n. n. Phân tích: Tạ T ại mỗ mỗi thờ thờ i điểm chỉ chỉ có 1 led sáng, do đó có thể th ể sử dụng lệ lệnh xoay trái tr ạng thái các bit củ c ủa các Port, vớ v ớ i mộ một bit nào đó đượ c đặt đặt lên 1, xoay bit này l ần lượ lượ t qua P0,P1,P2,P3 sẽ s ẽ đạt đạt k ết quả quả. Vấ V ấn đề đặt đặt ra là làm sao để xoay 32 bit củ c ủa P0,P1,P2,P3 trong khi đó chỉ ch ỉ có thanh ghi A thự thực hiệ hi ện đượ c lệ l ệnh xoay. Không thể th ể thự thực hiệ hi ện xoay 32 bit củ c ủa 4 Port bằ bằng mộ một lệ l ệnh duy nhấ nhất mà phả phải tr ải qua nhiề nhi ều bướ bướ c. c. Để xoay tr ạng thái các bit trong mộ m ột ô nhớ nhớ bbất kì, đầu đầu tiên chuyể chuy ển giá tr ị của ô nhớ nhớ đđó lên thanh ghi A, r ồi dùng lệ lệnh xoay thanh ghi A, sau đó chuyể chuyển k ết quả quả về lại ô nhớ nhớ ccần xoay,k ết quả quả ô nhớ nhớ đđã đượ c xoay. Bây giờ gi ờ có có thể thể qui ướ c cụ cụm từ từ "xoay ô nhớ " thay cho các bướ b ướ c vừ vừa nêu. Để xoay 32 bit (trong bài này là P0,P1,P2,P3), tr ướ tr ướ c hế h ết xoay trái ô nhớ nh ớ đầ đầuu tiên (P0) cùng vớ i cờ cờ C C (giá tr ị đầu đầu tiên củ của cờ cờ C C đượ c đượ c đặt đặt tr ướ ướ c tùy từ từng tr ườ ườ ng ng hợ hợ p cụ cụ thể thể hoặ hoặc do chươ chươ ng ng trình thự thực hiệ hiện), sau khi xoay ô nhớ nh ớ đầu đầu tiên vớ vớ i cờ C, các tr ạng thái củ của các bit trong ô nhớ nh ớ đó chuyể chuyển qua mộ một bit, giá tr ị của cờ C chuyể chuyển vào bit 0, bit 7 củ c ủa ô nhớ nhớ đó chuyể chuyển vào cờ cờ nhớ nhớ C. Xoay ô nhớ nhớ th thứứ hai vớ vớ i cờ cờ nh nhớ ớ C, C, giá tr ị của C tr ướ ướ c đó chuyể chuyển vào bit 0 củ c ủa ô nhớ nhớ th thứứ hai (mà giá tr ị này tr ướ ướ c đó là củ của bit 7 ô nhớ nh ớ th thứứ nhấ nhất), giá tr ị của bit 7 trong ô nhớ nh ớ th thứứ hai chuyể chuyển vào cờ c ờ nh nhớ ớ C. Tiế Tiế p tụ t ục xoay ô nhớ nh ớ th thứứ 3 và thứ thứ 4 vớ v ớ i cờ c ờ nh nhớ ớ C. C. K ết quả qu ả cuố cuối cùng tr ạng thái củ của 32 bit đượ c dịch sang trái 1 bit, bit 0 c ủa ô nhớ nhớ đầ đầuu tiên là giá tr ị của C tr ướ ướ c đó và giá tr ị của cờ cờ nh nhớ ớ C C hiệ hiện tạ tại là củ của bit 7 củ c ủa ô nhớ nhớ th thứứ 4 chuyể chuyển sang. Giả Giải thuậ thuật:
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Mov Mov Mov Mov SetB
P0,#0 P1,#0 P2,#0 P3,#0 C
;===>>>> ||| tat tat ca ca led ;===>>>> ||| ;===>>>> ||| ;===>>>> ||| ;===>>>> lam co C len 1
Xoay32bit:
Sjmp
Mov A,P0 RLC A Mov P0,A Mov A,P1 RLC A Mov P1,A Mov A,P2 RLC A Mov P2,A Mov A,P3 RLC A Mov P3,A LCall Delay Xoay32bit
;|||||||||| ;||||||||||===>>>> xoay trai P0 voi co nho C ;|||||||||| ;@@@@ ;@@@@ ===>>>> xoay trai P1 voi co nho C ;@@@@ ;##### ;##### ===>>>> xoay trai P2 voi co nho C ;##### ;!!!!!!!!!!! ;!!!!!!!!!!!===>>>> xoay trai P3 voi co nho C ;!!!!!!!!!!! ;===>>>>goi chuong trinh con Delay ;===>>>> nhay ve thuc hien tu dau
;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Delay <<<<<<<<<<<<<<<<<<<<<<<<<<<< Delay: Mov R7,#0FFH Kt2: Mov R6,#0FFH Kt1: Djnz R6,Kt1 Djnz R7,Kt2 Ret ;&&&&& ket thu chuong trinh con Delay ;______________________________________________________________________________ End ;===>>>> ket thuc chuong trinh ự giải Bài 7 : Bài t ậ p t ự
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Minh hoạ:
Cách 1: 1: Cách này đơ n giả giản là làm cho các led sáng b ằng cách thiế thi ết đặt đặt các giá tr ị thích hợ hợ p cho các Port để làm led sáng theo từ t ừng tr ạng thái, cách này đơ n giả giản như nhưng cầ cần viế viết dài và tố t ốn dung lượ ng ng bộ bộ nhớ nhớ Rom. Rom. Nế Nếu cầ cần thiế thiết các bạ bạn tự tự giả giải Cách 2: 2: Dùng lệ lệnh xoay A vớ v ớ i cờ cờ C, C, mỗ mỗi lầ lần xoay đều đều SetB C (C=1), sau mỗ m ỗi lầ lần xoay xuấ xuất k ết quả qu ả ra P0 .Đặ .Đặtt giá tr ị ban đầu đầu cho A là #00000000B, vì C luôn đượ c set lên 1 nên sau l ần xoay đầu đầu tiên thanh ghi A có giá tr ị là: #00000001B, lầ l ần 2: #00000011B, lầ l ần3: #00000111B .... Khi thanh ghi A đầy: đầy: #11111111B chươ ch ươ ng ng trình phả phải đượ c khở khở i động động lạ lại vớ vớ i giá tr ị ban đầu đầu của A là #00000000B. Để nhậ nhận biế biết đượ c khi nào thanh ghi A đầy đầy để khở khở i động động lạ l ại các thông số s ố, sau mỗ mỗi lần xoay kiể kiểm tra cờ cờ nh nhớ ớ C. C. Vì sau mỗ mỗi lần xoay giá tr ị của cờ nh ờ nhớ ớ C C do bit A.7 chuyể chuy ển sang.
Chươ Chươ ng ng trình: ;******************************************************************************
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
RLC A ;===>>> xoay thanh ghi A Mov P0,A ;===>>>> xuat ra led JNC X1 ;===>>>> nhay ve nhan "X1" neu C=0 Sjmp Tudau ;===>>>> nhay ve thuc hien tu dau ;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> delay <<<<<<<<<<<<<<<<<<<<<<<<<<<< Delay: Mov R7,#0FFH Kt2: Mov R6,#0FFH Kt1: Djnz R6,Kt1 Djnz R7,Kt2 Ret ;______________________________________________________________________________ End ;===>>>> ket thuc chuong trinh Bài 10: Bài t ậ p t ự ở r ộng bài 9 ự giải, mở r Hãy phát triể triển chươ chươ ng ng trình củ của bài 9 cho 16 và 32 led. Bài 11: Bài t ậ p t ự mở r r ộng bài 9: "sáng tắ t ắt dầ dần" ự giải, mở Hãy bổ bổ sung vào các chươ ch ươ ng ng trình đã đượ c viế viết trong bài 9 đoạn chươ chươ ng ng trình "tắ "tắt dần". Toàn bộ bộ tr ạng thái sáng củ c ủa led đượ c minh họ họa trong hình dướ dướ i,i, sau đó hãy mở mở r r ộng chươ chươ ng ng trình này cho 16 và 32 led Minh hoạ: Bài 12: Bài t ậ p t ự :" Sâu bò" bò" ự giải: Bài này mang tên :" Sâu Phầ Phần cứ cứng: 32 led nố n ối vớ vớ i Port 0,1,2,3, đượ c định định vị vị trí như như sau: led 1 nố n ối vớ vớ i P0.0, lầ lần lượ lượ t cho đến đến led 32 (nố (nối vớ vớ i P3.7), các led đượ c xế xế p thẳ thẳng hàng vớ vớ i nhau. Biế Biết led sáng khi tín hiệ hi ệu xuấ xuất ở m ở mức 1. Viế Viết chươ chươ ng ng trình để led sáng theo minh hoạ ho ạ sau đây. Minh hoạ: Dạng 1: "sâu bò" đơ n gi ản Chú ý: Lúc nào cũ cũng có 8 led đượ c bậ bật sáng
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Bài 13: Bài tậ tậ p tự tự giả giải, bài này có tên:" Sâu tên:" Sâu l ớ ớn " Dầu tiên. khi sâu còn nh ỏ:vệt sáng led ch ạ y vớ i chiề u dài là 1 led trong l ần đầu tiên như ở về thự c hi ện ở l ần k ế ế tiế p, sâu trong bài 5 và bài 6, sau khi v ệt sáng ch ạ y đế n led cuố i cùng và tr ở l ớ t định, ớn hơ n và có độ dài là 2 led sáng, c ứ thế sâu l ớ ớn d ần. Sâu có một độ l ớ ớn chiề u dài nhấ t
ớn của sâu do các b ạn t ự ự chọn, như ng ướ c hế t chọn sâu có độ l ớ ớn là 8 led, sau đ ó là 16 chiề u dài l ớ ng tr ướ led. Sau khi sâu đ ã ã đạt độ l ớ a, các quá trình đượ c b ắ t t đầu l ại t ừ đầ ng trình ớn t ố ối đ a, ừ đầu. Hãy viế t chươ ng vớ i yêu c ầu trên v ớ i 8 led, 16 led và 32 led.
Minh họa vớ i 8 led: Bài 14: " Sáng dồ dồn 8 led" ượ t cho Phần cứ ng: ng: 8 led n ố i v ớ i Port 0 đượ c định v ị trí như sau: led 1 n ố i v ớ i P0.0, l ần l ượ t ở mứ c 1.Viế t chươ ng ng trình để các led n ố i vớ i đế n led 8 (n ố i vớ i P0.7). Bi ế t led sáng khi tín hi ệu xuấ t ừ led 1 đế n led 8 sau đ ó t ắ ắ t h ế t led và l ặ ặ p l ại. Các quá trình đượ c l ặ ặ p l ại không Port 0 sáng d ồn t ừ giớ i hạn.
Minh hoạ: giản là làm cho các led sáng b ằng cách thiế thi ết đặt đặt các giá tr ị thích hợ hợ p Cách 1: 1: Cách này đơ n giả cho các Port để làm led sáng theo từ t ừng tr ạng thái, cách này đơ n giả giản như nhưng cầ cần viế viết dài và tố t ốn dung lượ ng ng bộ bộ nhớ nhớ Rom. Rom. Nế Nếu cầ cần thiế thiết các bạ bạn tự tự giả giải Cách 2: 2: Ở cách này giả gi ải thuậ thuật phứ phức tạ tạ p hơ hơ n: n: Chia quá trình sáng thành hai quá trình đơ n: n: quá trình có 1 led sáng xoay vòng và quá trình các led sáng cố định có lưu giữ tr ạng thái led cu ối chu trình, k ết hợ p hai chu trình trên s ẽ ra k ết quả cần thực hiện.
Dùng thanh ghi R3 để làm cho bit mang giá tr ị tr ị 1 xoay vòng như như ở bài ở bài 5. Dùng ô nhớ nhớ 30H 30H dùng lư lưu giá tr ạng thái cuố cuối củ của quá trình.(ban đầu đầu 30H= #00000000B) Thực hiện OR: R3 vớ i 30H r ồi xuất ra P0 sau mỗi lần R3 xoay 1 bit. Trong quá trình đầu: một bit mang giá tr ị 1 trên R3 xoay t ừ vị trí R3.0 đến R3.7, vì 30H lúc này đang mang giá tr ị là #00000000B, nên khi OR R3 vớ i 30H r ồi xu ất ra P0 sẽ thấy 1 led sáng di chuyển t ừ led 1 đến led 8. Khi vị trí sáng đến led thứ 8 vi điều khiển lưu lại giá tr ị của P0 vào 30H. Trong quá trình hai: bit mang giá tr ị 1 trên R3 vẫn xoay, lúc này 30H có bit 30H.7 đang ở giá tr ị 1 tức là 30H đang mang giá tr ị #10000000B,nên khi khi OR R3 vớ i 30H r ồi xu ất ra P0 sẽ thấy led 8 sáng cố định, trong lúc đó có 1 led sáng di chuyển từ led 1 đi vào. Đến led 7 vi điều khiển lưu lại giá tr ị P0 vào 30H (giá tr ị mớ i lưu
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
SetB C SD1: Lcall Mov RLC Mov ORL Mov
Delay A,R3 A R3,A A,30H P0,A
DJNZ R1,SD1 Mov 30H,P0 DJNZ R0,SD2 Ljmp TuDau
;@@@@ ;@@@@===>>>xoay ;@@@@===>>>x oay trai R3 ;@@@@ ;+++>>> thuc hien phep OR giua A va 30H, ket qua o A ;===>>>xuat ket qua ra P0
;===>>> luu giu trang thai cuoi
;**>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> delay <<<<<<<<<<<<<<<<<<<<<<<<<<<< Delay: Mov Mov Djnz Djnz
R7,#0FFH R6,#0FFH R6,Kt1 R7,Kt2
;===>>>> gan R7=#0FFH, 1 chu ki may Kt2: ;===>>>> gan R6=#0FFH, 1 chu ki may Kt1: ;===>>>> giam R6 xuong 1, R6 khac 0-> giam tiep ;===>>>> giam R7 xuong 1, R6 khac 0-> ve Kt2 Ret ;===>>>> ket thuc chuong trinh con ;_____________________________________________________________________________ End ;===>>>> ket thuc chuong trinh Bài 15: "Sáng , tắ tắt dồ dồn 8 led"
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
BÀI 5: GIAO TIẾP VỚ I LED 7 ĐOẠN 5.1
TỔNG QUAN
Trong các thiế thi ết bị b ị, để báo tr ạng thái hoạ ho ạt động động củ c ủa thiế thiết bị b ị đó cho ngườ ngườ i sử s ử dụng vớ v ớ i thông số chỉ chỉ là các dãy số s ố đơ n thuầ thuần, thườ thườ ng ng ngườ ngườ i ta sử sử dụng "led "led 7 đ oạn". Led 7 đoạn đượ c sử sử dụng khi các dãy số số không đòi hỏ hỏi quá phứ phức tạ tạ p, chỉ chỉ cần hiệ hiện thị thị số là đủ, đủ, chẳ chẳng hạ hạn led 7 đoạn đượ c dùng để hiể hiển thị thị nhi nhiệệt độ phòng, trong các đồng đồng hồ treo tườ tườ ng ng bằng điện tử, hiể hiển thị thị số lượ ng ng sản phẩ phẩm đượ c kiể kiểm tra sau mộ một công đoạn nào đó... Led 7 đoạn có cấ cấu tạ tạo bao gồ g ồm 7 led đơ n có dạ dạng thanh xế xế p theo hình và có thêm một led đơ n hình tròn nhỏ nh ỏ thể thể hiệ hiện dấ dấu chấ chấm tròn ở góc ở góc dướ dướ i,i, bên phả phải củ c ủa led 7 đoạn. 8 led đơ n trên led 7 đoạn có Anode(cự Anode(cực +) hoặ hoặc Cathode(cự Cathode(cực -) đượ c nố nối chung vớ vớ i nhau vào mộ một điểm, đượ c đưa đưa chân ra ngoài để k ết nố nối vớ vớ i mạ mạch điện. 8 cự cực còn lạ lại trên mỗ mỗi led đơ n đượ c đưa đưa thành 8 chân riêng, cũ c ũng đượ c đưa đưa ra ngoài để k ết nố nối vớ vớ i mạ mạch điện. Nế Nếu led 7 đoạn có Anode(cự Anode(cực +) chung, đầu đầu chung này đượ c nố nối vớ vớ i +Vcc, các chân còn lạ l ại dùng để điều khiể khiển tr ạng thái sáng tắ t ắt củ c ủa các led đơ n, n, led chỉ chỉ sáng khi tín hiệ hi ệu đặt đặt vào các chân này ở m ở mức 0. Nế Nếu led 7 đoạn có Cathode(cự Cathode(c ực -) chung, đầu đầu chung này đượ c nố nối xuố xuống Ground (hay Mass), các chân còn l ại dùng để điều khiể khiển tr ạng thái sáng tắ t ắt củ của các led đơ n, n, led chỉ chỉ sáng khi tín hiệ hi ệu đặt đặt vào các chân này ở m ở mức 1.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
5.2
K ẾT NỐI VỚ I VI ĐIỀU KHIỂN
Ngõ nhậ nhận tín hiệ hi ệu điều khiể khiển củ c ủa led 7 đoạn có 8 đườ ng, ng, vì vậ vậy có thể thể dùng 1 Port nào đó của Vi điều khiể khiển để điều khiể khiển led 7 đoạn. Như Như vậy led 7 đoạn nhậ nh ận mộ m ột dữ d ữ liệ liệu 8 bit từ t ừ Vi điều khiểển để điều khiể khi khiển hoạ hoạt động động sáng tắ tắt của từng led led đơ n trong nó, dữ d ữ liệ liệu đượ c xuấ xuất ra điều khiểển led 7 đoạn thườ khi th ườ ng ng đượ c gọ g ọi là "mã hiể hi ển thị th ị led 7 đoạn". Có hai kiể ki ểu mã hiể hiển thị th ị led 7 đoạn: mã dành cho led 7 đoạn có Anode(cự Anode(cực +) chung và mã dành cho led 7 đoạn có Cathode(cự Cathode(c ực -) chung. Chẳ Chẳng hạ hạn, để hiệ hiện thị thị số 1 cầ cần làm cho các led ở v ở vị trí b và c sáng, nế n ếu sử sử dụng led 7 đoạn có Anode chung thì phả ph ải đặt đặt vào hai chân b và c điện áp là 0V(mứ 0V(m ức 0) các chân còn lạ l ại đượ c đặt đặt điện áp là 5V(mứ 5V(mức 1), nế nếu sử s ử dụng led 7 đoạn có Cathode chung thì điện áp(hay mứ mức logic) hoàn toàn ngượ ngượ c lạ lại, tứ tức là phả phải đặt đặt vào chân b và c điện áp là 5V(mứ 5V(mức 1). Bảng mã hiể hiển thị thị led 7 đoạn: Phầ Phần cứ c ứng đượ c k ết nố n ối vớ v ớ i 1 Port bấ bất kì củ c ủa Vi điều khiể khiển, để thu thuậận tiệ ti ện cho việ việc xử xử lí về về sau phầ phần cứ cứng nên đượ c k ết nố nối như như sau: Px.0 nố n ối vớ vớ i chân a, Px.1 nố n ối vớ vớ i chân b, lầ l ần lượ lượ t theo thứ th ứ tự cho đến đến Px.7 nố nối vớ vớ i chân h. Dữ liệ liệu xuấ xuất có dạ dạng nhị nhị phân như như sau : hgfedcba Bảng mã hi ể chung (các led đơ n sáng ở mứ c 0): ể n th ị led 7 đ oạn dành cho led 7 đ oạn có Anode chung (các
S ố ố hi ể ể n th ị trên led 7 đ oạn
0 1 2
Mã hi ể ể n th ị led 7 đ oạn d ạng nh ị phân hgfedcba 11000000 11111001 10100100
Mã hi ể ể n th ị led 7 đ oạn d ạng thậ p l ục phân
C0 F9 A4
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
Bảng mã hi ể chung (các led đơ n sáng ở mứ c 1): ể n th ị led 7 đ oạn dành cho led 7 đ oạn có Cathode chung (các
ố hi ể ể n S ố ể n th ị led 7 đ oạn Mã hi ể ể n th ị led 7 đ oạn d ạng thậ p th ị trên Mã hi ể led 7 d ạng nh ị phân l ục phân đ oạn 0 00111111 3F 1 00000110 06 2 01011011 5B 3 01001111 4F 4 01100110 66 5 01101101 6D 6 01111101 7D 7 00000111 07 8 01111111 7F 9 01101111 6F A 01110111 77 B 01111100 7C C 00111001 39 D 01011110 5E E 01111001 79 F 01110001 71 01000000 40
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
khiển điều khiể khiể khiển on/off cho led 7 đoạn, mỗ mỗi ngõ ra điều khiể khiển ON/OFF cho 1 led 7 đoạn, (ON: led 7 đoạn đượ c cấ cấ p nguồ ngu ồn để hiể hiển thị thị, OFF: led 7 đoạn bị bị ngắ ngắt nguồ nguồn nên không hiể hi ển thị thị đượ c). c). Sơ đồ ơ đồ k ết nố nối thự thực tế tế như như hình dướ dướ i:i:
Trong sơ sơ đồ đồ trên, led 7 đoạn đượ c sử sử dụng là loạ loại có Anode chung, vớ v ớ i tấ tất cả cả các chân nhậ nh ận tín hiệ hiệu đượ c k ết nối vớ i Port 0 đã qua điện tr ở ở hạn dòng. Để điều khiể khiển ON/OFF cho các led 7 đoạn, sử dụng transitor loạ lo ại PNP, transitor này nhậ nh ận dòng điều khiể khiển từ một ngõ ra củ của Vi điều
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
The world’s largest digital library
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime.
Lậ p trình vi đ iề u khiể n vớ i AT89S52
MỤC LỤC BÀI 1: CẤ CẤU TRÚC VI ĐIỀU KHIỂ KHIỂ N.............................................. N..................................................................... .............................................. ............................1 .....1 1.1 GIỚ GIỚI THIỆ THIỆU .............................................. ..................................................................... .............................................. .............................................. ............................1 .....1 1.1.1. Sơ Sơ llượ c về về vi xử xử lý:...................... lý: ............................................. ............................................... ............................................... .......................................1 ................1 1.1.2. Từ Từ Vi xử xử lý đến đến Vi điều khiể khiển ............................................ ................................................................... .............................................. ........................1 .1 1.1.3. Họ Họ MSC-51 .............................................. ..................................................................... .............................................. .............................................. ............................2 .....2 1.1.4. Các loạ lo ại vi điều khiể khiển khác ............................................. .................................................................... .............................................. ............................3 .....3 1.2 SƠ SƠ LƯỢC ƯỢC PHẦ PHẦ N CỨ CỨ NG VI ĐIỀU KHIỂ KHIỂ N-GIAO TIẾ TIẾP BÊN NGOÀI ...........................3 ...........................3 1.2.1. Khả Khảo sát sơ s ơ đồ đồ chân...................................... chân............................................................. .............................................. .............................................. ........................4 .4 1.2.2 K ết nố nối phầ phần cứ cứng ............................................. .................................................................... .............................................. ...........................................6 ....................6 1.3 CẤ CẤU TRÚC BÊN TRONG CỦ CỦA VI ĐIỀU KHIỂ KHIỂ N .............................................. ...........................................................8 .............8 1.3.1 Bộ Bộ nhớ nhớ ch chươ ươ ng ng trình - bộ b ộ nhớ nhớ ROM............................................................................8 ROM............................................................................8 1.3.2 Bộ Bộ nhớ nhớ ddữ liệ liệu- bộ bộ nhớ nhớ RAM RAM ............................................... ...................................................................... .......................................9 ................9 BÀI 2: LẬ LẬP TRÌNH CHO VI ĐIỀU KHIỂ KHIỂ N ............................................... ...................................................................... .....................................14 ..............14 2.1 GIỚ GIỚI THIỆ THIỆU .............................................. ..................................................................... .............................................. .............................................. ..........................14 ...14 2.2 TỔ TỔ NG QUAN VỀ V Ề NGÔN NGỮ NGỮ ASSEMBLY ASSEMBLY ........................................... .................................................................14 ......................14 2.3 MỘ MỘT SỐ SỐ QUI ƯỚC ƯỚC KHI LẬ LẬP TRÌNH VỚ VỚI HỢ HỢP NGỮ NGỮ ASSEMBLER..........................15 ASSEMBLER..........................15 2.4 TẬ TẬP LỆ LỆ NH TRONG VI ĐIỀU KHIỂ KHIỂ N....................................................... N.............................................................................16 ......................16 2.4.1 Nhóm lệ lệnh di chuyể chuy ển ........................................... ................................................................... ............................................... .....................................16 ..............16