Menu

PPS on a 16f18326

Help
2016-10-18
2016-10-20
  • David Stephenson

    I've just been trying a 16F18326 in the place of a 16F1705. The HI2C is not working.
    I've tried incorporating the difference PPS setting but no luck.
    Can anybody spot any mistakes here.

    #chip 16F18326,4
    #config RSTOSC=HFINT1, MCLRE=Off, WDT=off, boren=off
    SET PPSLOCK.0 OFF 'UNLOCK PPS
    RC0PPS=B'00011000' 'C.0=CLK
    RC1PPS=B'00011001' 'C.1=DAT
    SSP1DATPPS=B'00010001' 'DAT TO C.1
    SSP1CLKPPS=B'00010000' 'CLK TO C.0
    SET PPSLOCK.0 ON 'LOCK PPS
    #define hi2c_BAUD_RATE 400
    #define hi2c_DATA PORTC.1
    #define hi2c_CLOCK PORTC.0
    Dir hi2c_DATA in
    Dir hi2c_CLOCK in
    hi2cMode Master
    
     

    Last edit: David Stephenson 2016-10-18
  • Anobium

    Anobium - 2016-10-18

    Look at all the demos. Examples are there and play safe use hex not binary for the assignments.

     
  • Anobium

    Anobium - 2016-10-19

    This will work. But, this looks the same as yours. However, try using the UNLOCKPPS and LOCKPPS

    UNLOCKPPS
        RC1PPS = 0x19            ' RC1<-MSSP1:SDA1
        SSP1CLKPPS = 0x10        ' RC0->MSSP1:SCL1
        SSP1DATPPS = 0x11        ' RC1->MSSP1:SDA1
        RC0PPS = 0x18            ' RC0->MSSP1:SCL1
    LOCKPPS
    

    The demos 16f18326 work - so, review these in detail.

     
  • David Stephenson

    Still can't get it to work. Is my #config correct?

     
    • Peter

      Peter - 2016-10-19

      Try commenting out the #config line. I'm using'#config MCLRE_ON, OSC=HFINT32, FEXTOSC_OFF on the 16F18313 and that seems to work.

      If you run at 32Mhz instead of 4Mhz does that change anything?

       

      Last edit: Peter 2016-10-19
  • Anobium

    Anobium - 2016-10-19

    Take the demo code as a baseline. I know that works it has been tested.

     
  • William Roth

    William Roth - 2016-10-20

    I do not have a 16F18326, but I do have several 16F18855 chips.

    So far I cannot get Hardware I2C to work at all on the 16F18855 with a known good 4x20 LCD Module. Using unmodified demo code.

    Software I2C works fine on same chip with same LCD Module on same I/0 pins. (RC3/RC4)

    Will investigate further ....

    (Using Compiler RC3)

    Bill

     
  • Anobium

    Anobium - 2016-10-20

    Here the results I have just completed.

    1. XPress Board. Took Demo code for XPress Board. HW12C Discovery. Works ok. This is HWi2C. So, I know the board is good as this discovered two addreses
    2. GCB Board. 16f1938. HWi2C LCD attached. i2C discover from Demos. Changed the Chip. This discovered two addreses. This confirms my hardware is good.
    3. GCB. 16f18855. Fail with HWI2C. If this fails then the 16f18326 will as this is new architecture.

    Give me a few hours. I can see the issue already - I have the Logic Analyser hooked up and I just need an hour to fix the code.

    We tested HwI2c2 but i did not know the HwI2c was not working. :-(

     

    Last edit: Anobium 2016-10-21
  • Anobium

    Anobium - 2016-10-20

    Update. Fixedin v.0.95.010 rc6.

    I have attached LCD demonstration code for a 16f18326. This is now operating as expected.

     

    Last edit: Anobium 2016-10-21

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.