[SOLVED !] Unable to configure EUSART with a 16F18326


Today 08:45
Forum: The Lounge
Starter: normnet
Views: 0
Replies: 2
Yesterday 15:38
Forum: Proton Plus Compiler v3
Starter: gdesantis
Views: 0
Replies: 4
Closed Thread
Results 1 to 7 of 7
  1. #1
    Junior Member palamont's Avatar
    Join Date
    Dec 2016
    Posts
    10
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    73.44 MB

    0 Not allowed!

    Default Unable to configure EUSART with a 16F18326

    Hi all membes who read this.

    I have a problem of configuration of the EUSART of a PIC16F18326. I want to replace a PIC 16F1825 by a PIC 16F18326.

    The following program operates a MP3 player (DFP Player Mini) on the 16F1825 without any problem : this piece of program plays a jingle. EUSART output is on RC4

    "
    Device = 16F1825
    Declare Xtal 32 : Declare Hserial_Baud 9600
    Declare All_Digital = true

    OSCCON = $F0 ; $F0 pour 32 MHz , INTOSC + PLL (MikroProg) ($7A pour 16 MHz, INTOSC + PLL (MikroProg))
    APFCON0 = $00 ;eusart RC4
    TRISA = $FE : TRISC = $00 : WPUC = $FF : OPTION_REG.7 = 0


    HSerOut [$7E,$FF,$06,$09,$00,$00,$02,$EF] : DelayMS 100 ;source lecteur
    For i = 1 To 5
    HSerOut [$7E,$FF,$06,$06,$00,$00,$14,$EF] : DelayMS 100 ;volume 20 lecteur
    Next
    HSerOut [$7E,$FF,$06,$12,$00,$00,$20,$EF] : DelayMS 100 ;lecture jingle


    debut:


    GoTo debut
    "

    The 16F18326 is pin to pin compatible with the 16F1825. I modify the previous program to obtain this one :

    "
    Device = 16F18326
    Declare Xtal 32 : Declare Hserial_Baud 9600
    Declare All_Digital = true

    TRISA = $FF : TRISC = $27
    WPUA = $3F : WPUC = $27

    BAUD1CON = $5C : TX1STA = $2E : RC1STA = $80 : RC4PPS = $14

    HSerOut [$7E,$FF,$06,$09,$00,$00,$02,$EF] : DelayMS 100 ;source lecteur
    For i = 1 To 5
    HSerOut [$7E,$FF,$06,$06,$00,$00,$14,$EF] : DelayMS 100 ;volume 20 lecteur
    Next
    HSerOut [$7E,$FF,$06,$12,$00,$00,$20,$EF] : DelayMS 100 ;lecture jingle


    debut:


    GoTo debut
    "

    ... and NOTHING. The Microchip documentation points out that : TXEN = 1 (TX1STA reg), SYNC = 0 (TX1STA reg), SPEN = 1 (RC1STA reg), RC4PPS = $14 (source is TX).

    So, there is of course a mistake I did. But I can't find where ...

    I somebody had an idea ...

    Thanks a lot for your precious help. Kind regards

    Bruno SAVORNIN

  2. #2
    Junior Member palamont's Avatar
    Join Date
    Dec 2016
    Posts
    10
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    73.44 MB

    0 Not allowed!

    Default Re: Unable to configure EUSART with a 16F18326

    Hi, I've used a scope (PicoScope series 2000) to examine the wave shapes at RC4 (on the 16F1825, and on the 16F18326), and I've been very surprised to discover that I had the same pulses, BUT with a timing ratio approximately of 5 ! Of course, presently, I don't have any explanation.
    Kind regards to all guys.
    PS, I'm very sorry but I don't know how to send a hardcopy of the screen (I have two files .psdata)

  3. #3
    Junior Member palamont's Avatar
    Join Date
    Dec 2016
    Posts
    10
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    73.44 MB

    0 Not allowed!

    Default Re: Unable to configure EUSART with a 16F18326

    Hi everybody, I found the solution. There is a conflict between BAUD1CON and "Declare Hserial_Baud 9600". I would be very happy if somebody could give me a rational explanation. Thanks, have a nice day. Kind regards. Thanks to have read me !

  4. #4
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,857
    Thumbs Up
    Received: 163
    Given: 162
    Total Downloaded
    3.24 GB

    0 Not allowed!

    Default Re: Unable to configure EUSART with a 16F18326

    Could you clarify what the conflict was?
    George

  5. #5
    Junior Member palamont's Avatar
    Join Date
    Dec 2016
    Posts
    10
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    73.44 MB

    0 Not allowed!

    Default Re: Unable to configure EUSART with a 16F18326

    Hi George, I've suppressed the line "BAUD1CON = $5C" in my program. So I think there is a problem with Hserial_Baud 9600, but I'm unable to explain what could happen.
    In doing that, I've access to my MP3 player.

  6. #6
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,857
    Thumbs Up
    Received: 163
    Given: 162
    Total Downloaded
    3.24 GB

    0 Not allowed!

    Default Re: Unable to configure EUSART with a 16F18326

    If you look at the BAUD1CON register you will see that only a few bits are relevant to Async and they can be left at their default ie 0, except BAUD1CON.3 aka BRG16 which controls wheather an 8 or 16 bit baud rate gererator is used. In this case the error is 0.16% for both 8 and 16 bit generators, so the compiler leaves BAUD1CON in its default condition ie. 0 indeed if you look at the LST file you will see that the compiler does not write to that register.

    If you choose not to use the compiler to configure async comms or you want to override the defaults you should get the plugin "USART + EUSART Calculator". Given the maturity of this compiler it is unlikly to be necessary.
    George

  7. #7
    Junior Member palamont's Avatar
    Join Date
    Dec 2016
    Posts
    10
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    73.44 MB

    0 Not allowed!

    Default Re: Unable to configure EUSART with a 16F18326

  8. Thanks for your precious help. Have a nice day !

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. 16F18326 - I cannot initialize
    By Robertux in forum Oscillator Modules
    Replies: 11
    Last Post: 11th October 2017, 19:58
  2. Replies: 0
    Last Post: 21st July 2016, 21:54
  3. ADin - how to configure it?
    By hadv215 in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 3rd June 2015, 23:44
  4. PIC16f1527 IC uart register configure doubt.
    By rparthiban69 in forum Projects discussion
    Replies: 0
    Last Post: 13th March 2013, 08:14

Members who have read this thread since 14th December 2018, 02:11 : 0

Actions :  (Set Date)  (Clear 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