Strange SerOut Problem


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    I've tried the circuit with the Crystal (4MHz), everything seems to be the same...

    Attached is the circuit diagram, could someone please check it to see what I am doing wrong please???

    The LED blinks if the serial port is not connected to the computer.
    The LED doesn't blink if the serial port IS connected to the computer, so I'm thinking its a grounding problem. Any suggestions?

    This is the code that I am testing with:

    Code:
    PORTA = 0
    PORTB = 0
    CMCON = 7 'Set 16F628A Comparators off
    
    Include "modedefs.bas"
    light var PORTB.0
    Low light
    
    Start:
    Toggle light
    SerOut PORTA.1,N300,["Pulse",10,13]
    Pause 100
    goto Start
    
    High light
    end
    Attached Images Attached Images  

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by masosi View Post
    I've tried the circuit with the Crystal (4MHz), everything seems to be the same...

    Attached is the circuit diagram, could someone please check it to see what I am doing wrong please???

    The LED blinks if the serial port is not connected to the computer.
    The LED doesn't blink if the serial port IS connected to the computer, so I'm thinking its a grounding problem. Any suggestions?

    This is the code that I am testing with:

    Code:
    PORTA = 0
    PORTB = 0
    CMCON = 7 'Set 16F628A Comparators off
    
    Include "modedefs.bas"
    light var PORTB.0
    Low light
    
    Start:
    Toggle light
    SerOut PORTA.1,N300,["Pulse",10,13]
    Pause 100
    goto Start
    
    High light
    end
    Ya, there's a few things wrong with that.
    Check your little green book...page 131, 136, 139, 144. You might find your problem/answer there.

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    You show VSS = -5V on your sketch. It should be VSS = 0V

    ALso, If you have nothing between your +5.0V power supply and your PIC, then you should measure +5.0V between VDD and VSS on your PIC (not 3.5V).

    EDIT: it sounds like a grounding problem just like you suspected
    Last edited by paul borgmeier; - 21st April 2007 at 07:13. Reason: see EDIT:
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  4. #4
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by paul borgmeier View Post
    You show VSS = -5V on your sketch. It should be VSS = 0V

    ALso, If you have nothing between your +5.0V power supply and your PIC, then you should measure +5.0V between VDD and VSS on your PIC (not 3.5V).

    EDIT: it sounds like a grounding problem just like you suspected
    Well by -5V, I mean the negative side of the power supply.
    This is the power supply I'm using (pretty cheap and nasty, but I thought it would do the job (it did for a while)).
    http://www.jaycar.com.au/productView...Max=&SUBCATID= - Model MP-3144 (the first one listed).
    ...I don't know what switchmode means...

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by masosi View Post
    Well by -5V, I mean the negative side of the power supply.
    This is the power supply I'm using (pretty cheap and nasty, but I thought it would do the job (it did for a while)).
    http://www.jaycar.com.au/productView...Max=&SUBCATID= - Model MP-3144 (the first one listed).
    ...I don't know what switchmode means...
    Switchmode...hmmmm...maybe there's not enough load on the circuit to turn on the regulator in the PSU, which is sometimes needed for those things. I'd try a battery pack next, even a 9v battery with a 7805 will do for awhile.

    P.S. - quick lesson in PSU's

    Linear power supply - you put in 10v, you want to draw 5v @ 1 amp. The regulator dumps 5v @ 1 amp overboard as heat and saves the other 5v for your output. In this case, it's only 50% efficient.

    Switchmode - you put in 10v, you want to draw 5v @ 1 amp. The 'switcher' basically turns a MOSFET on and off really fast (sometimes as high as a few Mhz) thru an inductor to keep an output cap charged up to 5v. Sometimes these types can hit about 98% efficiency, very little wasted heat. Drawbacks are that you have to draw a little bit to keep the regulator regulating and they introduce a little bit of noise on the output (a very little bit, usually not enough to mess with anything).
    Last edited by skimask; - 21st April 2007 at 07:28.

  6. #6
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Switchmode...hmmmm...maybe there's not enough load on the circuit to turn on the regulator in the PSU, which is sometimes needed for those things.
    So what do you suggest for a permanant setup for this kind of thing? What type of wall adapter power supply? (Not battery).

  7. #7
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    I've tried with and without a resistor on the Rx and Tx Pin, there's no difference.

    Does it make sense that the serial port seems to be sucking the life out of the circuit...?

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by masosi View Post
    I've tried with and without a resistor on the Rx and Tx Pin, there's no difference.

    Does it make sense that the serial port seems to be sucking the life out of the circuit...?
    No, but it makes sense that without the resistor, you probably smoked all of your ports.

    But...back to the timing thing. The LED blinks, ok... Back to basics...
    Do you have an LCD? Make a counter, one second, power up the PIC, start your stopwatch. Wait for 100 seconds. If your watch and the PIC/LCD match up after 100 seconds, you can be reasonably sure you're within 1-2% of the 4Mhz clock speed. The longer you go, the more accurately you can count it up.

  9. #9
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    No, but it makes sense that without the resistor, you probably smoked all of your ports.
    I'm using the same COM port to program the PIC using JDM2 serial programmer and WinPic - there are no errors there, so the COM port should be fine!?

    Quote Originally Posted by skimask View Post
    But...back to the timing thing. The LED blinks, ok... Back to basics...
    Do you have an LCD? Make a counter, one second, power up the PIC, start your stopwatch. Wait for 100 seconds. If your watch and the PIC/LCD match up after 100 seconds, you can be reasonably sure you're within 1-2% of the 4Mhz clock speed. The longer you go, the more accurately you can count it up.
    I just did a Pause command of 2mins, timing it showed up as 2mins 2secs. Is this too far out?

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by masosi View Post
    I'm using the same COM port to program the PIC using JDM2 serial programmer and WinPic - there are no errors there, so the COM port should be fine!?
    But all of your PICs might not be! Or at least none of the ports you've hooked up to. Maybe not just PortA.1, but all of PortA, heck for that matter, maybe the whole chip. I don't know why...just maybe...

    I just did a Pause command of 2mins, timing it showed up as 2mins 2secs. Is this too far out?
    Nah, I'd chalk that amount of error up to you not clicking quite right on time, maybe a couple ms here and there in the program, etc.etc., ya know, all those things adding up. I'd say your clock is good within say 1-3%, far close enough for 300 baud, and probably up to 2400 baud.

  11. #11
    Join Date
    Apr 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    But all of your PICs might not be! Or at least none of the ports you've hooked up to. Maybe not just PortA.1, but all of PortA, heck for that matter, maybe the whole chip. I don't know why...just maybe...
    Ok, I'll get my hands on another chip and give that a go.

    Quote Originally Posted by skimask View Post
    Nah, I'd chalk that amount of error up to you not clicking quite right on time, maybe a couple ms here and there in the program, etc.etc., ya know, all those things adding up. I'd say your clock is good within say 1-3%, far close enough for 300 baud, and probably up to 2400 baud.
    Well thats good news!

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. Strange Serout Behaviour
    By bluesmoke in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th August 2009, 04:12
  4. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 17:11
  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