--- This is a test - only visible to admins ---
--- advertisement may go here ---
Go to last post By: pic-ignorant
Yesterday 23:06
Forum: The Lounge
Starter: pic-ignorant
Views: 0
Replies: 0
Yesterday 22:35
Forum: Website / Forum Issues
Starter: rcurl
Views: 0
Replies: 1
Yesterday 16:56
Forum: Absolute Beginners Section
Starter: amod
Views: 0
Replies: 15
Yesterday 16:28
Forum: Proton Plus Compiler v3
Starter: evoortman
Views: 0
Replies: 3
Go to last post By: yvesmazzon
Yesterday 15:58
Forum: WIKI Discussion
Starter: yvesmazzon
Views: 0
Replies: 0
Yesterday 13:59
Forum: Proton Plus Compiler v3
Starter: normnet
Views: 25425
Replies: 73
Yesterday 12:37
Forum: The Lounge
Starter: Oldhack
Views: 0
Replies: 7
Yesterday 09:36
Forum: Projects discussion
Starter: steyn
Views: 0
Replies: 7
Yesterday 09:34
Forum: Third Party Developments
Starter: leonj
Views: 0
Replies: 3
Yesterday 07:08
Forum: The Lounge
Starter: basparky
Views: 0
Replies: 17
+ Reply to Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Pic16f18877 oread28 days old

  1. #11
    Junior Member evoortman's Avatar
    Join Date
    Nov 2004
    Posts
    48
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    151.53 MB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    If you simply click on the plots then the original size is shown.

    When i use the Serout command then the baudrate is correct so the controller should run at te correct speed.
    SerOut ONE_WIRE, 84, [$AA]

    If i declare the xtal 2x higher, then everything is 4 times slower instead of 2 times, so then i'm going in the wrong direction.

    @kuhrig: can yo send te config settings of your 16F18877 ?
    Last edited by evoortman; 23rd October 2018 at 14:13.

  2. #12
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,829
    Thumbs Up
    Received: 161
    Given: 158
    Total Downloaded
    3.20 GB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    @Kuhrig Could you post that config please. I'm curious to compare your config with Microchip's.
    George

  3. #13
    Junior Member kuhrig's Avatar
    Join Date
    Aug 2005
    Posts
    70
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    3.14 GB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    Code:
      Device = 16F18877
    
        Declare Reminders Off
        @ CONFIG_REQ = 0 ; Override Compiler's configuration settings
        Asm-
            __Config _Config1, 0x179F ;FEXTOSC_ECH & RSTOSC_HFINTPLL & CLKOUTEN_OFF & CSWEN_OFF & FCMEN_OFF
            __Config _Config2, 0x3FFE ;MCLRE_OFF & PWRTE_OFF & LPBOREN_OFF & BOREN_ON & BORV_LO & ZCD_OFF & ZCDDIS_OFF & PPS1WAY_ON & STVREN_ON & DEBUG_OFF
            __Config _Config3, 0x07FF ;WDTCPS_WDTCPS_31 & WDTE_ON & WDTCWS_WDTCWS_7 & WDTCCS_LFINTOSC
            __Config _Config4, 0x0FFF ;WRT_OFF & SCANE_not_available & LVP_OFF
            __Config _Config5, 0x3FFF ;CP_OFF & CPD_OFF
        Endasm-
        Declare Reminders On
    
    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------
        Declare Xtal = 16
    
        OSCCON1 = 10001      '  HFINTOSC WITH 2x PLL /  CLOCK DIVIDER 2
        OSCCON2 = 10001      '  HFINTOSC WITH 2x PLL /  CLOCK DIVIDER 2
    
        OSCFRQ = 000011      ' SET AT 8 MHZ

  4. #14
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,829
    Thumbs Up
    Received: 161
    Given: 158
    Total Downloaded
    3.20 GB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    @evoortman I don't have a 16F18855 so I can't test this but try with a minimal blinky and let me know.
    Code:
        Device = 16F18855
    
        Config1 FEXTOSC_OFF, RSTOSC_HFINT32, CLKOUTEN_OFF, CSWEN_ON, FCMEN_ON
        Config2 MCLRE_OFF, PWRTE_ON, LPBOREN_OFF, BOREN_ON, BORV_HI, ZCD_OFF, PPS1WAY_OFF, STVREN_ON, DEBUG_OFF
        Config3 WDTCPS_WDTCPS_31, WDTE_OFF, WDTCWS_WDTCWS_7, WDTCCS_SC
        Config4 WRT_OFF, SCANE_available, LVP_OFF
        Config5 CP_OFF, CPD_OFF
    
      Xtal 32
      OSCCON1 = 96
      OSCCON3 = 0
      OSCEN = 0
      OSCTUNE = 0
      OSCFRQ = 6
    @kuhrig You say you have a problem with oscillator config, what XTAL would you ideally like to run? Please confirm you are using a crystal.
    Last edited by towlerg; 24th October 2018 at 22:32.
    George

  5. #15
    Junior Member kuhrig's Avatar
    Join Date
    Aug 2005
    Posts
    70
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    3.14 GB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    @George: I am using the internal osc and I want to run it at 8 MHz.

  6. #16
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,829
    Thumbs Up
    Received: 161
    Given: 158
    Total Downloaded
    3.20 GB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    @Kuhig I don't have 16F18877 to try but

    Code:
        Device = 16F18877
    
        Config1 FEXTOSC_OFF, RSTOSC_HFINT32, CLKOUTEN_OFF, CSWEN_ON, FCMEN_ON
        Config2 MCLRE_OFF, PWRTE_ON, LPBOREN_OFF, BOREN_ON, BORV_HI, ZCD_OFF, PPS1WAY_OFF, STVREN_ON, DEBUG_OFF
        Config3 WDTCPS_WDTCPS_31, WDTE_OFF, WDTCWS_WDTCWS_7, WDTCCS_SC
        Config4 WRT_OFF, SCANE_available, LVP_OFF
        Config5 CP_OFF, CPD_OFF
    
    
      ' 8 MHz internal
      Xtal 8                                   
      OSCCON1 96
      OSCCON3 = 0x00 
      OSCEN = 0x00   
      OSCTUNE = 0x00 
      OSCFRQ = 0x03
    
      ' I'm not sure about the HFOEN bit in OSCEN, if the above does "work" try setting to 1
    George

  7. #17
    Fanatical Contributor Les's Avatar
    Join Date
    Feb 2002
    Posts
    3,015
    Thumbs Up
    Received: 309
    Given: 113
    Total Downloaded
    1.50 GB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    The latest update to the compiler (3.6.2.7) corrects the Oread and Owrite commands for the newer enhanced 14-bit core devices that have had their TRIS SFRs moved. Yet another unrequired change to the devices!!!

    Proton Compilers Full Installer - Proton 3.6.2.7 - Proton24 1.0.5.3

    Here's the program I have tested:

    Code:
    ' Read a DS18S20 1-wire temperature sensor and display the temperature on a serial terminal
    '    
        Device = 16F18877 
        Declare Xtal= 16
        Declare Float_Display_Type = Fast
    '
    ' Setup USART1
    '     
        Declare Hserial_Baud = 9600                     ' Set the Baud rate. The compiler will set up everything else associated with USART1
        Declare Hserout_Pin PORTC.6                     ' Choose the pin for TX. So the compiler can sort out PPS
        Declare Hserin_Pin PORTC.7                      ' Choose the pin for RX. So the compiler can sort out PPS
    '
    ' Allocate variables
    '
        Dim wRaw_Temperature As SWord                   ' Holds the raw temperature value from the DS18S20
        Dim fTemperature As Float                       ' Holds the final temperature
    
        Symbol DQ_Pin = PORTB.0                         ' One-wire data pin
    
    '-------------------------------------------------------------------------------------
    ' The main program starts here
    '
    Main:    
        Do                                              ' Create an infinite loop
            Get_Temperature()                           ' Get the temperature from the chip
            HRSOutLn Dec1 fTemperature, " Degrees Centigrade"   ' Transmit the temperature serially
            DelayMS 500
        Loop                                            ' Do it forever
    
    '-------------------------------------------------------------------------------------
    ' Read the DS18S20 chip
    ' Input     : None
    ' Output    : fTemperature holds the temperature value
    ' Notes     : None
    '
    Sub Get_Temperature()
        OWrite DQ_Pin, 1, [$CC, $44]                    ' Start a temperature conversion
        While ORead DQ_Pin, 4 = 0                       ' \
            DelayMS 10                                  ' | Check if the DS18S20 is still busy converting
        Wend                                            ' /
        OWrite DQ_Pin, 1, [$CC, $BE]                    ' Setup to read the temperature
        ORead DQ_Pin, 0, [wRaw_Temperature.Byte0, wRaw_Temperature.Byte1] ' Read the temperature
    
        fTemperature = wRaw_Temperature / 2.0           ' Convert the temperature to a float
        If fTemperature < 0 Then                        ' Is the temperature below 0?
            fTemperature = fTemperature + 0.5           ' Yes. So adjust the value returned
        EndIf
    EndSub
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  8. #18
    Junior Member evoortman's Avatar
    Join Date
    Nov 2004
    Posts
    48
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    151.53 MB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    Thanks Les! (and everyone else for their active contribution)
    I will give it a try.

  9. #19
    Junior Member evoortman's Avatar
    Join Date
    Nov 2004
    Posts
    48
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    151.53 MB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    The OREAD en OWRITE now work properly with the 16F18877. Thanks again LES.

    There also seems to be a problem with the SHIN command. It generates an ASM ERROR:
    (Perhaps necessary to have a look at all communication libs?)

    ;-------------------------------------------------------------------------------
    ;**** Added by Fuse Configurator ****
    ; Use the Fuse Configurator plug-in to change these settings

    Device = 16F18877

    Config1 FEXTOSC_OFF, RSTOSC_HFINT32, CLKOUTEN_OFF, CSWEN_ON, FCMEN_ON
    Config2 MCLRE_OFF, PWRTE_ON, LPBOREN_OFF, BOREN_OFF, BORV_HI, ZCD_OFF, ZCDDIS_OFF, PPS1WAY_OFF, STVREN_OFF, DEBUG_OFF
    Config3 WDTCPS_WDTCPS_8, WDTE_OFF, WDTCWS_WDTCWS_7, WDTCCS_SC
    Config4 WRT_ON, SCANE_not_available, LVP_OFF
    Config5 CP_OFF, CPD_OFF

    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------
    Declare Xtal = 32
    Declare All_Digital = TRUE

    Dim Dummy[5] As Byte

    Symbol MISO = PORTD.2
    Symbol CLK = PORTD.0

    Output CLK
    Input MISO

    START:
    SHIn MISO, CLK, MsbPre, [Str Dummy]
    DelayMS 100
    GoTo START


    ASM ERROR: Error[113] C:\_WORK\TESTING\A.S 6267 : Symbol not previously defined (RS1)

    __SHIN_
    MOVWF PP3
    MOVWF PP3H
    CLRF FSR0H
    MOVF GEN2,W
    MOVWF FSR0L
    MOVF GEN2H,W
    BTFSC GPR,2
    CALL __SET_PIN_HIGH__
    BTFSS GPR,2
    CALL __PULL_PIN_LOW__
    ADDFSR 0,-5
    MOVFRS1,W
    MOVWF FSR1H
    MOVF GEN,W
    MOVWF FSR1L
    ADDFSR 1,5
    MOVF GENH,W
    IORWF INDF1,F
    ADDFSR 1,-5
    CLRF PP0
    CLRF PP0H
    MOVF PP3,W
    BTFSC STATUS,Z
    RETURN
    Last edited by evoortman; 12th November 2018 at 11:16.

  10. #20
    Junior Member evoortman's Avatar
    Join Date
    Nov 2004
    Posts
    48
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    151.53 MB

    0 Not allowed!

    Default Re: Pic16f18877 oread

    For the SHIN problem i started a new thread at:
    http://www.protonbasic.co.uk/showthr...h-the-16F18877

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. PIC16F18877 - no PWM output
    By kuhrig in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 26th September 2018, 18:09
  2. EData and ERead problems in a PIC16F18877
    By bradysmall in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 17th August 2018, 18:57
  3. Oread on open drain pin
    By rcurl in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 25th February 2017, 04:37
  4. Pic16f18877
    By teo in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 4th December 2016, 16:47
  5. 1-Wire oRead returns Zeros
    By mjturner in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 10th January 2016, 18:04

Members who have read this thread since 14th November 2018, 10:37 : 7

Actions :  (Set Date)  (Clear Date)

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