Serout problem


Closed Thread
Results 1 to 40 of 95

Thread: Serout problem

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Just try sending nothing but $AA and $55, nothing else. Forget about manchester encoding and the encoders for awhile.
    At the transmitter end, using the PIC, send out an $AA, then a $55, and repeat....
    At the receiver end, put the 'scope on the digital output.
    If they don't match up, instead of

    transmit:
    serout2 portb.3,n9600, [$aa]
    goto transmit

    try:

    transmit:
    serout2 portb.3, t9600, [$aa]
    goto transmit

    Actually, I think that's your problem!!! You're trying to use the inverted RS232 mode instead of the non-inverted mode. Just change the n9600 to t9600 and see what happens. If you look at my code above, I use serout2 with a mode value of 84, which means true logic levels, 9600 baud, 8 bit, no parity, one stop bit.

    About the only time you'll really need that inverted mode is when you're hooking up to a PC's serial port without a level translator in the middle like a MAX232.

    Let me know what happens...

    JDG

  2. #2
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Actually I tried the t and the n and they have the same signal.
    I posted the signal on my web site
    http://www3.sympatico.ca/lerameur/
    you can see the black speck at the end of the signal $AA

    ken

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Ok, so the signal is a bit messy. Have you tried to see if the firmware in the PIC will actually recognize it as a character? Something like turn on an LED with an $aa recevied, turn it off with a $55 received, or something simple.

    I seem to remember doing some probing myself way back when (albeit with a Tek 2246A, nothing near as nice as yours!)...and it seems to me the output was a bit sloppy there too, but it worked just fine.
    Also, the other issue might be the fact that you're running at 9600. Try slowing to 2400 and see if that cleans it up a bit, if not, try 19200 or higher.

    Just curious...are you sure you're actually transmitting at 9600? The 'scope picture says 250ms at the bottom. Are you sure the OSC define is set right? Oscillator is running at the right speed at both ends? It sorta looks to me like your data is coming out about 8-10 times to slow. I could be reading something wrong though...

    JDG

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Also, are you probing pin 2 or pin 3 on the receiver? It looks like pin 2, since that's the digital output. Does pin 3 look more like a sine wave than square? It should. If pin 3 looks cleaner, use it instead.

    And another thing. At 9600 baud, it'll take at least 24 characters of $55 or $aa (your preference) to 'sync up' the receiver before you can start sending data. Could be less, could be more, tolerances... 24 characters of 'preamble' has always seemed to work for me. And wait about 5-10ms after power up to start sending your data.
    Last edited by skimask; - 28th November 2006 at 06:00.

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok I did some changes this morning,
    I changed the sending clock to 20 Mhz. I saw too that the transmission was too slow, how can I control anything with byte thats like a second. Now the bit rate is ok, I like it now, but then at the receiver I get a weired signal , a steady triangular form with lots of rise and fall time.
    I added a picture of this and my circuit where i am probing
    http://www3.sympatico.ca/lerameur/
    My sending ciruit is just a few inches away.
    ken

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Are pins 6 and 7 grounded on the rx?

    Where's your antenna?

    And now I think you might be transmitting too fast. Check your OSC settings both in your source code and your fuse settings for the PIC.

    The period of the channel 2 signal is 208.4us, which equates to 4798.4bps.

    Multiply by 2 since you're using manchester encoding (or trying to), you get 9596 bps, very close to 9600 baud (within .03%).

    Trying slowing down to 2400 baud and see what happens. Or if you're already there, try 1200 baud, then 9600, whatever. Try different characters. For instance, a $65 (%0110 0101) would be the manchester encoding pattern for a $4. The alternating bit patterns is the key to making the whole thing work and transmit data for you.

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I will home only tonight.
    BUt I did gground pin 6 and 7, there is small wire going from one to the other then ground wire from that to the ground. I removed the antennas because I did not see any difference with or without since I am transmiting very close.
    I did reduce the speed down to 2400 but same output.
    I am tramsitting 10101010 , why is the 4th 1 is doubled.

    On another note, I tried this sending code:
    http://www.rentron.com/ruf-bot.htm
    with same chip in picbasic and I still did not get a good receiving, Although when I tried it, I had a 4Mhz crystal, maybe adding a 20Mhz, BUt his code do not specidy any, so I assumed default. Could my receiver be busted?

    ken

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. Strange SerOut Problem
    By masosi in forum mel PIC BASIC Pro
    Replies: 39
    Last Post: - 23rd April 2007, 06:06
  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