Config 18F25K22


Closed Thread
Results 1 to 2 of 2

Thread: Config 18F25K22

  1. #1
    Join Date
    Sep 2006
    Location
    Venezuela - Caracas
    Posts
    48

    Default Config 18F25K22

    i'm try configure 18F25K22 for work 16MHz internal Osc

    code show hserout text wrong and led not blink

    Code:
       asm   
          __CONFIG    _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
          __CONFIG    _CONFIG2H, _WDTEN_OFF_2H & _WDTPS_512_2H
          __CONFIG    _CONFIG3H, _MCLRE_INTMCLR_3H & _PBADEN_OFF_3H
          __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
          __CONFIG    _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L & _CP3_ON_5L
          __CONFIG    _CONFIG5H, _CPB_ON_5H
       endasm
    
       @ errorlevel -202
    
    '---[ Serial 1 ]----------------------------------------------------------------
    
       DEFINE   HSER_RCSTA    90h
       DEFINE   HSER_TXSTA    20h
       DEFINE   HSER_BAUD     9600
       DEFINE   HSER_CLROERR  1
    
    '---[ Portas ]------------------------------------------------------------------
    
       Led               var   PORTA.0
    
    '---[ Váriaveis ]---------------------------------------------------------------   
       
       I                 Var   WORD
       L                 Var   WORD
       
       J                 Var   BYTE
       K                 Var   BYTE
     
         
       Sim               Con   1
       Nao               Con   0
       
    '-------------------------------------------------------------------------------
    
          
       OSCCON  = %01110000;                         ' 16mHz 
       OSCTUNE = %00000000;                         ' 16 MHz PLL Off bit 6=0, 64MHz PLL On bit 6=1 
      
       
       CM1CON0.7 = 0                                ' Comparadores   
       ADCON1 = 15                                  ' Portas A e B Digital
       INTCON2.7 = 0                                ' Ativa Pull-Ups
       
       ANSELC = 0                                   ' Serial 1   
    
    '-------------------------------------------------------------------------------
         
       PORTA = 0
       PORTB = 0
       PORTC = 0
    
       LATA = 0
       LATB = 0
       LATC = 0
    
       TRISA = %00000000
       TRISB = %10000000
       TRISC = %10000000
    
    '-------------------------------------------------------------------------------
       
       Led = 1
       pause 3000   
        
    
       HSEROUT ["> START", 13]   
       pause 1
         
        Led = 0
          
    '---[ Programa ]----------------------------------------------------------------
    Inicio:
       Led = 0
    
       pause 3000
    
       Led = 1
    goto Inicio
    
    '-------------------------------------------------------------------------------
    End
    ..: Don't worry, be happy :..

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: Config 18F25K22

    Add DEFINE OSC 16 somewhere in the beginning, and add a PAUSE after Led = 1.

    Also - ADCON1 = 15 does not do what you think it's doing. Look at the ANSEL registers.
    Last edited by Bruce; - 26th April 2011 at 20:16.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts