Página 1 de 1

Timer0 - CCS - PIC16F505

MensagemEnviado: 04 Mar 2008 00:15
por Flaviofrc
Olá amigos,

Estou enfrentando o seguinte problema: Estou programando o PIC16F505 com CCS modulo PCB e não consigo descobrir como é o acesso ao timer 0 e sua interrupção.....

Alguem saberia m dizer como acessa-lo, configura-lo e usá-lo.....


Obrigado

MensagemEnviado: 04 Mar 2008 11:39
por LeandroPIC
De uma olhada no datasheet do pic, e se restar duvidas POST.

MensagemEnviado: 04 Mar 2008 13:23
por Flaviofrc
LeandroPIC escreveu:De uma olhada no datasheet do pic, e se restar duvidas POST.


Acho aque você não entendeu..... vou repetir, estou programando em CCS modulo PCB 12bits e não tenho acesso ao timer0, ou pelo menos não sei como fazer isso.

Se essa informação estivesse no datasheet (referente a linguagem C CCS) não estaria perguntando...

Em fim quero saber como lidar com o timer0 em C.....


t+

MensagemEnviado: 04 Mar 2008 13:58
por fabim
Boa tarde flavio.

Seguinte independente do tipo de linguagem que usar, todos os registradores do pic são acessiveis.

TMER0 = variavel de contagem de tempo.

OPTION.T0SE = liga desliga incremento pelo pino GPIO5 se for usar externo

OPTION.T0CS = seleciona incremento por pino GPIO5 ou ck/4 "frequencia do cristal usado / 4 "

OPTION.PS0,1,2 << preescaler seja interno ou externo

OPTION.PSA = incrementa direto do CLOCK/4 ou GPIO5, ou incrementa TMR0 através do preescaler.

Para saber o numero do bit caso o compilador não aceite mnemonicos.

http://www.ortodoxism.ro/datasheets2/7/ ... 3ks8cy.pdf

PG 35 e 36,37,38,39 expinica como proceder

Espero ter ajudado fabim.

MensagemEnviado: 04 Mar 2008 15:03
por ze
olá, caso seu compilador não tenha você pode criar seus próprios #defines para o timer0.

O ccs (éca!) eu não sei como faz. Mas veja como o hitech c monta alguns registradores para este pic para o usuário:

Código: Selecionar todos
static volatile unsigned char   RTCC   @ 0x01;
static volatile unsigned char   TMR0   @ 0x01; //end. absoluto
static volatile unsigned char   PCL   @ 0x02;
static volatile unsigned char   STATUS   @ 0x03;
static          unsigned char   FSR   @ 0x04;
static volatile unsigned char   OSCCAL   @ 0x05;
static volatile unsigned char   PORTB   @ 0x06;
static volatile unsigned char   PORTC   @ 0x07;
static          unsigned char control   OPTION   @ 0x00;
static volatile unsigned char control   TRISB   @ 0x06;
static volatile unsigned char control   TRISC   @ 0x07;
/*   STATUS bits   */
static volatile bit    RBWUF   @ (unsigned)&STATUS*8+7; //bits do end. absoluto
static volatile bit   PA0   @ (unsigned)&STATUS*8+5;
static volatile bit    TO   @ (unsigned)&STATUS*8+4;
static volatile bit    PD   @ (unsigned)&STATUS*8+3;
static volatile bit    ZERO   @ (unsigned)&STATUS*8+2;
static volatile bit   DC   @ (unsigned)&STATUS*8+1;
static volatile bit   CARRY   @ (unsigned)&STATUS*8+0;
/*   OPTION bits   */
#define      RBWU   (1<<7)
#define      RBPU   (1<<6)
#define      T0CS   (1<<5)
#define      T0SE   (1<<4)
#define      PSA   (1<<3)
#define      PS2   (1<<2)
#define      PS1   (1<<1)
#define      PS0   (1<<0)


Para acessar é só fazer var=TMR0 ou TMR0=var, ora pois!
Já vem TUDO pronto para TODOS os uCs uXip. Desculpe a ignorância, mas o que vem a ser PCB mesmo?
Tenho dúvida se esta é a sua dúvida.
abrç

MensagemEnviado: 20 Out 2008 09:14
por elton de souza
Este PIC não possui interrupçaõ de timer... :cry: