Migrar de 16f76 para 18f252

Software e Hardware para uC PIC

Moderadores: andre_luis, 51, guest2003, Renie

Migrar de 16f76 para 18f252

Mensagempor shhadowzone » 19 Mar 2007 14:56

Por acaso alguém por ai tem como me dar uma sugestão de como fazer a migração do PIC F76 para o F252?
TEm a seguinte configuração:

__CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _XT_OSC & _WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF


BANK1 MOVLW B'00111111' MOVWF TRISA
MOVLW B'00001111' MOVWF TRISB MOVLW B'00000000' MOVWF TRISC MOVLW B'00000000' MOVLW B'10000010' MOVWF OPTION_REG ;PRESCALER 1:32 NO TMRO
;PULL_UPS DESABILIADOS, DEMAIS BITS IRRELEVANTES
MOVLW B'10000000' ;CHAVE GERAL DE INTERRUPCAO DESLIGADA
MOVWF INTCON MOVLW B'00000111' ;DEFINE PORTA COMO I/0 DIGITAIS
MOVWF ADCON1 MOVLW B'11000000'
MOVWF INTCON ; CONFIGURA INTERRUPÇÕES
; HABILITADA A INTERRUPÇÃO DE TIMER0
; HABILITA AS INTERRUPÇÕES DE PERIFÉRICO
MOVLW B'00000001'
MOVWF PIE1 ; CONFIGURA INTERRUPÇÕES DE PERIFIÉRICOS
; HABILITADA A INTERRUPÇÃO DE TMR1
BANK0 ; SELECIONA BANCO 0 DA RAM
MOVLW B'00110000'
MOVWF T1CON ; CONFIGURA TMR1
; PRESCALER -> 1:8
; INCREMENTADO PELO CICLO DE MÁQUINA


Se alguém puder me dar uma dica...
shhadowzone
Bit
 
Mensagens: 23
Registrado em: 24 Out 2006 07:19

Mensagempor microeletronica » 19 Mar 2007 20:47

no f252 vc temn muito mais fuses.
eh simples...

Tome cuidado com as configuracoes....
ADCON1 eh diferente
TMR1 eh diferente - 16 bits

Tome cuidado com isso tambem:
When the Timer1 oscillator is enabled (T1OSCEN is
set), the RC1/T1OSI and RC0/T1OSO/T1CKI pins
become inputs. That is, the TRISC<1:0> value is
ignored, and the pins are read as ‘0’.

Pra desabilitar os pull ups no portb, utilize 0 no bit 7 de INTCON2

Sobre configuration bits, dah uma olhada em:

http://forum.microchip.com/tm.aspx?m=39372
http://forum.microchip.com/tm.aspx?m=162967
microeletronica
Byte
 
Mensagens: 158
Registrado em: 05 Dez 2006 18:22

Mensagempor microeletronica » 20 Mar 2007 22:43

Sobre configuration bits, ta ai um exemplo pro 452:

Código: Selecionar todos
// Configuration settings available for processor 18F452

//#pragma config OSC = LP            //Oscillator Selection:LP
//#pragma config OSC = XT            //Oscillator Selection:XT
#pragma config OSC = HS            //Oscillator Selection:HS
//#pragma config OSC = RC            //Oscillator Selection:RC
//#pragma config OSC = EC            //Oscillator Selection:EC-OSC2 as Clock Out
//#pragma config OSC = ECIO          //Oscillator Selection:EC-OSC2 as RA6
//#pragma config OSC = HSPLL         //Oscillator Selection:HS-PLL Enabled
//#pragma config OSC = RCIO          //Oscillator Selection:RC-OSC2 as RA6
               
#pragma config OSCS = OFF          //Osc. Switch On Off

#pragma config   PWRT = ON             //Power Up Timer
 
#pragma config BOR = ON              //Brown Out Reset:
   
#pragma config BORV = 45             //Brown Out Voltage:4.5V
// #pragma config BORV = 42         //Brown Out Voltage:4.2V
// #pragma config BORV = 27         //Brown Out Voltage:2.7V
// #pragma config BORV = 25         //Brown Out Voltage:2.5V

 
#pragma config WDT = OFF           // Watchdog Timer
 
//#pragma config WDTPS = 1              //Watchdog Postscaler:1:1
//#pragma config WDTPS = 2              //Watchdog Postscaler:1:2
//#pragma config WDTPS = 4              //Watchdog Postscaler:1:4
//#pragma config WDTPS = 8              //Watchdog Postscaler:1:8
//#pragma config WDTPS = 16             //Watchdog Postscaler:1:16
//#pragma config WDTPS = 32             //Watchdog Postscaler:1:32
//#pragma config WDTPS = 64             //Watchdog Postscaler:1:64
//#pragma config WDTPS = 128            //Watchdog Postscaler:1:128

#pragma config CCP2MUX = OFF          //CCP2 Mux:Disable (RB3)

#pragma config STVR = OFF             //Stack Overflow Reset:Disabled
     
#pragma config LVP = OFF              //Low Voltage ICSP:Disabled
       
#pragma config DEBUG = OFF            //Background Debugger Enable:Disabled
   
#pragma config CP0 = OFF              //Code Protection Block 0:Disabled
#pragma config CP1 = OFF              //Code Protection Block 1:Disabled
#pragma config CP2 = OFF              //Code Protection Block 2:Disabled
#pragma config CP3 = OFF              //Code Protection Block 3:Disabled
#pragma config CPB = OFF              //Boot Block Code Protection:Disabled
#pragma config CPD = OFF              //Data EEPROM Code Protection:Disabled
#pragma config WRT0 = OFF             //Write Protection Block 0:Disabled
#pragma config WRT1 = OFF             //Write Protection Block 1:Disabled
#pragma config WRT2 = OFF             //Write Protection Block 2:Disabled
#pragma config WRT3 = OFF             //Write Protection Block 3:Disabled
#pragma config WRTB = OFF             //Boot Block Write Protection:Disabled   
#pragma config WRTC = OFF             //Configuration Register Write Protection:Disabled
#pragma config WRTD = OFF             //Data EEPROM Write Protection:Disabled
#pragma config EBTR0 = OFF            //Table Read Protection Block 0:Disabled
#pragma config EBTR1 = OFF            //Table Read Protection Block 1:Disabled
#pragma config EBTR2 = OFF            //Table Read Protection Block 2:Disabled
#pragma config EBTR3 = OFF            //Table Read Protection Block 3:Disabled
#pragma config EBTRB = OFF            //Boot Block Table Read Protection:Disabled


tirado do site deste cara: http://www.Sticker.Tk
microeletronica
Byte
 
Mensagens: 158
Registrado em: 05 Dez 2006 18:22


Voltar para PIC

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante

cron

x