Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
資深會員
|
去 左邊 "下載中心" , "RTC 實作及PDF講義" 找 .......
發表於: 2009/10/28 5:15
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
新會員
|
是201_ASP (繁體中文版本)嗎? <<<有找到
還是210 ASP 教育訓練? <<<找不到這個 討論區好像沒有原理?
發表於: 2009/10/27 21:18
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
新會員
|
不是很清楚AN0為何要設為輸入???
void Init_System(void)設定好了 之前沒注意到 PORTB是輸出. DATASHEET因為英文不是很好所以看的很吃力 現在有值了 VIEW>SPECIAL FUNCTION REGISTRES裡查道 ADRESH值為0X00~0XFF 反而是不知道怎分成10段目前可以分成2段...
發表於: 2009/10/22 16:19
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
資深會員
|
an0 腳位有無設為 INPUT ?
發表於: 2009/10/22 4:24
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
新會員
|
不知道要如何判別只知道5V特輸入
可能因為這個原因導致無法判斷?
發表於: 2009/10/21 22:29
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
版主
|
請問一下 : 你知道ADC 輸入5V 時期 AD 轉換的結果為何?
ADRESH : ADRESL 的內容值??
發表於: 2009/10/21 11:11
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
新會員
|
為什麼我程式還是無法判別5V特以上輸出什麼
5V特以下輸出什麼 程式如下:
#include <pic.h>
發表於: 2009/10/20 22:30
Edited by Ryang on 2009年10月21日 11:08:10
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
資深會員
|
>>所以想請問哪行指令在說明輸入電壓(5V)後轉換
>>可以說明一下嗎? 這個吧!! (A2D副程式中)
ADGO = 1; // Initiate conversion on selected channel
發表於: 2009/9/30 10:44
|
|||
|
Re: 關於16f877a?無法顯示
|
||||
---|---|---|---|---|
新會員
|
這是參考一些資料來的
我也不太懂內容 所以想請問哪行指令在說明輸入電壓(5V)後轉換 可以說明一下嗎? 好像不能判斷所以改成這樣 #include <pic.h> #include "cnfig877a.h" //********************************** // Function Prototype Declaration //********************************** void Init_IO(void); void Init_Adc( void ); void A2D( unsigned char ); void Init_System(void); void Delay_x_mS(int); void Delay_1mS(void); // ================================================================ // **** Establish PIC16F877A Configuration Word // **** == HS Oscillator Mode // **** == Brown-Out Detect Enabled // **** == Watch-Dog Timer Off // **** == Code Protect Off // **** == Low Voltage Programming Off // **** == ICD2 Debug Mode On __CONFIG ( XT_OSC & BODEN_OFF & WDT_OFF & CP_OFF & LVP_OFF & DEBUG_ON ); // ================================================================= const char RBarray[ ]={0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f}; unsigned int AD_Temp; bit DS_Zero_Flag; union { int AD_10bit; struct { char AD_LSB; char AD_MSB; }AD_Byte; }AD_Int; //***************************** // INITIALIZE I/O PORT //***************************** void Init_IO(void) { ADCON1=0b00000110; } //***************************************** // Initialize A/D & Comparator Module //****************************************** void Init_Adc( void ) { CMCON=0b000000111; ADCON1=0b00001110; ADFM=0; ADCON0=0b10000001; } //*********************************** // Convert A/D Channel /************************************ void A2D( unsigned char channel ) { unsigned char temp; // Temp storage temp = channel << 3; // Shift channel value three bits left ADCON0 &= 0b11000111; // Clear channel select bits in ADCON0 ADCON0 |= temp; // Logically OR shifted channel value into place in ADCON0 ADGO = 1; // Initiate conversion on selected channel while (ADGO) ; // Poll ADGO bit until it clears, indicating conv. done AD_Int.AD_Byte.AD_MSB=ADRESH; AD_Int.AD_Byte.AD_LSB=ADRESL; } //*************************************** //* Program Main ( ) * //*************************************** void main(void) { Init_IO(); Init_Adc(); Init_System(); while(1) { // A2D(0); PORTB=RBarray[???/除一個值吧]; } } //********************************* //* Delay Routine with 16MHz //********************************* void Delay_x_mS( int N_mS ) { int Loop_mS ; for ( Loop_mS = 0 ; Loop_mS < N_mS ; Loop_mS++ ) { Delay_1mS(); } } //*** Delay 6.0642mS with 4MHz crystal void Delay_1mS(void) { int Del_1mS; for (Del_1mS = 0 ; Del_1mS < 199 ; Del_1mS ++ ) { //asm("nop"); //asm("nop"); } } /***************************** INITIALIZE SYSTEM *****************************/ void Init_System(void) { PORTB = 0x00; TRISB = 0x00; };
發表於: 2009/9/30 2:07
|
|||
|