Whats going on? serial comm


Closed Thread
Results 1 to 10 of 10

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hello Bob,

    Instead of wading through the code, can you write *just* the code to send the data?

    When you do so, make sure the sending pin is a I/O pin.
    Make sure you assign it with the TRIS register as a Output
    Make sure you You turn off all ADC's and Comparators.

    If you cannot scope the output on this pin of any data (like the decimal number 1), you are wasting your time with all the other stuff.

    When you get a scoped decimal one, then work on the reciever side.

    When the above is finished, insert it in your code where it belongs.

    MisterE made some EXTREMELY good points... Do not ignore them!


    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...

  2. #2
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116


    Did you find this post helpful? Yes | No

    Default

    I have scoped the output of the transmitter, no problem with that. To test the circuit I have a PIC16F877A transmitting:

    pause 500 'make sure receiver has time to boot
    let value = 1
    loop:
    serout portb.7, 1, [value]
    pause 100
    goto loop

    and a PIC 16F870 receiver:

    loop:
    serin portb.7, 1, [value] 'get input
    high led
    serout portb.0, 1, [value] 'send to pin to compare waves
    low led
    goto loop

    The led never flashes so its just sat waiting for input which it never sees, though the scope sees a nice clean signal on the input pin.

    I have noted all the points Mr E mentioned. I have tried it on lots of pic types, and various pins, I have included "modedefs.bas", I have a 10k resistor from TX pin to gnd, no comparators to worry about.

    I am going to try disabling the A/D before receiving data, but cant see this making a difference, since I'm using port B

    regards

    Bob...

  3. #3
    darkman's Avatar
    darkman Guest


    Did you find this post helpful? Yes | No

    Default

    and a PIC 16F870 receiver:

    loop:
    serin portb.7, 1, [value] 'get input
    high led
    serout portb.0, 1, [value] 'send to pin to compare waves
    'add here PAUSE
    low led
    'add here PAUSE
    goto loop


    and try this software for rs 232 commination capture with pc :

    http://www.rs232pro.com
    Last edited by darkman; - 27th May 2005 at 17:15.

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


    Did you find this post helpful? Yes | No

    Default

    Hello Bob,


    Bob>>loop:
    serin portb.7, 1, [value] 'get input
    high led
    serout portb.0, 1, [value] 'send to pin to compare waves
    low led
    goto loop

    The led never flashes so its just sat waiting for input which it never sees, though the scope sees a nice clean signal on the input pin.
    <<

    Ok, One thing I see, is that it will only take a very SMALL amount of time to send the data to the output, Thus your LED may be flashing, but too fast.

    Can you scope the POrtb.0? and see the data being transmitted? Do not rely on just 1 LED flashing. (which seems you are doing here). It will flash way too fast, and probably look as if it is not flashing at all.

    Since you have scoped the transmitter, and have verified it, then the reciever should be almost the same...Try scoping the PORTB.0, and making sure you have data coming out. If not, it is in your receiver... Then I would suggest slowing down your baud rate to 300.

    Dwayne

    Bob>>I am going to try disabling the A/D before receiving data, but cant see this making a difference, since I'm using port B <<

    Will not make any difference if they are not present on POrtb. PortA ususally has all the AD and comparators...

    Make sure your TRISB has the proper pins as I/O... according to your example

    your input is PORTB.7 and output is PORTB.0

    Thus I would (for safety sake)
    Portb=%10000000

    This assigns POrtb.7 as a input, and all others as outputs.

    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...

  5. #5
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116


    Did you find this post helpful? Yes | No

    Smile

    First of all thanks to everyone who replied to my posts. I have now cured the problem

    serout serpin, 0, ["A",#VALUE,"AA"]
    and
    serin serpin, 0, ["A"],#VALUE
    worked just fine.

    Kind regards

    Bob Edge...

Similar Threads

  1. Serial comm between two PICs
    By ALFRED in forum Serial
    Replies: 24
    Last Post: - 13th March 2014, 23:22
  2. Idea of master/slave serial comm.
    By sirvo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th December 2007, 08:36
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. 16F877, DS18S20 and Serial Comm Problem
    By YellowTang in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2004, 10:36
  5. serial comm from Pic to STAMP
    By d1camero in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th April 2004, 23:58

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