Today 20:23
Forum: Proton Plus Compiler v3
Starter: joesaliba
Views: 6
Replies: 0
Today 15:35
Forum: Analog-to-Digital Converter Module
Starter: hadv215
Views: 57
Replies: 2
Today 10:41
Forum: Proton Users File Server
Starter: Les
Views: 28
Replies: 0
+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

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

  1. #11
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    465
    Thumbs Up
    Received: 56
    Given: 2
    Total Downloaded
    712.03 MB

    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
    [U]73's de Alberto ea3agv[/U]

  2. #12
    Junior Member Mentcleer's Avatar
    Join Date
    Aug 2014
    Posts
    98
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    1,017.34 MB

    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 20:25. Reason: error write name

  3. #13
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    465
    Thumbs Up
    Received: 56
    Given: 2
    Total Downloaded
    712.03 MB

    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
    [U]73's de Alberto ea3agv[/U]

  4. #14
    Junior Member Mentcleer's Avatar
    Join Date
    Aug 2014
    Posts
    98
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    1,017.34 MB

    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.

  5. #15
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    465
    Thumbs Up
    Received: 56
    Given: 2
    Total Downloaded
    712.03 MB

    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
    [U]73's de Alberto ea3agv[/U]

  6. #16
    Junior Member Mentcleer's Avatar
    Join Date
    Aug 2014
    Posts
    98
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    1,017.34 MB

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi,

    Here I leave the full Code about graphics LCD with driver ST7565R with Pic 18F26K22 working MSP1 or MSP2 Modes.
    Thanks to the collaboration of AlbertoFS.

    I hope that others will be helpful, as I had many problems.

    Down Demo_ST7565R_SPI for Amicus18 With MSP1_MSP2.zip.

    THX.
    Last edited by Mentcleer; 24th February 2016 at 11:03. Reason: error name file

  7. #17
    Junior Member starwars's Avatar
    Join Date
    Feb 2016
    Posts
    24
    Thumbs Up
    Received: 0
    Given: 19
    Total Downloaded
    0

    0 Not allowed!

    Default Re: How to Enable SDO2 16F26K22?

    Hi Mentcleer
    I'm using a PIC8F26K22 with a DOGM128 Display. I've wired up the SCL and SDO ports based on your program but I think I'm missing a step somewhere.My code settings are as below.
    Symbol CS1B = PORTA.5 ' CS1B is the EADOGM128-6 "Chip Select Not" pin
    High CS1B ' make sure it does't get any
    Symbol A0 = PORTA.2 ' LCD A0: 0 = Command, 1 = data
    Symbol GLCD_RST = PORTA.3 ' Reset Active low
    Low GLCD_RST ' keep in reset
    High PORTA.1
    and
    ANSELB.1 = 0 ' Pin RB1 digital for Clock
    TRISB.1 = 1 ' 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

    Any suggestions on where to locate the issue?

    Many Thanks for your time.

    Harry

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. A/D Converter Interrupt Enable - help
    By CharlieBrown in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 23rd January 2011, 06:15
  2. [SOLVED !] Graphical LCD with double ENABLE
    By FesterPic in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 21st April 2007, 15:19
  3. Enable & Disable HSEROUT
    By crankshaft in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 17th March 2006, 07:26
  4. It's possible to enable two RS232 ports?
    By GAMBOA in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 18th January 2006, 09:04
  5. LCD-display whith 2 enable pins
    By Stijn in forum Wish List / Product Feedback
    Replies: 0
    Last Post: 6th January 2006, 14:37

Members who have read this thread : 40

Actions :  (Set Date)

You do not have permission to view the list of names.

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