PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > PIC - Thiết kế và Ứng dụng

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Bài Trong Ngày Vi điều khiển

PIC - Thiết kế và Ứng dụng Ý tưởng cho các sản phẩm sử dụng PIC/dsPIC và các sản phẩm của Microchip

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 28-05-2013, 10:29 PM   #1
love_1990
Nhập môn đệ tử
 
Tham gia ngày: May 2013
Bài gửi: 3
:
Nhờ các cao thủ giúp vs. chuyển sang file hex ko dc!

e đang làm đồ án. đề tài inverter . mà có file c giờ chuyển sang hex mà nó báo tùm lum lỗi hết.
có bác nào rành về vấn đề này ko??/ thì giúp e vs. trân thành cảm ơn rất nhiều. @@@@@
chương trình nó như sau. các bác xem giúp nha
sử dụng thạnh anh 20MH


#define USE_OR_MASKS
#include <p18f1320.h>
#include "pwm.h"
#include "timers.h"
//-------------------Configuration setting------------------
* Oscillator is configured as HS
* Fail safe monitor is enabled
* watch dog timer is disabled
* Extended instruction mode is disabled
* oscillator switch over is enabled
*/
#if defined(__18F1320) //If the selected device if PIC18F4685, then
apply below settings else user will have to set
#pragma config OSC=HS, FSCM=ON, WDT=OFF, IESO=ON, LVP=OFF
#endif

void main(void)
{
char period=0x00;
unsigned char outputconfig=0,outputmode=0,config=0;
unsigned int duty_cycle=0;
unsigned int timer=0;
unsigned int i=0;

unsigned int dutyCycle_Array[40]={0x005B, 0x0053, 0x004E, 0x0048, 0x0044,
0x0040, 0x003D, 0x003C, 0x003D, 0X0040, 0x0044, 0x0048, 0x004E,
0x0055, 0x005D, 0x0065, 0x006E, 0x0078, 0x0080, 0x0089, 0x0093,
0x009B, 0x00A3, 0x00A7, 0X00AF, 0X00B2, 0X00B5, 0X00B7, 0X00B7,
0X00B5, 0X00B4, 0X00B1, 0X00AB, 0X00A6, 0X009E, 0X0097, 0X008E,
0X0086, 0X007E};

OpenTimer2(T2_PS_1_4);

//------------------Configure pwm ---------

period = 0x3C;
OpenPWM1(period); //Configure PWM module and
initialize PWM period

while(1) //observe output on CCP1 pin
{
//---------------------set duty cycle---------------------------------------------------------
for(i=0;i<40;i++)
{
SetDCPWM1(dutyCycle_Array[i]); //set the duty cycle

//-------------------set pwm output---------------------------------------------------------.
outputconfig = FULL_OUT_FWD;
outputmode = PWM_MODE_1;
SetOutputPWM1( outputconfig, outputmode); //output PWM in
respective modes

outputconfig = FULL_OUT_REV;
outputmode = PWM_MODE_3;
SetOutputPWM1( outputconfig, outputmode);

}
}

//--------------------------close pwm----------------------------------------
ClosePWM1();

}
love_1990 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 


Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 03:10 AM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam