Olá pessoal,
Alguém sabe me dizer aonde configuro o valor do Cristal utilizando o compilador da Microchip C18.
Utilizei o Project Wizard e não notei este campo, utilizo o MicroC onde e o mesmo tem um campo para configuração.
Obrigado.
Moderadores: andre_luis, 51, guest2003, Renie
//Oscillator Selection bits:
#pragma config FOSC = HS // HS oscillator
//#pragma config FOSC = HSPLL // HS oscillator, PLL enabled and under software control
//#pragma config FOSC = EC // EC oscillator, CLKO function on OSC2
//#pragma config FOSC = ECPLL // EC oscillator, PLL enabled and under software control, CLK function on OSC2
* PIC18 cycle-count delay routines.
*
* Functions:
* Delay1TCY()
* Delay10TCY() // 17Cxx only
* Delay10TCYx()
* Delay100TCYx()
* Delay1KTCYx()
* Delay10KTCYx()
*/
/* For definition of Nop() */
#include <p18cxxx.h>
/* Delay of exactly 1 Tcy */
#define Delay1TCY() Nop()
#define PARAM_SCLASS auto
/* Delay of exactly 10 Tcy */
#define Delay10TCY() Delay10TCYx(1)
/* Delay10TCYx
* Delay multiples of 10 Tcy
* Passing 0 (zero) results in a delay of 2560 cycles.
* The 18Cxxx version of this function supports the full range [0,255]
* The 17Cxxx version supports [2,255] and 0.
*/
void Delay10TCYx(PARAM_SCLASS unsigned char);
/* Delay100TCYx
* Delay multiples of 100 Tcy
* Passing 0 (zero) results in a delay of 25,600 cycles.
* The full range of [0,255] is supported.
*/
void Delay100TCYx(PARAM_SCLASS unsigned char);
/* Delay1KTCYx
* Delay multiples of 1000 Tcy
* Passing 0 (zero) results in a delay of 256,000 cycles.
* The full range of [0,255] is supported.
*/
void Delay1KTCYx(PARAM_SCLASS unsigned char);
/* Delay10KTCYx
* Delay multiples of 10,000 Tcy
* Passing 0 (zero) results in a delay of 2,560,000 cycles.
* The full range of [0,255] is supported.
*/
void Delay10KTCYx(PARAM_SCLASS unsigned char);
#endif
//-----------------------------------------------------------------------------
//DelayTXBitGPS
//-----------------------------------------------------------------------------
//(((((2*Fosc)/(4* baud))+1)/2) - 12) in cycles
//Fosc = 11059200 Hz
//baud = 9600
//cycles = 276,5 => 276
void DelayTXBitUART(void)
{
_asm
movlw 92 // cycles/3 = 276/3 = 92
delaygps1:
decfsz WREG,1,0
bra delaygps1
nop
_endasm
}
//-----------------------------------------------------------------------------
//DelayRXBitGPS
//-----------------------------------------------------------------------------
//(((((2*Fosc)/(4* baud))+1)/2) - 14) in cycles
//Fosc = 11059200 Hz
//baud = 9600
//cycles = 274,5 => 274
void DelayRXBitUART(void)
{
_asm
movlw 91 // cycles/3 = 274/3 = 91,5
delaygps2:
decfsz WREG,1,0
bra delaygps2
nop
_endasm
}
//-----------------------------------------------------------------------------
//DelayRXHalfBitGPS
//-----------------------------------------------------------------------------
//(((((2*Fosc)/(8* baud))+1)/2) - 9) in cycles
//Fosc = 11059200 Hz
//baud = 9600
//cycles = 135,5 => 135
void DelayRXHalfBitUART(void)
{
_asm
movlw 45 // cycles/3 = 135/3 = 45
delaygps3:
decfsz WREG,1,0
bra delaygps3
nop
_endasm
}
//-----------------------------------------------------------------------------
Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante