My I2CWRITE - timings and tricks


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    Surrey, England
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Amendment

    Oops - just realised was running the 18F4550 at 20 MHz - so all the timings are out by a factor of 2'ish. ie my code example is actually sampling at 2 KHz. Same principles apply though.
    The Xtal frequency is 20 MHz - what with pre and post scalers etc it gets difficult to track what the Oscillator frequency is on the 18F4550 which has two potentially different clocks speeds in it.
    Also my ADC manipulation comments had an error, but the code was correct - should have been:
    Code:
            '10 bit to 16 bit and swap LSB/MSB because
            'STR sends LSB,MSB and DAC expects MSB,LSB, ie:
            'xxxxxx9876543210 > 10xxxxxx,xxxxxxxx + xxxxxxxx,98765432
            Buffer[pBuff] = (value<<13) + (Value>>2)
    Peter

  2. #2
    Join Date
    Jun 2005
    Location
    Surrey, England
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Enlightenment

    The speed of my 18F4550 was frustrating me - I knew it has a 20 MHz crystal and I set the prescaler etc to do the usual divide by 5, multiply by 12 but it appeared to only run at 20 MHz. When I tried on the PICDEM-FSUSB demo board it ran at 48 MHz. I have finally twigged the difference and the explanation - I program my PICDEM board using ICD2 and the "real" board using the Microcode bootloader from Mecanique.

    Of course, the requisite R of TFM states clearly that the configuration fuses are set by the bootloader program (here 20 MHz) NOT my PBP program I am loading in with its OSC 48 - so I need to use OSC 20 with the loader and of course this also explains why the USB fails - not recognised by the PC because it is not running at 48 MHz. We actually chucked away a USB plug because we concluded that it MUST be the reason for the program to fail, there being no other logical explanation - the next one worked but of course we didnt use the loader for that - Doh!
    Last edited by FinchPJ; - 2nd March 2008 at 20:53. Reason: spelling

Members who have read this thread : 0

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