why this doesn't work?


Closed Thread
Results 1 to 8 of 8
  1. #1

    Default why this doesn't work?

    using pbp246.
    pic16c84 over max232 to pc rs232 interface (tested, working - i tested the circuit with simple flashing LED example).
    when i run hyperteminal, i get strange output instead "U"s.

    code:

    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 6
    DEFINE DEBUG_BAUD 115200
    DEFINE DEBUG_MODE 0
    DEFINE OSC 8
    DEFINE DEBUG_PACING 3000
    loop:
    DEBUG "U"
    Goto loop

    what am i doing wrong?
    is 115200 baud possible with DEBUG and 8MHz osc? how?

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    And I'm guessing you haven't tried any lower baud rates?
    (See App.A in the PBP manual)

    Read this thread and the thread linked in the middle...
    http://www.picbasic.co.uk/forum/show...ebug+baud+rate
    Last edited by skimask; - 4th August 2008 at 18:02.

  3. #3

    Default

    9600 baud written in PBP - works, 57600 - works partially(has some garbage).
    but assembler code from Bruce works at 11520baud, 4MHz.

    one more question - 20MHz oscilator can definetly do software 115200 baud input and output with SERIN and SEROUT?

    thanks for your effort!

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by strasni_betmen View Post
    one more question - 20MHz oscilator can definetly do software 115200 baud input and output with SERIN and SEROUT?
    Is that a question or a statement?

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    If you need 115200 bps use DEBUG with a 20MHz oscillator. DEBUG uses the PAUSEUS
    library function.

    To figure out what data rate DEBUG will work with at a given oscillator speed use this;
    (1000000 / (DEBUG_BAUD)) - (52 / (OSC)). Just drop remainders and keep the whole #.

    OSC is how you define it not the actual oscillator speed. I.E. 4MHz would be 52/4 and not
    52/4000000.

    1000000 / 19200 = 52
    52/4 = 13
    52-13=39

    Now try 38400 bps at 4MHz.

    1000000 / 38400 = 26
    52 / 4 = 13
    26-13 = 13

    The result is less than the minimum PAUSEUS time period for 4MHz, so it won't work at
    38400 bps with DEBUG.

    The value you end up with after the math should not be less than the minimum PAUSEUS
    time period shown in your manual in the PAUSEUS section.

    At 4MHz 19200 is the best you'll get with DEBUG.

    With SERIN2/SEROUT2 use the calculation shown in the manual. (1000000/baud)-20. The
    result has to be positive for it to work.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6

    Default

    what pic do you recomend to do a hardware serial communication at 115200 baud?
    nothing else is of importance.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    I would think any PIC with a hardward UART. Check the data sheet. There are calculations
    showing data rates & settings based on various oscillator speeds.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8

    Default

    is the scheme in the attachment good enough to do asynchronus serial communication from pic16f877 to nokia 5110?

    sory if this is not the place to ask but since it is all related i figure it wont hurt nobody! thx to anybody who helps!
    Attached Images Attached Images  

Similar Threads

  1. PortA Doesn't Work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 11
    Last Post: - 8th September 2015, 18:41
  2. pls help me verify my code not work, why???
    By chai98a in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th January 2010, 09:19
  3. How to set ICD-2 clone to work with PBP?
    By G-R-C in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th October 2006, 02:50
  4. with 40 MHZ osc serin2 not work
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th August 2006, 22:56
  5. Pin RA4 doesn't work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 12:03

Members who have read this thread : 1

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