SEROUT Just Garbage!


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Posts
    21

    Unhappy SEROUT Just Garbage!

    Im trying to get a PIC12F629 to send a simple "hello world" to my pc using windows Hyperterm, and I have the Pic conected as showed in the manual (1k resistor to pin 2 on the db9 connector)
    All I get is garbage on the screen !
    Can anyone HELP? here is my code that I trying to get working


    INCLUDE "modedefs.bas"
    DEFINE CHAR_PACING 1000
    DEFINE OSC 4
    Pause 200 ' Allow pic to Stabilize
    TRISIO = %00000000
    'ADCON0 = 0 ' no adc
    OPTION_REG.7 = 0 ' gpio 0 - 2 digital
    WPU = 255 ' week pull ups on all pins
    CMCON = 7 ' turn week pull ups on
    'ANSEL = 0

    loop:

    SerOut GPIO.0,N300,["Hello World"]
    Pause 1000
    SerOut GPIO.0,N300,["abc",13,10]
    Pause 4000
    GoTo loop

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    you don't need those
    DEFINE CHAR_PACING 1000
    DEFINE OSC 4
    OPTION_REG.7 = 0 ' gpio 0 - 2 digital
    WPU = 255 ' week pull ups on all pins


    AND you must set the OSCCAL to get accuracy with SEROUT. I hope your OSCCAL is not erase as now...

    at the end your code will look like this.


    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
        ' Internal Oscillator
        ' Enable watch dog timer
        ' Enable power up timer
        ' Disable MCLR pin
        ' Enable brown out detect
    DEFINE OSCCAL_1K 1
    INCLUDE "modedefs.bas"
    TRISIO.0 = 0 ' set GPIO.0 as output
    CMCON = 7 ' turn off analog comparator
    
    Pause 200 ' Allow pic to Stabilize 
    
    loop:
    
    SerOut GPIO.0,N2400,["Hello World"]
    Pause 1000
    SerOut GPIO.0,N2400,["abc",13,10]
    Pause 4000
    GoTo loop
    and this one is working @2400 baud

    The most important thing here is to set the OSCCAL at the begining.

    hope this help you
    Last edited by mister_e; - 31st January 2005 at 16:02.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    you don't need those
    DEFINE CHAR_PACING 1000
    DEFINE OSC 4
    OPTION_REG.7 = 0 ' gpio 0 - 2 digital
    WPU = 255 ' week pull ups on all pins


    AND you must set the OSCCAL to get accuracy with SEROUT. I hope your OSCCAL is not erase as now...

    at the end your code will look like this.


    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
        ' Internal Oscillator
        ' Enable watch dog timer
        ' Enable power up timer
        ' Disable MCLR pin
        ' Enable brown out detect
    DEFINE OSCCAL_1K 1
    INCLUDE "modedefs.bas"
    TRISIO.0 = 0 ' set GPIO.0 as output
    CMCON = 7 ' turn off analog comparator
    
    Pause 200 ' Allow pic to Stabilize 
    
    loop:
    
    SerOut GPIO.0,N2400,["Hello World"]
    Pause 1000
    SerOut GPIO.0,N2400,["abc",13,10]
    Pause 4000
    GoTo loop
    and this one is working @2400 baud

    The most important thing here is to set the OSCCAL at the begining.

    hope this help you

    Im trying to connect a 12F675 to my machine to test it out but I get nothing in hyperterm.
    Have
    +5 to pin 1
    1K resistor on pin 7 connected to pin 2 on DB9
    Ground on pin 8
    and a 0.1uF from pin 1 to 8.
    pin 5 on DB9 to ground.

    Do I connect first on hyper term or power the chip up first? what setting should I have?

    Thanks

    Using the above code and as 12F675 I can't get it to send anything.

  4. #4
    Join Date
    Jan 2005
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Set up "Hyper term" using "VT100 Emulation".

    Then set the comm port like this
    Bits per sec = 2400
    Data bits =8
    Parity = none
    Stops bits = 1
    Flow control = none

  5. #5
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Tried that but still nothing

  6. #6
    Join Date
    Jan 2005
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Can you post youre code!

  7. #7
    Join Date
    Jan 2005
    Posts
    21


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks for the Fast responce Mister E!
    Since you said that the code was working for you, I rechecked my comm port settings (found FIFO buffers was not checked). I still had garbage so I added a .22uf cap on the powersuply and BINGO! "Hello worldabc"

    I just wounder How my other code ever worked without a cap?

    Kman

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I just wounder How my other code ever worked without a cap?
    it can, but without OSCCAL... i don't think so, OR intermittent.

    Place a 0.1uF or 0.22uF it's a need for all PICs apps. More than often people forget that the problem can comes from the hardware.

    I always place 0.1uF + 10uF tantalum as close as possible to the PIC. Since now... only software problem
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Kman,

    Kman>>I just wounder How my other code ever worked without a cap?<<

    Well, this seems to be very common. I use a computer power supply, (stolen from older computers). If I do not use a cap on it, I will not get anything, and if I do, it will be garbage.

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 16:46
  3. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 17:11
  4. Keypad unlock (as in garage door possibly)
    By Fred in forum Code Examples
    Replies: 5
    Last Post: - 2nd April 2006, 04:26
  5. Replies: 11
    Last Post: - 13th July 2005, 19:26

Members who have read this thread : 0

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