12F629 maximun Baudrate


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Nov 2005
    Location
    Zamora, Spain
    Posts
    11

    Default 12F629 maximun Baudrate

    Hi people, using a 12F629 and programming

    INCLUDE "modedefs.bas"
    DEFINE CHAR_PACING 1 'THIS DOES NOTHING HERE...

    'SET INPUTS AS DIGITAL
    CMCON = %00111111

    lazo:
    serout2 0,32,["1234567890"] '(1)
    pause 20
    goto lazo

    I can see the serial output on my oscilloscope's screen, going at about 19200 baud and repeating with pauses in between. Reading the manual I understand that to set the baud rate to, we can say, 50000 sps, I must program
    1000000/50000 - 20 = 0, instead of 32 in the line (1). If I program a value under 12, I get the pin going from 0 to 5volts (Vcc) randomly and of course no serial signal. The piece is running at 4Mhz from its internal RC oscilator. I read that 12bits PIC does not support serout2 because of its limitations, but it works (PBP v2.46) untill 19200 baud. What I am doing wrong?

    Thanks

  2. #2
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373

    Default

    There is a lot of info on serial comms on this site. Do a search. Next, if you are going to run over 1200 baud, you NEED a crystal or resonator. RC is just too squirrley. That being said, you can run DEBUG instead of serin, up to 115200 baud....But only with a crystal. Cheers...

    Ron

  3. #3
    Join Date
    Nov 2005
    Location
    Zamora, Spain
    Posts
    11

    Default I folow your instructions

    Hi,
    I put a 12Mhz cristal to make run a 16F84A. Again, if I try to go faster than around 50K baud (I have got near 90Kbaud programming 57600 and making the PIC believe that its cristal was 3.5Mhz) I got the same rubish out the selected pin for serial output. It happens the same with 12F508, 12F629 and now 16F84A. Also, DEBUG seems to reach a higher baudrate than SEROUT2 on the same µ.

    All these nonsenses are puzzling me. I routinely programm in assembler for 16F876-20 and send data through a twisted pair cable at about 1.125 Mbit/sec.

    Has somebody push the commands SEROUT2 or DEBUG to the limits?

    Thanks.
    Maxi.

  4. #4
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373

    Default

    Quote Originally Posted by MaxG
    Hi,
    I put a 12Mhz cristal to make run a 16F84A. Again, if I try to go faster than around 50K baud (I have got near 90Kbaud programming 57600 and making the PIC believe that its cristal was 3.5Mhz) I got the same rubish out the selected pin for serial output. It happens the same with 12F508, 12F629 and now 16F84A. Also, DEBUG seems to reach a higher baudrate than SEROUT2 on the same µ.

    All these nonsenses are puzzling me. I routinely programm in assembler for 16F876-20 and send data through a twisted pair cable at about 1.125 Mbit/sec.

    Has somebody push the commands SEROUT2 or DEBUG to the limits?

    Thanks.
    Maxi.
    I'm sorry, I just don't understand what you're trying to do here. Debug will run to 115K baud. If you want faster, go hardware, or shiftin/ shiftout with a faster clock.

  5. #5
    Join Date
    Nov 2005
    Location
    Zamora, Spain
    Posts
    11

    Unhappy

    Dear Ron,
    I am sorry for my poor way of self-explaining. I am only trying to transmit some data (16 bytes bursts) at 115Kbaud using a 16F84A, PBP and the command DEBUG or SEROUT. I started doing some testings on 12F629, 12F508... with their internal 4Mhz RC oscillators and I could not go faster than about 30Kbaud. I follow your advise and put a Crystal, 12Mhz, on a 16F84A to make my testings.

    It happens the same; PBP and PIC 16F84A can not go faster than about 80Kbaud, sometimes even slower. DEBUG can not be used with 16F84a and a 12Mhz EXTERNAL HS OSCILLATOR for reaching 115Kbaud. I suppose (I know) that in pieces with specific Hardware for Serial in/out, rates faster than 115Kbaud can be programmed but I would like to know why I can not reach 115Kb with the configuration noted above and where can be found a document with the limits for the commands DEBUG, SEROUT, SEROUT2. Again, I apologize for my short knowledge, and hope that you will be kind enough for taking a glance on my problem.

    Sincerely,
    Maxi.

  6. #6
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default

    The higher the baudrate the faster and more accurate the clock has to be.

    I doubt you can achieve reliable 115k with only 12MHz Clock speed.

    Try a faster (and calibrated) clock.

    If you have a DSO, scope the output and push it step by step to the limits.

    AND: I wouldn't put anything into production that is ways off specs.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  7. #7
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373

    Default

    I've had no issues with a 4 MHz xtal and Debug pushing 115200 baud. Am I doing something wrong(right)?

    Ron

  8. #8
    Join Date
    Nov 2005
    Location
    Zamora, Spain
    Posts
    11

    Wink

    Hello,
    I have increassed the frec. of the crystal to 18.432 Mhz (I use this not very usual frec for generating accurate 4ms periodic interrupts) and put
    DEFINE OSC 16
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 115200
    in the testing software.
    HSEROUT can output now 49 bytes in 3.340ms from inside a for..next loop (it counts an small time for jumping from the end to the begining of the for), what makes about 146Kbit/sec. The PIC used is a 16F876-20.

    Ron, could you tell me what model have you pushed to 115200 baud with a 4Mhz crystal? I will try to reproduce your results. I do not like loosing time rediscovering the gun-podwer.

    Last question: how can I define my 18,432Mhz oscillator to let PB generate accurate timming? Could it be done?

    Thanks a lot
    Maxi.

  9. #9
    Join Date
    Jul 2003
    Posts
    2,358

    Default

    >> Last question: how can I define my 18,432Mhz oscillator to let PB generate accurate timming? Could it be done?

    No. If you want to use faster clock speeds with PBP keeping good order, pick a frequency that PBP supports - see PBP's manual.

  10. #10
    Join Date
    Nov 2005
    Location
    Zamora, Spain
    Posts
    11

    Default

    Thanks Melanie. I yesterday put a 20Mhz XTal and all in my "old fashioned assembler firmware" started to run under PBP (there is some line in assembler for the interrupt handler, but in general the program has won in clarity and number of features).
    Maxi.

  11. #11
    Join Date
    Mar 2008
    Posts
    59

    Default Re: 12F629 maximun Baudrate

    I am using a 12f629 when I use the internal oscillator my project runs great, However when I switch to the below config and use a 10 mhz ceramic resonator my project does nothing. Please help me understand what I am doing wrong?

    #CONFIG
    cfg = _HS_OSC_
    cfg&= _WDT_ON ; WDT enabled
    cfg&= _PWRTE_OFF ; PWRT disabled
    cfg&= _MCLRE_OFF ; GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD
    cfg&= _BODEN_ON ; BOD enabled
    cfg&= _CP_ON ; Program Memory code protection is enabled
    cfg&= _CPD_OFF ; Data memory code protection is disabled
    __CONFIG cfg
    #ENDCONFIG

    define OSC 10

  12. #12
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: 12F629 maximun Baudrate

    Give this a try.

    Code:
    #CONFIG
        __config _HS_OSC & _WDT_ON & _MCLRE_OFF & _CP_OFF
    
    #ENDCONFIG
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Mar 2008
    Posts
    59

    Default Re: 12F629 maximun Baudrate

    Thank You for your reply! I am up and running. Your code worked and I found my code should have been

    #CONFIG
    cfg = _HS_OSC
    cfg&= _WDT_ON
    cfg&= _PWRTE_OFF
    cfg&= _MCLRE_OFF
    cfg&= _BODEN_ON
    cfg&= _CP_ON
    cfg&= _CPD_OFF
    __CONFIG cfg
    #ENDCONFIG

    define OSC 10

Similar Threads

  1. 12F629 LDR - Light Dependant Resistor
    By Dennis in forum Schematics
    Replies: 15
    Last Post: - 18th February 2010, 23:33
  2. Basic help for 12F629
    By Gene Choin in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd September 2009, 05:06
  3. sleep on 12f629
    By sirvo in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th February 2007, 15:08
  4. Servo control with 12F629
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th June 2005, 00:34
  5. 12F629 I2C problems
    By AIW128ProGuy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th November 2004, 00:41

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