Code for Send/Receive TTL/Comport Sample? - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 53 of 53

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    Are you using the mecanique serialtool ? At least its a known quantity

    try changing the pc end baudrate ie try 4800 and 19200
    and the baudcon 4,5 bits as 0 and 1

    maybe flash a led at 1 second intervals to check if osc is 20 mhz

  2. #2
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    yes im using MCS Serial tool,

    4,5 = 0,1 and running @ 4800 results = ãã7üããã7üããã7üããã
    same running at 19200 results = w~wüwüwüwüwüwüwüwüwüwüwü

    not sure whats going on
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  3. #3
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    ive been hooking it directly to PIC as I dont have a MAX232 chip or anything else available right now, I was told by the seller that I should be able to hook this cable directly to PIC but they had no help files, schematics, code etc.. available.

    I have modified code for transmit to PC only, after I see something come in then I can work on the receive side. Here is my complete code right now, and I am using the microcode studio serial tool for connections.

    Code:
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    Define OSC 20  
    define HSER_BAUD 9600
    DEFINE HSER_BITS 8
    DEFINE HSER_CLROERR 1
    RCSTA = $90
    TXSTA = $24
    TRISC = %11000000
    TRISD = 0
    BAUDCON.4 = 0
    BAUDCON.5 = 1
    RCSTA.7 = 1
    
    start:  
    Hserout ["Hello World", 13, 10] ' Send text followed by carriage return and linefeed 
    pause 1000
    goto start
    End
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    Maybe sspcon1.5=0 just incase

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    I meant trying baudcon 4 and 5 =0 and then 4 and 5 as 1

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    I assume serial tool is set to 8 bits no parity and 1 stop bit

  7. #7
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    ive tried both as 0 and both as 1
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    What are your config settings i think the osc is not what yoyu think

    you need a config fosc=hs in there


    with the internal osc
    for 4mhz you need a oscon=$60
    or $70 for 8 mhz

  9. #9
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    Im useing a external OSC 20mhz using EC PIO mode so RA6 is IO, this is a TTL OSC
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  10. #10
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    I think you have a few errors in your configuration too.
    Try:
    define HSER_RCSTA 90h
    define HSER_TXSTA 20h
    define HSER_BAUD 9600
    define HSER_CLROERR 1

    Do not put this after the defines:
    RCSTA = $90
    TXSTA = $24
    By doing so, you are effectively messing up what the defines did, and in one case ($24) you are introducing an error (should be $20)

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    Ok well flash a led to prove osc is what you think

  12. #12
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    led is on 99% of the time, flashing ~2 times a sec, my baud rate is at 9600 right now
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  13. #13
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: Code for Send/Receive TTL/Comport Sample?

    Are you using pbp3 ?
    What about config cpudiv = osc1_pll2

Similar Threads

  1. how to send and receive sms using vb?
    By shyhigh2002 in forum Off Topic
    Replies: 0
    Last Post: - 1st April 2009, 10:18
  2. please who can help me for sample code
    By jasem700 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd February 2009, 21:41
  3. How to build modem for only send and receive the msg
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th April 2006, 14:37
  4. send and receive data using pic 16f84a
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2006, 21:12
  5. send and receive data using pic 16f84a
    By PoTeToJB in forum Serial
    Replies: 1
    Last Post: - 25th February 2006, 15:47

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