báo cáo thí nghiệm xử lí số tín hiệu thực hiện các bộ lọc fir trên kit c6713 dsk

51 6 0
báo cáo thí nghiệm xử lí số tín hiệu thực hiện các bộ lọc fir trên kit c6713 dsk

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 ĐẠI HỌC QUỐC GIA THÀNH PHỐ HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ c om oOo Nhóm: A08 Cù Xuân Đức Nguyễn Khánh Hòa 41000722 41001160 cu u du on g th an co n g BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU TP HỒ CHÍ MINH - 4/2013 [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 BÀI 1: THỰC HIỆN CÁC BỘ LỌC FIR TRÊN KIT C6713 DSK Thiết kế lọc FIR chắn dải phương pháp Kaiser Window có thơng số sau: a Chiều dài đáp ứng xung N = 89 (Bậc lọc: 88) b Tần số cắt: 2500 2900 Hz c Giá trị β= d Tần số lấy mẫu: kHz Thực lọc lên kit kiểm tra kết cu u du on g th an co n g c om Thực lọc matlab: Sau dùng lệnh h=round(bs2700.tf.num*2^15) để lấy thông số nhập vào file coefficient.h ccs Thực lọc :  Mở c6713dsk:  Kết nối CCS với KIT: Debug  Connect [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt March 21, 2013 c om [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] du on g th an co n g  Mở tập tin project có tên FIR.pjt C:\Program Files\CCStudio_v3.1\myproject\FIR cu u  Mở tập tin coeficients.h phần include mở rộng thuộc project view  Nhập số liệu : N=89, copy ma trận cof từ Array Editor MatLab thay khoảng trắng dấu “,” (Bằng lệnh “Ctr + H”) [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 cu u du on g th an co n g c om  Thiết lập thông số ProjectBuild Options  Trong thẻ Compiler  Trong thẻ Linker [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk March 21, 2013 co n g c om [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] Lúc thư mục C:\Program Files\CCStudio_v3.1\MyProjects\FIR\Debug th an Sẽ xuất tập tin FIR.out , tập tin ta dung để nạp lên KIT on g  Biên dịch: Project  Rebuild All cu u du Sau CCS chạy xong : Vào File  Load Program dẫn tới file FIR.out  Chạy chương trình Debug  Run : bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 cu u du on g th an co n g c om  Quan sát đáp ứng lọc Graph  Time/Frequency Thiết lập thông số Graph Property Dialog sau: bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk March 21, 2013 c om [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] cu u du on g th an co n g Đáp ứng sau: bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 Kiểm tra lọc vừa thiêt kế: du on g th an co n g c om Kết mô kit: Thiết kế lọc FIR thông dải phương pháp Kaiser Window với thông số sau: u a Chiều dài đáp ứng xung: 81 cu b Tần số cắt: 1500 2000 Hz c Giá trị β = d Tần số lấy mẫu: kHz Thực lọc kiểm tra kết Thực lọc matlab bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk March 21, 2013 th an co n g c om [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] g Sau dùng lệnh h=round(bp1750.tf.num*2^15) để lấy thông số nhập vào file coefficient.h ccs cu u du on Đáp ứng quan sát sau nạp giá trị cof CCS: Kết mô kit: bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk March 21, 2013 c om [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] Thực thiết kế lọc thông cao sau phương pháp Kaiser Window co n thích kết Các thông số lọc sau: g Sau đó, cho tín hiệu xung vng tần số kHz vào hiển thị tín hiệu Giải a Chiều dài đáp ứng xung: 81 an b Tần số cắt: 2200 Hz d Tần số lấy mẫu: kHz cu u du on g Thực lọc matlab th c Giá trị β = bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 10 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 BÀI 4: THỰC HIỆN MỘT SỐ MẠCH ĐIỀU CHẾ TRÊN KIT C6713 DSK I- Thực điều chế PAM kit C6713 DSK  Giải thuật điều chế: c om Mỗi mẫu vào điều chế gồm 16 bits Tùy vào loại điều chế PAM, mặt nạ (mask) thích hợp sử dụng Các mẫu nhập vào AND với mặt nạ dịch với số lần thích hợp đến hết chiều dài chuỗi Tương ứng với ký hiệu (symbol) mẫu nhập vào loại điều chế ta có mức điện áp khác nhau, để dạng sóng xuất sau A/D có dạng sóng vng, mức xuất 12 lần trước chuyển sang symbol Sau vào cụ thể loại điều chế Điều chế PAM mức du on g th an co n g - Cấp nguồn điện cho kit chạy chương trình CCS máy tính - Mở Project PAM.pjt folder C:\Program Files\CCStudio_v3.1\MyProjects\PAM4  Giải thích code: + Trong chương trình hàm main() đặt giá trị biến i_PAM = khởi động kit Sau thực vịng lặp vơ hạn với lệnh while(1) + Khi có tín hiệu xung lấy mẫu (tần số 8Khz), ngắt 11 xảy trình phục vụ ngắt c_int11() gọi Trong trình phục vụ ngắt này, liệu vào đọc vào biến sample_data (bằng lệnh sample_data = input_sample(), thích số 3) Mẫu liệu biểu diễn dạng số nguyên 16 bits có dấu + Do thực điều chế PAM mức, mà để biểu diễn mức cần bit Do mẫu vào chia làm ký hiệu (symbol), ký hiệu bit Để thực việc chia này, mẫu liệu AND với mặt nạ 0x0003 (ơ thích số )để lấy bit LSB cảu mẫu liệu bit ánh xạ thành mức điện áp theo bảng sau: Bảng tra mức: cu u Khối ký hiệu Mức điện áp (dạng hex) Mức điện áp (dạng thập phân) 0x7FFF 32767 00 0x2AAA 10922 01 -0x2AAB 10923 10 -0x8000 32768 11 giá trị khai báo đầu chương trình (ơ thích số 1) Mỗi symbol cho mức điện áp Mỗi mức xuất 12 lần trước chuyển sang mức ứng với symbol Biến đếm j_PAM để đếm số lần xuất cho đủ 12 lần Như ứng với mẫu vào 16 bit, ta có symbol Mỗi symbol xuất 12 lần nên số lần xuất ứng với mẫu 8x12 = 96 thể biến đếm i_PAM (ô thích số 2) - Biên dịch nạp chương trình lên kit - Kiểm tra kết Plot CCS Việc sử dụng máy phát sóng khó để kiểm chứng kết nên ta gán cho sample_data giá trị cụ thể 16 bit (dạng số HEX, thích số 3) bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 37 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 cu u du on g th an co n g c om Lưu ý: thơng số lựa chọn cho việc thể dạng sóng sau: sample_data = 0x00E4 = 0b00 00 00 00 11 10 01 00 bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 38 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 co n g c om sample_data = 0x001B = 0b00 00 00 00 00 01 10 11 cu u du on g th an sample_data = 0x1BE4 = 0b00 01 10 11 11 10 01 00 Nhận xét : Kết thu với lý thuyết, tương ứng với biên độ lớn 00, âm 11 bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 39 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 Điều chế PAM mức Thực lại tương tự PAM mức Mở Project PAM.pjt folder C:\Program Files\CCStudio_v3.1\MyProjects\PAM4 Sự khác biệt so với PAM mức mặt nạ, số bit dịch bảng tra Đối với PAM 8, bit có trọng số thấp (LSB) mẫu vào loại bỏ để số bit lại (15) bội Điều gây tác động không đáng kể lên dạng sóng điều chế dạng sóng khơi phục lại Do số lần xuất ứng với mẫu (15/3)x12 = 60 Bảng tra mức: Khối ký hiệu Mức điện áp (dạng số Hex) Mức điện áp (dạng thập phân) 0x7FFF 32767 000 0x5B6D 23405 001 0x36DB 14043 010 0x 1249 4681 011 -0x1249 -4681 100 -0x36DB -14043 101 -0x5B6D -23405 110 -0x7FFF -32767 111 c om - co n an th #include //Initialization: int i_PAM; int j_PAM; int k; int masked_value, output; g Sửa lại tập tin PAM4.c sau: #include "DSK6713_aic23.h" Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; - on g int data_4PAM[8] = {0x7FFF, 0x5B6D, 0x36DB, 0x1249, -0x1249, -0x36DB, -0x5B6D, 0x7FFF}; du int out_buffer[256]; int i=0; //interrupt service routine cu u interrupt void c_int11() { int sample_data; if (i_PAM==60) //( shifts x 12 repeated outputs = 60 samples) { sample_data = input_sample(); //inputs data sample_data = sample_data >>1; i_PAM=0; j_PAM=0; } masked_value = sample_data & 0x0007; output = data_4PAM[masked_value]; output_sample(output); out_buffer[i++] = output; if (i==256) i = 0; j_PAM++; //repeated output counter if (j_PAM==12) //checks if repetition is over bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 40 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 { j_PAM=0; sample_data = sample_data >> 3; } i_PAM++; return; } void main() { i_PAM=0; comm_intr(); while(1); //init DSK, codec, McBSP //infinite loop } - Biên dịch & nạp chương trình lên kit & kiểm tra kết tương tự PAM cu u du on g th an co n g c om sample_data = 0x8D10 = 0b100 011 010 001 000 bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 41 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 co n g c om sample_data = 0x72EF = 0b011 100 101 110 111 cu u du on g th an sample_data = 0x3546 = 0b001 101 010 100 011 Nhận xét: Kết thu phù hợp với lý thuyết Điều chế PAM 16 mức - Thực lại tương tự PAM mức bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 42 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] - March 21, 2013 Mở Project PAM.pjt folder C:\Program Files\CCStudio_v3.1\MyProjects\PAM4 Điều chế PAM 16 mức, để biểu diễn cần bit Do mẫu ta có symbol(16/4), số lần xuất ứng với mẫu 4x12 = 48 Mặt nạ 0x000F để lấy bit LSB mẫu liệu Bảng tra 16 mức: an co n g c om Khối ký hiệu Mức điện áp (dạng số Hex) Mức điện áp (dạng thập phân) 0x7FFF 32767 0000 0x6EEE 28398 0001 0x 5DDD 24029 0010 0x4CCC 19660 0011 0x3BBB 15291 0100 0x2AAA 10922 0101 0x1999 6553 0110 0x0888 2184 0111 -0x0889 -2185 1000 -0x199A -6554 1001 -0x2AAB -10923 1010 -0x3BBC -15292 1011 -0x4CCD -19661 1100 -0x5DDE -24030 1101 -0x6EEF -28399 1110 -0x8000 -32768 1111 th Sửa lại tập tin PAM4.c sau: on g #include "DSK6713_aic23.h" Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; u du #include //Initialization: int i_PAM; int j_PAM; int k; int masked_value, output; cu int data_4PAM[16] = {0x7FFF, 0x6EEE, 0x5DDD, 0x4CCC, 0x3BBB, 0x2AAA, 0x1999, 0x0888, 0x0889, -0x199A, -0x2AAB, -0x3BBC, -0x4CCD, -0x5DDE, -0x6EEF, -0x8000}; - int out_buffer[256]; int i=0; interrupt void c_int11() //interrupt service routine { int sample_data; if (i_PAM==48) // (4 shifts x 12 repeated outputs) { sample_data = input_sample(); i_PAM=0; j_PAM=0; } masked_value = sample_data & 0x000f; //masks input sample as 4-bit segments output = data_4PAM[masked_value]; output_sample(output); out_buffer[i++] = output; if (i==256) i = 0; bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 43 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 j_PAM++; //repeated output counter if (j_PAM==12) //checks if repetition is over { j_PAM=0; sample_data = sample_data >> 4; //shifts input to mask next segment } i_PAM++; return; } void main() { i_PAM=0; comm_intr(); while(1); //init DSK, codec, McBSP //infinite loop - c om } Biên dịch & nạp chương trình lên kit & kiểm tra kết tương tự PAM cu u du on g th an co n g sample_data = 0x3210 = 0b0011 0010 0001 0000 bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 44 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 co n g c om sample_data = 0xFEDC = 0b1111 1110 1101 1100 cu u du on g th an sample_data = 0x9687 = 0b1001 0110 1000 0111 Nhận xét: Kết thu phù hợp với lý thuyết II- Thực mạch điều chế PSK kit C6713 DSK  Giải thuật điều chế: Mỗi mẫu vào thu lưu vào vị trí nhớ, chứa 16 bits Tùy theo kiểu điều chế PSK (2 hay pha), mặt nạ thích hợp sử dụng Đối với BPSK, bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 45 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 giá trị vào chia làm 16 phần, thành phần bit; QPSK, mẫu vào chia thành dibits (mỗi dibit gồm bit) Việc đạt cách áp mặt nạ tương ứng 0x0001 0x0003 lên mẫu vào Sau đó, mẫu dịch phải bit (BPSK) bit (QPSK) lặp lại cho hết chiều dài mẫu vào Mỗi mẫu vào biểu diễn 16 bits Mỗi mẫu gồm 16 đoạn (với BPSK) đoạn (với QPSK) Do ký hiệu truyền hình sine tạo theo phương pháp số điểm, 64 mẫu (với BPSK) 32 mẫu (với QPSK), mẫu vào lấy vào Điều chế BPSK - Cấp nguồn điện cho kit chạy chương trình CCS máy tính Mở Project BPSK.pjt folder C:\Program Files\CCStudio_v3.1\MyProjects\BPSK Trong cửa sổ File View, mở tập tin BPSK.c, nội dung tập tin sau: co n g #include //Initialization: int i_BPSK; int j_BPSK; int k; int masked_value, output; int out_buffer[256]; int i=0; c om //BPSK #include "DSK6713_aic23.h" Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //0 degree //180 degree //interrupt service routine th interrupt void c_int11() { int sample_data; an //Data table for BPSK int data_BPSK[2][4]={0, 1000, 0, -1000, 0, -1000, 0, 1000}; du on g if (i_BPSK==64) //determines when to get new input { sample_data = input_sample(); //inputs data i_BPSK=0; j_BPSK=0; } cu u masked_value = sample_data & 0x0001; //masks input sample as 1-bit segments output = data_BPSK[masked_value][j_BPSK];//gets corresponding level from table output_sample(output*10); out_buffer[i++] = output*10; if (i==256) i = 0; j_BPSK++; //repeated output counter if (j_BPSK==4) //checks if 1-bit segment was output { j_BPSK=0; sample_data = sample_data >> 1; } i_BPSK++; return; } void main() { i_BPSK=64; j_BPSK=0; 2’’ ’’ bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 46 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 comm_intr(); //init DSK, codec, McBSP while(1); //infinite loop } th an co n g c om  Giải thích code: + Hàm main() đặt biến đếm i_BPSK = 64 j_BPSK = 0, khởi động kit codec chạy vịng lặp vơ tận Khi có xung lấy mẫu, ngắt 11 kích hoạt trình phục vụ ngắt c_int11() gọi + Trình phục vụ ngắt đọc mẫu liệu ngõ vào Mẫu biểu diễn 16 bit Khi điều chế BPSK, symbol gồm bit (để phân biệt pha o 180o cần bit), đó, mẫu vào chia làm 16 symbol cách sử dụng mặt nạ 0x0001 để lấy bit LSB (ơ thích số 4) Tùy bit hay mà xuất dạng sóng sine có pha tương ứng + Trong chương trình trên, giá trị khai báo biến data_BPSK[2][4] Đây la mảng chiều kích thước 2x4 thể dạng sóng sine: pha o {0, 1000, 0, -1000} pha 180o {0, -1000, 0, 1000} (ơ thích số1) Giá trị thể biên độ sóng sine chu kỳ, thời điểm 0,T/4, T/2,3T/4 (T chu kỳ) + Sau xuất đủ điểm, mẫu dịch phải bit (ơ thích số 5) lấy mặt nạ bit LSB Lặp lại hết chiều dài mẫu + Như mẫu vào 16 bit có 16 symbol, symbol tạo chu kỳ sóng sine gồm điểm, với mẫu vào, chương trình xuất 4x16 = 64 mẫu biến đếm i_BPSK giúp xác định phép lấy mẫu vào (ơ thích số & 2’) - Tương tự PAM, sửa lệnh sample_data = input_sample() thành sample_data = 0x???? (một giá trị 16 bit dạng số hex) biên dịch, nạp chạy chương trình Kiểm chứng kết thu Plot CCS cu u du on g Lưu ý: thông số lựa chọn cho việc thể dạng sóng sau: bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 47 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 sample_data = 0x0F0F = 0b0000 1111 0000 1111 đảo pha đảo pha co n g c om đảo pha cu u du on g th an sample_data = 0x5555 = 0b0101 0101 0101 0101 & hoán đổi liên tục nên pha đảo liên tục từ phải sang trái hình sau: sample_data = 0x9999 = 0b1001 1001 1001 1001 Lý giải kết tương tự, ta có hình sau: bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 48 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk March 21, 2013 co n g c om [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] th Thực hoàn toàn tương tự điều chế BPSK Điều chế QPSK cần pha: o, 90o, 180o, 270o nên cần khai báo mảng 4x4: sóng sine lệch pha 90o, sóng có điểm Số mẫu cho QPSK 4x8 = 32 Mặt nạ thích hợp để lấy bit (biểu diễn trạng thái) 0x0003, lần dịch bit Do sửa lại tập tin BPSK.c sau : on g - an Điều chế QPSK du #include "DSK6713_aic23.h" Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; cu u #include //Initialization: int i_BPSK; int j_BPSK; int k; int masked_value, output; int out_buffer[256]; int i=0; int data_QPSK[4][4]={0, 1000, 0, -1000, //0 degree 1000, 0, -1000, 0, //90 degree 0, -1000, 0, 1000, //180 degree -1000, 0, 1000, 0}; //270 degree interrupt void c_int11() { int sample_data; //interrupt service routine if (i_BPSK==32) //determines when to get new input { sample_data = input_sample(); //inputs data i_BPSK=0; j_BPSK=0; bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 49 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [BÁO CÁO THÍ NGHIỆM XỬ LÍ SỐ TÍN HIỆU] March 21, 2013 } masked_value = sample_data & 0x0003; output = data_QPSK[masked_value][j_BPSK]; output_sample(output*10); out_buffer[i++] = output*10; if (i==256) i = 0; j_BPSK++; //repeated output counter if (j_BPSK==4) //checks if 1-bit segment was output { j_BPSK=0; sample_data = sample_data >> 2; } i_BPSK++; return; } c om void main() { i_BPSK=32; j_BPSK=0; comm_intr(); while(1); //init DSK, codec, McBSP //infinite loop Sửa lệnh sample_data = input_sample() thành sample_data = 0x???? (một giá trị 16 bit dạng số hex) biên dịch, nạp chạy chương trình Kiểm chứng kết thu Plot CCS an - co n g } 0o 270o 180o 90o 0o cu u du on g th sample_data = 0x00E4 = 0x00 00 00 00 11 10 01 00 bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk [Type text] CuuDuongThanCong.com Page 50 https://fb.com/tailieudientucntt bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk bao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dskbao.cao.thi.nghiem.xu.li.so.tin.hieu.thuc.hien.cac.bo.loc.fir.tren.kit.c6713.dsk

Ngày đăng: 02/01/2024, 23:18

Tài liệu cùng người dùng

Tài liệu liên quan