18f14k50 low speed


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2006
    Location
    Venezuela - Caracas
    Posts
    48

    Default 18f14k50 low speed

    with 12mhz crystal USB work 100%
    but i need work with 8Mzh low speed

    can i help ?


    Code:
    '***************************************************************************
    '*  Name    : BasicUSB.pbp                                                 *
    '*  Author  : Darrel Taylor                                                *
    '*  Notice  : Copyright (c) 2009                                           *
    '*  Date    : 7/23/2009                                                    *
    '*  Version : 1.0                                                          *
    '*  Notes   :                                                              *
    '*          :                                                              *
    '***************************************************************************
    ;--- if you un-comment these, you must comment the ones in the .inc file ---
    ASM  ; 18F2550/4550, 20mhz crystal
    ;   __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    ;   __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
    ;   __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
    ;   __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
    ;   __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    
    ASM  ; 18F13K50/14K50  Only 12mhz crystal can be used for USB
        __CONFIG    _CONFIG1L, _CPUDIV_NOCLKDIV_1L & _USBDIV_OFF_1L
        __CONFIG    _CONFIG1H, _FOSC_HS_1H & _PLLEN_ON_1H & _PCLKEN_ON_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    ENDASM
    
    DEFINE OSC 48
    clear
    
    ;--- Setup Interrupts ------------------------------------------------------
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
    
    ASM
    INT_LIST  macro    ; IntSource,          Label,  Type, ResetFlag?
            INT_Handler   USB_Handler
        endm
        INT_CREATE               ; Creates the interrupt processor
    endasm
    
    ;--- Setup USB -------------------------------------------------------------
    INCLUDE "DT_HID260.pbp"
    
    DEFINE USB_VENDORID    6017
    DEFINE USB_PRODUCTID   2000
    DEFINE USB_VERSION     1
    DEFINE USB_VENDORNAME  "Darrel Taylor"
    DEFINE USB_PRODUCTNAME "DT_HID"
    DEFINE USB_SERIAL      "001"
    DEFINE USB_INSIZE      32   ;  IN report is PIC to PC (8,16,32,64)
    DEFINE USB_OUTSIZE     16   ; OUT report is PC to PIC
    DEFINE USB_POLLIN      10   ; Polling times in mS, MIN=1 MAX=10
    DEFINE USB_POLLOUT     10
    
    ; --- Each USB LED is optional, comment them if not used ----
    DEFINE USB_LEDPOLARITY 1       ; LED ON State [0 or 1]  (default = 1)
    DEFINE USB_PLUGGEDLED  PORTB,0 ; LED indicates if USB is connected
    DEFINE USB_TXLED       PORTC,2 ;  "      "     data being sent to PC
    DEFINE USB_RXLED       PORTC,1 ;  "      "     data being received from PC
    
    OutCount    VAR  WORD : OutCount = 0
    Value       VAR  WORD
    X           VAR  WORD
    
    ;--- Setup ADC -------------------------------------------------------------
    DEFINE ADC_BITS 10 ; Number of bits in ADCIN result
    ADCON2.7 = 1       ; right justify    (Change this if ADFM in diff register)
    ANSEL = %00010000  ; AN4/RC0 Analog
    ANSELH = 0
    
    ;--- The Main Loop ---------------------------------------------------------
    Main:
        FOR X = 0 to 1000           ; Check for incomming USB data while pausing
    @     ON_USBRX_GOSUB  _HandleRX
          PAUSE 1
        NEXT X
        
        ADCIN 4, Value
        OutCount = OutCount + 1
        ARRAYWRITE USBTXBuffer,["AN0=",DEC Value," -",DEC OutCount,"  "]
        IF Plugged THEN GOSUB DoUSBOut     ; only send when USB is connected
    GOTO Main
    
    ;---- This just sends the received packet back to the PC -------------------
    HandleRX:
        ARRAYWRITE USBTXBuffer,[STR USBRXBuffer\USBBufferSizeRX]
    return
    ..: Don't worry, be happy :..

  2. #2
    Join Date
    Sep 2010
    Posts
    50


    Did you find this post helpful? Yes | No

    Default Re: 18f14k50 low speed

    I don't see where you are setting the UCFG register. You can select low-speed, see the data sheet and search for UCFG.

Similar Threads

  1. Hello World help please 18F14K50 config
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th August 2011, 18:35
  2. Replies: 3
    Last Post: - 24th September 2010, 08:10
  3. How to read Speedo at low speed
    By davewanna in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 4th October 2009, 14:51
  4. 4 Low Speed PWM & HSERIN
    By MasterSparky in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th October 2007, 20:12
  5. *very* low speed data transfer
    By jswayze in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th November 2004, 20:04

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