Tx 18f25j50


Closed Thread
Results 1 to 2 of 2

Thread: Tx 18f25j50

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

    Default Tx 18f25j50

    Usb work 100%
    but hserout not work ... wrong caracters
    i use hserout for debug/gsm...


    18F25J50

    Code:
       INCLUDE "modedefs.bas"
       INCLUDE "DT_INTS-18.bas"        ; Base Interrupt System
       INCLUDE "ReEnterPBP-18.bas"     ; PBP Re-entry for external interrupt   
       
       #CONFIG
          config WDTEN = OFF            ;WDT disabled (enabled by SWDTEN bit)
          config PLLDIV = 2             ;Divide by 2 (8 MHz internal oscillator input)
          config STVREN = ON            ;stack overflow/underflow reset enabled
          config XINST = OFF            ;Extended instruction set disabled
          config CPUDIV = OSC1          ;No CPU system clock divide
          config CP0 = ON               ;Program memory is not code-protected
          config OSC = INTOSCPLL        ;HSPLL          ;INTOSCPLL      ;Internal oscillator, PLL enabled, used by USB
          config T1DIG = OFF            ;Sec Osc clock source may not be selected, unless T1OSCEN = 1
          config LPT1OSC = OFF          ;high power Timer1 mode
          config FCMEN = OFF            ;Fail-Safe Clock Monitor disabled
          config IESO = OFF             ;Two-Sp Start-up disabled
          config WDTPS = 32768          ;1:32768
          config DSWDTOSC = INTOSCREF   ;DSWDT uses INTOSC/INTRC as clock
          config RTCOSC = INTOSCREF     ;RTCC uses T1OSC/T1CKI as clock
          config DSBOREN = OFF          ;Zero-Power BOR disabled in Deep Sleep
          config DSWDTEN = OFF          ;Disabled
          config DSWDTPS = 8192         ;1:8,192 (8.5 seconds)
          config IOL1WAY = OFF          ;IOLOCK bit can be set and cleared
          config MSSP7B_EN = MSK7       ;7 Bit address masking
          ;config WPFP = PAGE_1         ;Write Protect Program Flash Page 0
          ;config WPEND = PAGE_0        ;Start protection at page 0
          ;config WPCFG = OFF           ;Write/Erase last page protect Disabled
          ;config WPDIS = OFF           ;WPFP[5:0], WPEND, and WPCFG bits ignored
       #ENDCONFIG
                              
    '-------------------------------------------------------------------------------
    
       DEFINE   HSER_RCSTA    90h
       DEFINE   HSER_TXSTA    20h
       DEFINE   HSER_BAUD     9600
       DEFINE   HSER_CLROERR  1
    
    '-------------------------------------------------------------------------------
    ASM
    INT_LIST  macro       ; IntSource,  Label,      Type, ResetFlag?
            INT_Handler   USB_Handler
            INT_Handler   INT_INT,     _Leitor,    PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    endasm
    
    ;@ INT_ENABLE INT_INT        ; enable external (INT) interrupts
    
    '--- Setup USB -----------------------------------------------------------------
    
    INCLUDE "DT_HID260.pbp"
    
    DEFINE USB_VENDORID    6017
    DEFINE USB_PRODUCTID   2000
    DEFINE USB_VERSION     1
    DEFINE USB_VENDORNAME  "MICROSOFT"
    DEFINE USB_PRODUCTNAME "USB HID"
    DEFINE USB_SERIAL      "001"
    DEFINE USB_INSIZE      8    ; IN report is PIC to PC (8,16,32,64)
    DEFINE USB_OUTSIZE     8    ; OUT report is PC to PIC
    DEFINE USB_POLLIN      10   ; Polling times in mS, MIN=1 MAX=10
    DEFINE USB_POLLOUT     10
    
    ; --- Each USB status LED is optional, comment them if not used ------------
    ; --- They can be assigned to any pin, and no further action is required --- 
    DEFINE USB_LEDPOLARITY 1       ; LED ON State [0 or 1]  (default = 1)
    DEFINE USB_PLUGGEDLED  PORTB, 7 ; LED indicates if USB is connected
    ;DEFINE USB_TXLED       PORTD, 1 ;  "      "     data being sent to PC
    ;DEFINE USB_RXLED       PORTD, 2 ;  "      "     data being received from PC
    
    '-------------------------------------------------------------------------------
    
       Led               var   PORTB.7
       
    '-------------------------------------------------------------------------------
    
       'DEFINE OSC 8
       
       OSCCON.6 = 1
       OSCCON.5 = 1
       OSCCON.4 = 1
        
       ANCON0 = %11111111                           ' Todas portas digital
       ANCON1 = %00001111   
       ADCON0 = 0                                   ' ADC off
       ADCON1 = 0
       INTCON2.7 = 0                                ' Desativa PortB Pullups         
       CM1CON1.7 = 0
       CM2CON1.7 = 0
    
       OSCTUNE.6 = 1                                ' PLL On
       
       PAUSE 10
    
    '-------------------------------------------------------------------------------
    
       LATA = 0
       LATB = 0
       LATC = 0
       
       PORTA = 0
       PORTB = 0
       PORTC = 0
    
       TRISA = %00011111
       TRISB = %01111111
       TRISC = %10000000
     
       'INTCON2.4 = 0                                ' PORTB.2 - Lo to Hi
       'INTCON2.5 = 0                                ' PORTB.1 - Lo to Hi
       INTCON2.6 = 0                                ' PORTB.0 - Lo to Hi
       
    '-------------------------------------------------------------------------------
    
       'while (Plugged = 0)
       '   PAUSE 1
       'wend
       
       hserout["------START------", 13]
       pause 1000
        
    '-------------------------------------------------------------------------------
    Inicio
       hserout["HI", 13]
       pause 1000
    GOTO Inicio
    
    ..........
    ..........
    ..: Don't worry, be happy :..

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Tx 18f25j50

    Code:
    Define OSC 48
    DT

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