• slider image 442
  • slider image 492
  • slider image 493
  • slider image 494
  • slider image 495
  • slider image 496
:::


Browsing this Thread:   1 Anonymous Users




(1) 2 »


Re: 關於16f877a?無法顯示
#12
資深會員
資深會員


查看用戶資訊
去 左邊 "下載中心" , "RTC 實作及PDF講義" 找 .......

發表於: 2009/10/28 5:15
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#11
新會員
新會員


查看用戶資訊
是201_ASP (繁體中文版本)嗎? <<<有找到

還是210 ASP 教育訓練? <<<找不到這個

討論區好像沒有原理?

發表於: 2009/10/27 21:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#10
版主
版主


查看用戶資訊
所已說你對 AD 的轉換觀念及轉換的結果不是很了解。你知道AD轉亂器的參考點壓與轉換結果的關係嗎? 如果不了
解這層關係,建議你還是從基礎原理先讀一下,這樣轉出來的 AD 值你才有能力去判斷是否正確。否則只是在多少輸入電壓上打轉,而無法曾正懂的。

有關AD轉換元李可以在此討論區去搜尋一下,先前有諸多此類的討論,還有可以看一下210 ASP 教育訓練。

發表於: 2009/10/26 10:28
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#9
新會員
新會員


查看用戶資訊
不是很清楚AN0為何要設為輸入???
void Init_System(void)設定好了 之前沒注意到
PORTB是輸出.

DATASHEET因為英文不是很好所以看的很吃力

現在有值了
VIEW>SPECIAL FUNCTION REGISTRES裡查道
ADRESH值為0X00~0XFF
反而是不知道怎分成10段目前可以分成2段...

發表於: 2009/10/22 16:19
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#8
資深會員
資深會員


查看用戶資訊
an0 腳位有無設為 INPUT ?
   
PORTB 有無設為 OUTPUT ?  ;  void Init_System(void擺好看的 ?

  
void Init_IO(void)  變成設定   A/D  ?

  
雖然是寫 C DATASHEET 還是要看一下 .......

發表於: 2009/10/22 4:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#7
新會員
新會員


查看用戶資訊
不知道要如何判別只知道5V特輸入

可能因為這個原因導致無法判斷?

發表於: 2009/10/21 22:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#6
版主
版主


查看用戶資訊
請問一下 : 你知道ADC 輸入5V 時期 AD 轉換的結果為何?

ADRESH : ADRESL 的內容值??

發表於: 2009/10/21 11:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#5
新會員
新會員


查看用戶資訊
為什麼我程式還是無法判別5V特以上輸出什麼
5V特以下輸出什麼

程式如下:
#include <pic.h>        
#include "cnfig877a.h"

//**********************************
//* Function Prototype Declaration
//**********************************
void Init_IO(void);
void Init_Adcvoid );
void A2Dunsigned char );

// ================================================================
// **** 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 ); 

// =================================================================

volatile unsigned char idex ;

const 
char RBarray[ ]={0x3f0x060x5b0x4f0x660x6d0x7d0x070x7f0x6f};

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;        
    
//TRISD=0x00;                
    //PORTD=0x80;                
    //TRISA4=1;            
    //TRISE1=1;                
}


/*****************************************
    Initialize A/D & Comparator Module
******************************************/

void Init_Adcvoid )
{
    
CMCON=0b000000111;    
    
ADCON1=0b00001110;        
    
ADFM=1;                
    
ADCON0=0b10000001;         
}    
                                       
/***********************************
        Convert A/D Channel
************************************/

void A2Dunsigned char channel )
{
    
unsigned char temp;                

    
temp channel << 3;        
    
ADCON0 &= 0b11000111;            
    
ADCON0 |= temp;                 
 
    
ADGO 1;                
    while (
ADGO) ;                
    
AD_Int.AD_Byte.AD_MSB=ADRESH;
    
AD_Int.AD_Byte.AD_LSB=ADRESL;


//***************************************
//*             Program Main ( )        *
//***************************************
void main(void)
{
    
Init_IO();
    
Init_Adc();

    while(
1)
    {
        
A2D(0);                        
    if( 
ADRESH)
    {
    
PORTB=RBarray[0];
    }
    else
    {
        if( (
ADRESH>= 5
        {
        
PORTB=RBarray[1];
        }
        else
        {
        
PORTB=RBarray[2];
        }
    }        
    }
}

/*****************************
    INITIALIZE SYSTEM
*****************************/

void Init_System(void)
{
    
PORTB 0x00;            
    
TRISB 0x00;                
    
PORTA 0x00;
    
TRISA 0X00;
    
};

發表於: 2009/10/20 22:30

Edited by Ryang on 2009年10月21日 11:08:10
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#4
資深會員
資深會員


查看用戶資訊
>>所以想請問哪行指令在說明輸入電壓(5V)後轉換
>>可以說明一下嗎?

這個吧!! (A2D副程式中)
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;
}

發表於: 2009/9/30 10:44
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16f877a?無法顯示
#3
新會員
新會員


查看用戶資訊
這是參考一些資料來的
我也不太懂內容
所以想請問哪行指令在說明輸入電壓(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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------