Menu

PIC16F18854 Internal Oscillator .. Tx pin

ashimotok0
2018-03-21
2018-03-22
  • ashimotok0

    ashimotok0 - 2018-03-21

    I am thinking of using a PIC16F18854 on my working PIC16F1827 project, in order to get increased I/O . I understand that the 16F18854 is supported by GCB but if I assemble my code, as that device selected it errors
    "Warning: Configuration setting not valid: OSC = INTOSC"

    Also I cannot find which pin is Tx for the UART ... I assume it must be RC6 CK but is there anything special I need to do in GCB to assign this as the TX pin ?

    Is my choice of the 16F18854 a reasonable one .. I chose it as I am using the 5 bit DAC.

    chip 16F18854, 4

    #config Osc = intOSC

    Best wishes .. Ash ... I have come on leaps and bounds using GCB over the last two weeks .. it truly is a remarkable programming tool for a newbie to get to grips with.

     
    • Chris Roper

      Chris Roper - 2018-03-22

      You may find this useful.
      https://sourceforge.net/p/gcbasic/discussion/projects&guides/thread/3fa399ca/

      It introduces PPS and the PPSTool with a walkthrough of assigning SPI and USART on the 16f18855, yours is the same.

      I see you are running at 4Mhz, just so you know you can run that device at 32Mhz.

      Cheers
      Chris

       

      Last edit: Chris Roper 2018-03-22
  • Anobium

    Anobium - 2018-03-21

    You dont need to specify the internal oscillator source.

    So, this works.

    chip 16F18854, 4
    

    As this now generators the correct ASM - where _RSTOSC_HFINT32 is the correct config.

    #include <P16F18854.inc>
     __CONFIG _CONFIG1, _RSTOSC_HFINT32
     __CONFIG _CONFIG2, _MCLRE_OFF
     __CONFIG _CONFIG3, _WDTE_OFF
     __CONFIG _CONFIG4, _LVP_OFF
    

    There any many, many demonstrations for the 16f18855 which is a sister chip. And, the serial demos will show you how to use PPS to setup the serial port.

    Welcome the the world of PPS - but, the demos show you how PPS works. Use this URL https://github.com/Anobium/Great-Cow-BASIC-Demonstration-Sources/tree/master/Vendor%20Boards/Xpress%20Evaluation%20Board then search the page for serial. Demo #20 shows on line 67... 80.

    'Set the PPS of the PWM and the RS232 ports.
    'Set the PPS for this solution.
    #startup InitPPS, 85
    
    Sub InitPPS
    UNLOCKPPS
        RC0PPS = 0x0010       'RC0->EUSART:TX;
        RXPPS  = 0x0011       'RC1->EUSART:RX;
    
        RC3PPS = 0x0017       'RC3->MSSP2:SDA2;
        SSP2DATPPS = 0x0013   'RC3->MSSP2:SDA2;
        SSP2CLKPPS = 0x0014   'RC4->MSSP2:SCL2;
        RC4PPS = 0x0016       'RC4->MSSP2:SCL2;
      LOCKPPS
    End sub
    
    #define USART_BAUD_RATE 19200
    #define USART_TX_BLOCKING
    

    The shown above can be generated using the PPSTool - it is fun to use. In the example about the PPS has setup RC0 and RC1 as TX and RX respectively. When you use PPSTool you can select from lots of ports. :-)

    Anobium

     
  • ashimotok0

    ashimotok0 - 2018-03-22

    Thanks for the prompt replies everyone .. I see it all cleraly now. That PPS tool looks awesome :)

    Ash

     

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.