4 mhz program speed in pic 18f4550 please


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Posts
    5

    Default 4 mhz program speed in pic 18f4550 please

    I want to make a serial communication --- 18f4550 and max6675 ---

    but max6675 demand 4,3 mhz max to have the correct communication

    how can i run my program on pic18f4550 at 4 Mhz

    (the pic is also connected to pc via usb) ,the probleme is how change this default configuration to have programme running speed at 4 mhz and keep usb communication at 48Mhz.

    __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 & _ICPRT_OFF_4L & _XINST_OFF_4L

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: 4 mhz program speed in pic 18f4550 please

    but max6675 demand 4,3 mhz max to have the correct communication
    Nope, the 6675 will work just fine with a MCU running at 48MHz.

    Here are some snippets.
    Code:
    DEFINE OSC 48
    @ __CONFIG   _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @ __CONFIG   _CONFIG1H, _FOSC_HSPLL_HS_1H
    @ __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
    @ __CONFIG    _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H 
    @ __CONFIG    _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L &_XINST_OFF_4L 
    
    'Alias pins - MAX6675 temp sensor
    MXSCLK  VAR     PORTA.0   'Clock
    MXCS    VAR     PORTA.1    'Chip Select
    MXSO    VAR     PORTA.2   'Serial out
    
    
    'Read the 6675
    MXCS = 0  'Chip select low
    shiftin MXSO, MXSCLK, 0, [MXTemp\16]   'read the data to MXTemp
    MXCS = 1    'Chip select high
    TempC = MXtemp >> 5   'right shift the data 5 places to get degrees C (Read the Data sheet)
    TempF = ABS(TempC) */ 461
    TempF = TempF + 32
    I also deleted your other post as it is a duplicate of this one. No need to double post.
    Last edited by mackrackit; - 12th December 2011 at 00:57.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Dec 2011
    Posts
    5

    Default Re: 4 mhz program speed in pic 18f4550 please

    thank you very much dude for your replay ...

    but my problem is when learning the data sheet of max6675 i saw in specifecation that frequency maximum to work is 4.3

    see datasheet max6675 page 3 : http://datasheets.maxim-ic.com/en/ds/MAX6675.pdf

    (so if osc 48 mhz , mxs0 will have 48 mhz speed ?? but normaly it will not exeed 4.3mhz)

    i have't problem with programmation but only the oscillation appropriate for max6675

    I need help please .......

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: 4 mhz program speed in pic 18f4550 please

    The data sheet is talking about the timing for the serial communications. The timing for the SHIFTIN command is taken care of in the software. Take a look at the PBP manual.

    The code I posted is from a working project.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Dec 2011
    Posts
    5

    Default Re: 4 mhz program speed in pic 18f4550 please

    That realy helpful !

    thanks very very much mackrackit .

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