pic16f689 tx problem


+ Reply to Thread
Results 1 to 8 of 8

Thread: pic16f689 tx problem175 days old

  1. #1
    Prolific Poster hadv215's Avatar
    Join Date
    Sep 2009
    Posts
    1,127
    Thumbs Up
    Received: 66
    Given: 26
    Total Downloaded
    3.16 GB

    0 Not allowed!

    Default pic16f689 tx problem

    I want to use the UART for testing purposes on my 16F689 application.
    Compiler 3.7.0.5

    Code:
    Declare Hserial_Baud = 2400
    Declare Hserial_RCSTA = %10010000  ' Enable serial port and continuous receive
    ;Declare HSERIAL_TXSTA = %00100100  ' Enable transmit and asynchronous mode, BRGH=1 
    Declare Hserial_TXSTA = %00100000  ' Enable transmit and asynchronous mode, BRGH=0 
    Declare Hserial_Clear = On         ' Optionally clear the buffer before receiving
    Test:
    Code:
         HRSOut "12345", 13
    All TRIS are 0, configuration is for INTRC, so XTAL = 8

    Result: garbage (of course the baudrate at the receiving end is also 2400)

    I have used this technique a lot of times and with a lot of different devices, it always works.

    Can somebody shed some light on this phenomenon.

    Regards, Harm

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.

  • #2
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,758
    Thumbs Up
    Received: 77
    Given: 33
    Total Downloaded
    4.30 GB

    0 Not allowed!

    Default Re: pic16f689 tx problem

    Have you put a CRO on the TX pin Harm?
    John

  • 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
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    472
    Thumbs Up
    Received: 58
    Given: 0
    Total Downloaded
    330.54 MB

    0 Not allowed!

    Default Re: pic16f689 tx problem

    configuration is for INTRC, so XTAL = 8
    I assume you mean INTOSC.

    The default OSCCON setting at pon is for 4MHz. Have you changed it to get 8MHz?

  • 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.

  • #4
    Prolific Poster hadv215's Avatar
    Join Date
    Sep 2009
    Posts
    1,127
    Thumbs Up
    Received: 66
    Given: 26
    Total Downloaded
    3.16 GB

    0 Not allowed!

    Default Re: pic16f689 tx problem

    I used the Fuse Configurator without checking.
    The FC does no identify INTOSC/IO, only INTRC/IO but the description is the one used for INTOSC/IO in the datasheet.
    The values in the .lst indicate the same config values (0x3FCC/D) for both INTRC and INTOSC.
    The Config value in the .lst is 38C4, the 3 LSB's indicate the OSC which is "100", so INTOSCIO according to chapter 14.

    The 8 MHz is achieved by setting bits 4, 5, 6 (IRCFx) of OSCCON to 1.

    What I did next was recompile with the IO on pin 3 (CLKOUT) enabled and XTAL = 4. My scope showed a freq of 1MHz, so this indicates the clock is running at 4MHz.
    Baud rate unchanged and....tadah...meaningfull data in the terminal.

    Thanks tumbleweed.

    Now the only question remaing is why, even with correct config values, OSCCON makes no difference.

    Regards, Harm

  • 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
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    472
    Thumbs Up
    Received: 58
    Given: 0
    Total Downloaded
    330.54 MB

    0 Not allowed!

    Default Re: pic16f689 tx problem

    So you're saying that if you have the config set for INTOSCIO and
    Code:
    XTAL = 8
    
    OSCCON = 0x70
    you don't get 8MHz (2MHz on the CLKOUT pin)?
    That's odd... I would have thought that would work.

  • 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.

  • #6
    Prolific Poster hadv215's Avatar
    Join Date
    Sep 2009
    Posts
    1,127
    Thumbs Up
    Received: 66
    Given: 26
    Total Downloaded
    3.16 GB

    0 Not allowed!

    Default Re: pic16f689 tx problem

    Yes, I would have thought that too, but it just does not work.
    It looks like the device just does not support INTOSCIO.
    For this project 4 MHz is of no consequence, as long as the UART does it work during testing (calibrating two sensors).

  • 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
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    472
    Thumbs Up
    Received: 58
    Given: 0
    Total Downloaded
    330.54 MB

    1 Not allowed!

    Default Re: pic16f689 tx problem

    It looks like the formal names for the FOSC config setting are as follows (from MPASM 8bit_device.info file):
    Code:
    <FOSC><Oscillator Selection bits><7><8>
    <LP><LP oscillator: Low-power crystal on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN><0>
    <XT><XT oscillator: Crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN><1>
    <HS><HS oscillator: High-speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN><2>
    <EC><EC: I/O function on RA4/OSC2/CLKOUT pin, CLKIN on RA5/OSC1/CLKIN><3>
    <INTRCIO><INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN><4>
    <INTRCCLK><INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN><5>
    <EXTRCIO><RCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN><6>
    <EXTRCCLK><RC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, RC on RA5/OSC1/CLKIN><7>
    So, they're a little different than what's called out in the datasheet...

    INTRCIO = 100 = datasheet INTOSCIO
    INTRCCLK = 101 = datasheet INTOSC

  • 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.

  • #8
    Prolific Poster hadv215's Avatar
    Join Date
    Sep 2009
    Posts
    1,127
    Thumbs Up
    Received: 66
    Given: 26
    Total Downloaded
    3.16 GB

    1 Not allowed!

    Default Re: pic16f689 tx problem

    I've just thrown all of my 16F689s away. There is something horribly wrong with the I/O ports. Even simple tests, like lighting up LEDs fail on a number of portpins.

  • 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)

       

    Members who have read this thread : 31

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