|
Tài trợ cho PIC Vietnam |
dsPIC - Bộ điều khiển tín hiệu số 16-bit Theo dự kiến của Microchip, vào khoảng năm 2011 dsPIC sẽ có doanh số lớn hơn PIC |
|
Ðiều Chỉnh | Xếp Bài |
05-11-2008, 02:08 PM | #13 |
Đệ tử 3 túi
Tham gia ngày: Apr 2006
Bài gửi: 54
: |
bác linh ơi, em làm theo như bác mà vẫn ko được, có lẽ thư viện của bác ko dùng được cho dspic, nhung mà em tắt WDT rồi mà vẫn bị hiện tượng cái led mắc ở chân Ẻ nháy 1 lúc theo đúng code rồi đúng lại 1 lúc, rồi nháy tiếp, và các chân Rs, E ... vẫn phát xung bác ah. Thật khó hiểu quá
Em ko thấy biểu tượng viết code của diễn đàn, nên em phải cop code vào đây, mong mod thông cảm Code: #include <30F4011.h> #FUSES NOWDT //No Watch Dog Timer #FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD) #FUSES PR //Promiary Oscillator #FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled #FUSES WPSB16 //Watch Dog Timer PreScalar B 1:16 #FUSES WPSA512 //Watch Dog Timer PreScalar A 1:512 #FUSES PUT64 //Power On Reset Timer value 64ms #FUSES NOBROWNOUT //No brownout reset #FUSES BORV47 //Brownout reset at 4.7V #FUSES LPOL_HIGH //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6) //PWM module low side output pins have active high output polar #FUSES HPOL_HIGH //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7) //PWM module high side output pins have active high output polarity #FUSES NOPWMPIN //PWM outputs drive active state upon Reset #FUSES MCLR //Master Clear pin enabled #FUSES NOPROTECT //Code not protected from reading #FUSES NOWRT //Program memory not write protected #FUSES NODEBUG //No Debug mode for ICD #FUSES NOCOE //Device will reset into operational mode #FUSES ICS0 //ICD communication channel 0 #FUSES RESERVED //Used to set the reserved FUSE bits #use delay(clock=11059200) #include <lcd_lib_4bit.c> void main() { // Set Output set_tris_b(0x00); set_tris_c(0x00); set_tris_d(0x00); set_tris_e(0x00); // Init LCD, 4bit mode lcd_init(); // Always call this first. lcd_putcmd(1); // Clear LCD //lcd_putc("\fNGUYEN THE TUNG\n"); // Vi?t nhu th? này là sai, vì hàm lcd_putc ch? nh?n d?i s? là 1 byte char printf(lcd_putchar,"NGUYEN THE TUNG"); lcd_putcmd(0xC0 + 4); // hàng 2 c?t 4 //lcd_putc("DTD45-DH1"); printf(lcd_putchar,"DTD45-DH1"); while(1) { output_low(PIN_E3); delay_ms(250); output_high(PIN_E3); delay_ms(250); } } |
|
|