How to Enable SDO2 16F26K22?


+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: How to Enable SDO2 16F26K22?1680 days old

  1. #1
    Mentcleer
    Guest Mentcleer's Avatar

    0 Not allowed!

    Default How to Enable SDO2 16F26K22?

    Hello,

    I am using this code to enable SDO2 (PORTB.3) pin.24 (PIC 18F26K22) , but does not work.
    For SPI Display.

    Code:
      SSP2CON1=         %00000001          ' Clock FOSC/16 '%
      Symbol SSP2EN     = SSP2CON1.5     ' SSP Enable bit
      Symbol CKP2       = SSP2CON1.4     ' Clock Polarity Select
      Symbol SMP2       = SSP2STAT.7     ' Data input sample bit
      Symbol CKE2       = SSP2STAT.6     ' Clock Edge Select bit
      Symbol BF2        = SSP2STAT.0     ' buffer full status bit 1 = buffer full
      Symbol SSP2IF     = PIR3.7         ' Synchronous Serial Port Interrupt Flag Bit
      OSCCON=%01110000                      ' HFINTOSC – (16 MHz)'%


    THX.
    Last edited by Mentcleer; 14th February 2016 at 11:29. Reason: Missing %

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Broderic
    Guest Broderic's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hello.

    For 18F25K20 it is written that to enable SDO, must have corresponding TRIS bit cleared.
    I don't know if it is the same for your PIC and for SDO2.
    Just an idea.

    Bye

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Mentcleer
    Guest Mentcleer's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Broderic,

    I am sorry, I do not understand what you want to say.
    But something is missing or something is wrong with the code.

    THX.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Broderic
    Guest Broderic's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Mentcleer.

    Maybe to enable SPI you need to set pin 5 of SSP2CON1 register, that is SSP2EN=1 (or SSP2CON1=%00100001).
    See Chapter 15 of the data sheet.

    Then you have to configure your port where you have SDO2 (portB.3):
    TRISBbits.TRISB3 =0b0 (you have to clear the bit I guess). This was what I intended before
    In Proton maybe: TRISB= %11110111 or something like that(in other words you have to put zero bit3 of portB).
    I don't know if this is the problem, but it is an idea.

    Bye

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Mentcleer
    Guest Mentcleer's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi,

    At the moment the code does not work for enabled MSSP2. PortB1 and 2 SPI Mode 18F26K22

    New code:
    Code:
      SSP2CON1          = %00100001    ' Synchronous Serial Port Enable bit and Clock FOSC/16 
      Symbol SSP2EN  = SSP2CON1.5    ' SSP Enable bit
      Symbol CKP2     = SSP2CON1.4     ' Clock Polarity Select
      Symbol SMP2     = SSP2STAT.7     ' Data input sample bit
      Symbol CKE2     = SSP2STAT.6     ' Clock Edge Select bit
      Symbol BF2      = SSP2STAT.0      ' buffer full status bit 1 = buffer full
      Symbol SSP2IF  = PIR3.7             ' Synchronous Serial Port Interrupt Flag Bit
      OSCCON           =%01110000      ' HFINTOSC  (16 MHz)
     
      TRISB=%00000000          'All PortB Outs

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,942
    Thumbs Up
    Received: 26
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Have you tried using the SPI Include, rather than setting up manually?

    Include "SPI.inc"

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Mentcleer
    Guest Mentcleer's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi pic-ignorant,

    How works this library for enabled MSSP2 SPI

    Where is MSSP2 ?

    I saw this LINK

    Code: (Not works and give me a lot errors)

    Code:
    Include "SPI.inc"
    OpenSPI(SPI_FOSC_16, MODE_00, SMPEND)



    THX


    Last edited by Mentcleer; 15th February 2016 at 19:13. Reason: Bad code

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    693
    Thumbs Up
    Received: 93
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Mentcleer,
    I think it's too simple.
    Write Include "Amicsus18_SPI.inc" in your IDE.
    Make a copy of this file and rename it as "Amicus_SPI.inc".

    See line 38 and line 202 of the file:
    Change the $if (_device = _18F25K22) =>
    to: $if (_device = _18F23K22) Or (_device = _18F24K22) Or (_device = _18F25K22) Or (_device = _18F26K22)

    What is the difference between the PIC18F26K22 and the PIC18F25K22?
    Save and use.
    Regards
    Alberto
    73's de Alberto ea3agv

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Mentcleer
    Guest Mentcleer's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi AlbertoFS,



    (But Code does not work)...

    The "Amicus18_SPI.inc" there as two parts for MSSP1 and MSSp2.
    with "OpenSI2()" Selecting the DSO2.

    I have also tried all the pSyncMode, pBusMode, pSmpPhase... Nothing..!!

    I have included this:



    Include "Amicus18_SPI.inc"
    OpenSPI2 (SMPEND, MODE_00, SPI_FOSC_16)


    Code OpenSPI2:
    Code:
    $ifndef __SPI_INC_
    $define __SPI_INC_
    '
    ' SPI peripheral library for Amicus18
    '
    $define SMPEND        %10000000          ' Input data sample at end of data out
    $define SMPMID        %00000000          ' Input data sample at middle of data out
    
    
    $define MODE_00       %00000000          ' Setting for SPI bus Mode 0,0
    $define MODE_01       %00000001          ' Setting for SPI bus Mode 0,1
    $define MODE_10       %00000010          ' Setting for SPI bus Mode 1,0
    $define MODE_11       %00000011          ' Setting for SPI bus Mode 1,1
    
    
    ' SSPCON1 Register
    $define SSPENB        %00100000          ' Enable serial port and configures SCK, SDO, SDI
    
    
    $define SPI_FOSC_4    %00000000          ' SPI Master mode, clock = Fosc/4
    $define SPI_FOSC_16   %00000001          ' SPI Master mode, clock = Fosc/16
    $define SPI_FOSC_64   %00000010          ' SPI Master mode, clock = Fosc/64
    $define SPI_FOSC_TMR2 %00000011          ' SPI Master mode, clock = TMR2 output/2
    $define SLV_SSON      %00000100          ' SPI Slave mode, /SS pin control enabled
    $define SLV_SSOFF     %00000101          ' SPI Slave mode, /SS pin control disabled
    
    
    
    
    '***************************************************************
    ' Amicus18 Revision 2
    '***************************************************************
    $if (_device = _18F26K22)
    
    
    '-----------------------------------------------------------------------------------
    ' CloseSPI2
    
    
    $define CloseSPI2() SSP2CON1 = SSP2CON1 & $DF
    
    
    '-----------------------------------------------------------------------------------
    ' DataReadySPI2: Test if SSP2BUF register is full
    
    
    $define DataReadySPI2() SSP2STATbits_BF
    
    
    '-----------------------------------------------------------------------------------
    ' Macro Name    : OpenSPI2
    ' Return Value  : None
    ' Parameters    : SSP2 peripheral setup values
    ' Notes         : Sets up the SSP2 module for master or slave operation
    '
    ' Syntax OpenSPI2 pSyncMode , pBusMode , pSmpPhase
    '
    $define OpenSPI2(pSyncMode,pBusMode,pSmpPhase) _OpenSPI2 pSyncMode, pBusMode, pSmpPhase
    
    
    _OpenSPI2 Macro- pSyncMode, pBusMode, pSmpPhase
        SSP2STAT = SSP2STAT & $3F       ' Power on state
        SSP2CON1 = $00                  ' Power on state
        #if(pSyncMode != 0)
            Movlw (pSyncMode)
            Iorwf SSP2CON1,f            ' Select serial mode
        #endif
        #if(pSmpPhase != 0)
            Movlw (pSmpPhase)
            Iorwf SSP2STAT,f            ' Select data input sample phase
        #endif
    
    
        #if(pBusMode == 0)              ' SPI bus mode 0,0
            SSP2STATbits_CKE = 1        ' Data transmitted on rising edge
        #endif
        #if(pBusMode == 2)              ' SPI bus mode 1,0
            SSP2STATbits_CKE = 1        ' Data transmitted on falling edge
            SSP2CON1bits_CKP = 1        ' Clock idle state high
        #endif
        #if(pBusMode == 3)              ' SPI bus mode 1,1
            SSP2CON1bits_CKP = 1        ' Clock idle state high
        #endif
    
    
        #if(pSyncMode == 4)             ' Slave mode with /SS enable
          TRISB.1 = 1                   ' Define clock pin as input
          TRISB.0 = 1                   ' Define /SS2 pin as input
        #endif
    
    
        #if(pSyncMode == 5)             ' Slave mode without /SS enable
          TRISB.1 = 1                ' Define clock pin as input
        #else                           ' Master mode, define clock pin as output
          TRISB.1 = 0                   ' Define clock pin as output
        #endif
    
    
        TRISB.2 = 1                     ' Define SDI pin as input
        TRISB.3 = 0                     ' Define SDO pin as output
    
    
        SSP2CON1.5 = 1                  ' Enable synchronous serial port
    Endm
    '-----------------------------------------------------------------------------------
    ' Macro Name     : WriteSPI2
    ' Return Value   : Input data can be picked up by reading SSP2BUF straight after the WriteSPI2 macro
    ' Parameter      : Single 8-bit variable for SPI2 bus.
    ' Description    : Write a single byte (8-bits) to the SPI2 bus.
    '
    $define WriteSPI2(pDataOut) '
        WREG = pDataOut '
        _WriteSPI2
    
    
    _WriteSPI2 Macro-
        GoSub __WriteSPI2
    Endm
    
    
    #ifMacro- _WriteSPI2
    __WriteSPI2:
        SSP2STATbits_BF = 0             ' Empty the SSP2BUF buffer flags
        PIR3bits_SSP2IF = 0             ' Clear the interrupt flag
        SSP2BUF = WREG                  ' Place the data to send into SSP2BUF
        Btfss PIR3bits_SSP2IF           ' \
        Bra $ - 2                       ' / Wait until cycle complete
        WREG = SSP2BUF                  ' Read SSP2BUF into WREG
        Return
    #endIfMacro-
    
    
    '-----------------------------------------------------------------------------------
    ' Macro Name    : ReadSPI2
    ' Return Value  : Contents of SSP2BUF register
    ' Parameters    : None
    ' Description   : Read byte\s from the SPI2 bus.
    '
    $define ReadSPI2() _ReadSPI2
    
    
    _ReadSPI2 Macro- '\Byte
        GoSub __ReadSPI2
        Return_Wreg
    Endm
    
    
    #ifMacro- _ReadSPI2
    __ReadSPI2:
        WREG = SSP2BUF                  ' Empty the SSP2BUF buffer and clear flags
        PIR3bits_SSP2IF = 0             ' Clear interrupt flag
        SSP2BUF = $FF                   ' Initiate bus cycle
        Btfss PIR3bits_SSP2IF           ' \
        Bra $ - 2                       ' / Wait until cycle complete
        WREG = SSPBUF                   ' Read SSP2BUF into WREG
        Return
    #endIfMacro-
    
    
    $define SPI2_Write(pDataOut) WriteSPI2(pDataOut)
    $define SPI2_Read() ReadSPI2()
    $define SPI2_Open(pSyncMode,pBusMode,pSmpPhase) OpenSPI2(pSyncMode,pBusMode,pSmpPhase)
    $define SPI2_DataReady() SSP2STATbits_BF
    $define SPI2_Close() SSP2CON1 = SSP2CON1 & $DF
    
    
    $endif
    '---------------------------------------------------------
    _SPI_MAIN_:
    
    
    $endif


    THX

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Broderic
    Guest Broderic's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Mentcleer.

    Perhaps it can be useful to see your PIN connections for the SPI, your complete code and your scope with the use of this SDO2.

    What I posted in the Amicus18 section (Demo_ST7565R_SPI.BAS _MODIFIED FOR AMICUS18) worked, and I think that with minor modifications, it can work also with SDO2.
    My PIN connection was:

    CSIB of GLCD to pin C7
    RESET of GLCD to pin B0
    A0 of GLCD to pin C2
    SCL of GLCD to pin C3
    SI of GLCD to pin C5

    Are you using Amicus18? Is still your scope to avoid splitting graph on the GLCD?

    Bye

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #11
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    693
    Thumbs Up
    Received: 93
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Mentcleer,
    I've made the changes explained in my post #8. I have successfully compiled the example for the PIC18F26K22.
    Code:
    SPI2_Open(SPI_FOSC_16, MODE_00, SMPMID)
    But I found an error in the macro SPI2_Read(). I Did not see the tree in the forest? There was a simple typographical error.
    I used an example of the hardware SPI "MCP23S17" of the "New Samples" folder. I have modified a bit to make it works with ISIS.
    I think nobody has used "Amicus18_SPI.inc" for SPI2 before? The SPI2_Read() was wrong. I added some code that was needed to set the pins as digital. Maybe that's the problem you had?
    See the example with the new "Amicus_SPI.inc" file, enjoy to Work With SPI2 & PIC18F26K22.
    Regards
    Alberto
    Attached Files Attached Files
    73's de Alberto ea3agv

  22. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #12
    Mentcleer
    Guest Mentcleer's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi AlbertoFS,

    Thank you so much for help me..

    I saw your code using your library "Amicus SPI.inc" with MCP23S17 and I've noticed that as the code is made to library display ST7565R
    the structure is different, for not using SPI library , I think it will not work with using "Amicus SPI.in" or other.

    I leave the code for you to see.
    We can Modify.
    You can see the library "GLCD_ST7565R_SPI.Inc" and lines 35 to 44 from "Demo_ST7565R_SPI for EADOG128_6 with Amicus18.bas".


    Code: GLCD_ST7565R_SPI.zip

    THX.



    Last edited by Mentcleer; 17th February 2016 at 19:25. Reason: error write name

  24. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  25. #13
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    693
    Thumbs Up
    Received: 93
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Mentcleer,

    I have not found nothing special about the definition of the pins. I entered the SPI2 library, which is not difficult and I made a few minor changes. Check the connections according to the list obtained from your code.

    Wiring of the LCD to the PIC according to the code.
    CS1B of GLCD to pin PORTC.2
    GLCD_RST of GLCD to pin PORTB.0
    A0 of GLCD to pin PORTC.0
    SCL of GLCD to pin PORTB.1
    SI of GLCD to pin PORTB.3
    Do not connect the input SDI pin of the pic (PORTB.2), it is configured as input by OpenSPI2().

    I am not a specialist in LCD graphic and I can not help you more in this regard.
    Regards
    Alberto
    Attached Files Attached Files
    73's de Alberto ea3agv

  26. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  27. #14
    Mentcleer
    Guest Mentcleer's Avatar

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi AlbertoFS,

    Great job!!

    Thank you for your time spent on checking and correcting the changes.
    Your code works correctly in MSP2. The display works ....

    To save code I have done the following in the bas code and Libray:

    Bas Code:

    Code:
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''NOTE: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''  WORKS OK in MSP2  /  ONLY OUTS FOR DISPLAY!!
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'Sample phases   
    Symbol SMP_END  =       0x80 ' Input data sample at end of data out
    Symbol SMP_MID  =       0x00 ' Input data sample at middle of data out
    'Serial Modes
    Symbol SPI_FOSC4  =     0x00  ' SPI Master mode, clock = Fosc/4
    Symbol SPI_FOSC16 =     0x01  ' SPI Master mode, clock = Fosc/16
    'Symbol SPI_FOSC64 =    0x02  ' SPI Master mode, clock = Fosc/64
    'Symbol SPI_FOSC_TMR2 = 0x03  ' SPI Master mode, clock = TMR2 output/2
    'Symbol SLV_SSON    =   0x04  ' SPI Slave mode, /SS pin control enabled
    'Symbol SLV_SSOFF   =   0x05  ' SPI Slave mode, /SS pin control disabled
    
    
    
    
    SSP2STAT = SSP2STAT & $3F     ' Power on state
    SSP2CON1 = $00                     ' Power on state
     
    Movlw SPI_FOSC16              ' Select serial mode
    Iorwf SSP2CON1,F
    
    
    Movlw  SMP_MID                ' Select data Input sample phase
    Iorwf SSP2STAT,F
    
    
    '(1) SPI bus mode 0,0
      SSP2STATbits_CKE = 1        ' Data transmitted On rising edge
    '(2) SPI bus mode 1,0
      'SSP2STATbits_CKE = 1       ' Data transmitted On falling edge
      'SSP2CON1bits_CKP = 1       ' Clock idle state High
    '(3) SPI bus mode 1,1
      'SSP2CON1bits_CKP = 1       ' Clock idle state High
    
    
    ANSELB.1 = 0                  ' Pin RB1 digital for Clock
    TRISB.1  = 0                  ' Define clock pin as output
    ANSELB.3 = 0                  ' Pin SDO2 as digital
    TRISB.3  = 0                  ' Define SDO2 pin as output
    
    
    SSP2CON1.5 = 1                ' Enable synchronous serial2 port
    Code in "GLCD_ST7565R_SPI.inc" Library Sub:

    Code:
    SPI_GLOBAL:                                         ' generic SPI sub  ReadSPI           
    ' ONLY MSP2 !!   
        WREG = SSP2BUF                                ' Empty the SSP2BUF buffer and clear flags
        PIR3bits_SSP2IF = 0                           ' Clear interrupt flag
        SSP2BUF = $FF                                 ' Initiate bus cycle
        Btfss PIR3bits_SSP2IF                         ' \ 
        Bra $ - 2                                     ' / Wait until cycle complete
        WREG = SSP2BUF    
    Return

    THX.

  28. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  29. #15
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    693
    Thumbs Up
    Received: 93
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Mentcleer,
    I am glad that your project go forward. It was an opportunity to review the SPI2 library. As the display works you could change at full speed to improve performance.
    SPI2_Open(SPI_FOSC_4, MODE_00, SMPMID)

    Regards
    Alberto
    73's de Alberto ea3agv

  30. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. 3 Freq. for 12F683 and Enable
    By Henk57 in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 21st June 2016, 15:22
  2. A/D Converter Interrupt Enable - help
    By CharlieBrown in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 23rd January 2011, 05:15
  3. Graphical LCD with double ENABLE
    By FesterPic in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 21st April 2007, 15:19
  4. Enable & Disable HSEROUT
    By crankshaft in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 17th March 2006, 06:26
  5. It's possible to enable two RS232 ports?
    By GAMBOA in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 18th January 2006, 08:04

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts